diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/actor_profile.php | 10 | ||||
| -rw-r--r-- | templates/actor_profile_pending_follow.php | 21 | ||||
| -rw-r--r-- | templates/follow_requests_page.php | 9 | ||||
| -rw-r--r-- | templates/side_navigation.php | 13 | ||||
| -rw-r--r-- | templates/skeleton.php | 11 | ||||
| -rw-r--r-- | templates/unread_indicator.php | 1 |
6 files changed, 64 insertions, 1 deletions
diff --git a/templates/actor_profile.php b/templates/actor_profile.php index c480d21..0dc3ccd 100644 --- a/templates/actor_profile.php +++ b/templates/actor_profile.php @@ -5,7 +5,13 @@ $user = UserAccount::findByCurrentSession(); ?> <div class="fullProfile"> <div class="basicInfo"> - <?php call_template('actor_avatar', ['actor' => $actor]); ?> + <?php if ($addLink ?? false): ?> + <a href="/@/<?= $actor->getFullHandle() ?>"> + <?php endif; ?> + <?php call_template('actor_avatar', ['actor' => $actor]); ?> + <?php if ($addLink ?? false): ?> + </a> + <?php endif; ?> <div> <div class="displayName"><?= $actor->displayName ?></div> <div class="handle">@<?= $actor->getFullHandle() ?></div> @@ -26,6 +32,8 @@ $user = UserAccount::findByCurrentSession(); <?php if (isset($user) && $actor->id != $user->actor->id): ?> <div class="followInfo"> + <?php if ($actor->followsPending($user->actor)) + call_template('actor_profile_pending_follow', ['subject' => $actor, 'object' => $user->actor]); ?> <?php if ($actor->follows($user->actor)): ?> <?= __('user.profile.followsYou') ?> <?php endif; ?> diff --git a/templates/actor_profile_pending_follow.php b/templates/actor_profile_pending_follow.php new file mode 100644 index 0000000..2f49fcd --- /dev/null +++ b/templates/actor_profile_pending_follow.php @@ -0,0 +1,21 @@ +<?php if (isset($response)): ?> + + <div class="pendingInfo"> + <?= __("followRequests.$response") ?> + </div> + +<?php else: ?> + + <div class="pendingInfo"> + <?= __('user.profile.pendingFollowsYou') ?> + <button class="primary" hx-post="/fragment/actor/<?= $subject->id ?>/acceptPending" hx-target="closest .pendingInfo" + hx-swap="outerHTML"> + <?= __('followRequests.accept.action') ?> + </button> + <button class="secondary" hx-post="/fragment/actor/<?= $subject->id ?>/rejectPending" + hx-target="closest .pendingInfo" hx-swap="outerHTML"> + <?= __('followRequests.reject.action') ?> + </button> + </div> + +<?php endif; ?>
\ No newline at end of file diff --git a/templates/follow_requests_page.php b/templates/follow_requests_page.php new file mode 100644 index 0000000..f93601c --- /dev/null +++ b/templates/follow_requests_page.php @@ -0,0 +1,9 @@ +<?php call_template('skeleton', ['pageTitle' => __('followRequests.pageTitle')], function () { + global $actors; + if (count($actors) == 0) { + call_template('placeholder_text'); + } + foreach ($actors as $actor) { + call_template('actor_profile', ['actor' => $actor, 'addLink' => true]); + } +});
\ No newline at end of file diff --git a/templates/side_navigation.php b/templates/side_navigation.php new file mode 100644 index 0000000..d9a2dfd --- /dev/null +++ b/templates/side_navigation.php @@ -0,0 +1,13 @@ +<ul class="sideNavigation"> + <?php foreach ($links as $entry): ?> + <li> + <a href="<?= $entry['href'] ?>"> + <div class="icon material-symbols-outlined"><?= $entry['icon'] ?></div> + <div><?= $entry['label'] ?></div> + <?php if (isset($entry['unreadCount']) && $entry['unreadCount'] > 0) { + call_template('unread_indicator', ['count' => $entry['unreadCount']]); + } ?> + </a> + </li> + <?php endforeach; ?> +</ul>
\ No newline at end of file diff --git a/templates/skeleton.php b/templates/skeleton.php index 6eb6bd1..fced6b8 100644 --- a/templates/skeleton.php +++ b/templates/skeleton.php @@ -1,4 +1,6 @@ <?php + +use Digitigrade\Model\FollowRelation; $user = Digitigrade\Model\UserAccount::findByCurrentSession(); ?> <!DOCTYPE html> @@ -44,6 +46,15 @@ $user = Digitigrade\Model\UserAccount::findByCurrentSession(); <?php if ($user != null) { call_template('write_note_form'); + call_template('side_navigation', ['links' => [ + [ + 'href' => '/followrequests', + 'icon' => 'person_add', + 'label' => __('navigation.followRequests'), + 'unreadCount' => FollowRelation::countWhere("object = ? AND status = 'pending'", [$user->actor->id]) + ], + ['href' => '/logout', 'icon' => 'logout', 'label' => __('navigation.logout')] + ]]); } ?> </section> diff --git a/templates/unread_indicator.php b/templates/unread_indicator.php new file mode 100644 index 0000000..bacacc3 --- /dev/null +++ b/templates/unread_indicator.php @@ -0,0 +1 @@ +<span class="unreadIndicator"><?= $count ?></span>
\ No newline at end of file |
