diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/actor_profile.php | 24 | ||||
| -rw-r--r-- | templates/actor_profile_block_button.php | 8 | ||||
| -rw-r--r-- | templates/infinite_scroll_trigger.php | 2 | ||||
| -rw-r--r-- | templates/menu_button.php | 14 | ||||
| -rw-r--r-- | templates/note.php | 17 |
5 files changed, 54 insertions, 11 deletions
diff --git a/templates/actor_profile.php b/templates/actor_profile.php index cfcc510..1e37f28 100644 --- a/templates/actor_profile.php +++ b/templates/actor_profile.php @@ -5,6 +5,7 @@ $user = UserAccount::findByCurrentSession(); ?> <div class="fullProfile"> <div class="basicInfo"> + <?php if ($addLink ?? false): ?> <a href="/@/<?= $actor->getFullHandle() ?>"> <?php endif; ?> @@ -12,20 +13,28 @@ $user = UserAccount::findByCurrentSession(); <?php if ($addLink ?? false): ?> </a> <?php endif; ?> + <div> <div class="displayName"><?= htmlspecialchars($actor->displayName) ?></div> <div class="handle">@<?= $actor->getFullHandle() ?></div> - <div class="joinedDate"><?= sprintf(__('user.profile.createdAt'), $actor->created->format('Y-m-d')) ?></div> + <div class="joinedDate"><?= sprintf(__('user.profile.createdAt'), $actor->created->format('Y-m-d')) ?> + </div> </div> + <div class="profileMiniActions"> - <?php if ($user != null && $user->actor != $actor) - call_template('actor_profile_block_button', ['actor' => $actor, 'user' => $user]); ?> - <?php if (!$actor->isLocal): ?> - <a class="material-symbols open-in-new" href="<?= $actor->homepage ?>" - title="<?= __('user.profile.openRemote') ?>" target="_blank"></a> - <?php endif; ?> + <?php call_template('menu_button', [], function () { + global $actor; + // i don't know why but `global $user` just straight up doesnt work? + $user = UserAccount::findByCurrentSession(); + ?> + <?php if ($user != null && $user->actor != $actor): ?> + <li><?php call_template('actor_profile_block_button', ['user' => $user, 'actor' => $actor]) ?></li> + <?php endif; ?> + <?php }); ?> </div> + </div> + <?php if (isset($actor->bio) && $actor->bio != '') { ?> <pre class="bio"><?= htmlspecialchars($actor->bio) ?></pre> <?php } else { @@ -48,4 +57,5 @@ $user = UserAccount::findByCurrentSession(); </button> </div> <?php endif; ?> + </div>
\ No newline at end of file diff --git a/templates/actor_profile_block_button.php b/templates/actor_profile_block_button.php index f82cc9a..1b71613 100644 --- a/templates/actor_profile_block_button.php +++ b/templates/actor_profile_block_button.php @@ -2,6 +2,8 @@ $blocks = $user->actor->blocks($actor); $action = $blocks ? 'unblock' : 'block'; ?> -<button class="material-symbols <?= $blocks ? 'remove' : 'block' ?>" title="<?= __("user.profile.$action") ?>" - hx-confirm="<?= __("user.profile.$action.confirm") ?>" hx-post="/fragment/actor/<?= $actor->id ?>/blockButton" - hx-swap="outerHTML"></button>
\ No newline at end of file +<button hx-confirm="<?= __("user.profile.$action.confirm") ?>" hx-post="/fragment/actor/<?= $actor->id ?>/blockButton" + hx-swap="outerHTML"> + <span class="material-symbols <?= $blocks ? 'remove' : 'block' ?>"></span> + <span><?= __("user.profile.$action") ?></span> +</button>
\ No newline at end of file diff --git a/templates/infinite_scroll_trigger.php b/templates/infinite_scroll_trigger.php index dce1343..3a19ebe 100644 --- a/templates/infinite_scroll_trigger.php +++ b/templates/infinite_scroll_trigger.php @@ -1,4 +1,4 @@ -<?php if ($isEnd): ?> +<?php if ($isEnd ?? false): ?> <div id="infiniteScroll" hx-swap-oob="true"> <?php call_template('placeholder_text', ['count' => 0]); ?> </div> diff --git a/templates/menu_button.php b/templates/menu_button.php new file mode 100644 index 0000000..da47569 --- /dev/null +++ b/templates/menu_button.php @@ -0,0 +1,14 @@ +<div class="menuButton"> + <button type="button" class="material-symbols more-horiz" _=" + on click + set menu to next .popupMenu + toggle @hidden on menu + measure me then set pos to it + set menu.style.top to `${scrollY + pos.top}px` + set menu.style.right to `${(scrollX + innerWidth) - pos.right}px` + on click from elsewhere set @hidden of next .popupMenu to false + "></button> + <ul class="popupMenu" hidden> + <?php slot(); ?> + </ul> +</div>
\ No newline at end of file diff --git a/templates/note.php b/templates/note.php index e5c2942..74ce566 100644 --- a/templates/note.php +++ b/templates/note.php @@ -94,6 +94,23 @@ if ($user != null) { 'disabled' => $actionsDisabled ]); ?> + <div class="right"> + <?php call_template('menu_button', [], function () { + global $note; + $user = UserAccount::findByCurrentSession(); + ?> + <?php if ($note->author == $user?->actor || $user?->isAdmin): ?> + <li> + <button hx-delete="/fragment/note/<?= $note->id ?>" + hx-confirm="<?= __('note.action.delete.confirmation') ?>" hx-target="closest .note" + hx-swap="delete"> + <span class="material-symbols delete-outline"></span> + <span><?= __('note.action.delete') ?></span> + </button> + </li> + <?php endif; ?> + <?php }); ?> + </div> </div> <?php call_template('reply_form', ['note' => $note]); ?> |
