diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/interaction_button.php | 2 | ||||
| -rw-r--r-- | templates/note.php | 41 | ||||
| -rw-r--r-- | templates/reply_button.php | 1 |
3 files changed, 29 insertions, 15 deletions
diff --git a/templates/interaction_button.php b/templates/interaction_button.php index b3d072d..7315f7d 100644 --- a/templates/interaction_button.php +++ b/templates/interaction_button.php @@ -16,7 +16,7 @@ $id = "interactButton-$action-$note->id"; <button title="<?= $tooltip ?>" class="icon material-symbols-outlined <?= $active ? 'active' : '' ?>" hx-post="<?= "/fragment/note/$note->id/$action" ?>" hx-swap="outerHTML" hx-target="closest .interactButtonContainer" hx-disabled-elt="this" id="<?= $id ?>" - _="on click wait 1s then trigger update on #liveTimelineUpdater"> + _="on click wait 1s then trigger update on #liveTimelineUpdater" <?= ($disabled ?? false) ? 'disabled' : '' ?>> <?= $icon ?> </button> <label for="<?= $id ?>" class="interactionCount"><?= $count ?? '' ?></label> diff --git a/templates/note.php b/templates/note.php index 59f4a7a..98581c8 100644 --- a/templates/note.php +++ b/templates/note.php @@ -5,16 +5,20 @@ use Digitigrade\Model\UserAccount; $user = UserAccount::findByCurrentSession(); $interKinds = []; +$actionsDisabled = $user == null; if ($user != null) { $interactions = $note->getInteractionsWithAuthor($user->actor); $interKinds = array_map(fn($inter) => $inter->kind, $interactions); } ?> <article class="note <?= ($selected ?? false) ? 'selected' : '' ?>"> + <a href="/@/<?= $note->author->getFullHandle() ?>"> <?php call_template('actor_avatar', ['actor' => $note->author]); ?> </a> + <div> + <div class="infoLine"> <a class="authorName" href="/@/<?= $note->author->getFullHandle() ?>"><?= $note->author->displayName ?></a> <span class="authorHandle">@<?= $note->author->getFullHandle() ?></span> @@ -32,22 +36,24 @@ if ($user != null) { NotePrivacyScope::MUTUALS => __('note.privacy.scope.mutuals'), NotePrivacyScope::FOLLOWERS => __('note.privacy.scope.followers'), NotePrivacyScope::PUBLIC => __('note.privacy.scope.public') - } . '">' . match ($note->privacy->scope) { - NotePrivacyScope::NONE => 'lock', - NotePrivacyScope::MUTUALS => 'group', - NotePrivacyScope::FOLLOWERS => 'groups', - NotePrivacyScope::PUBLIC => 'public' - } ?></span> + } ?>"><?= match ($note->privacy->scope) { + NotePrivacyScope::NONE => 'lock', + NotePrivacyScope::MUTUALS => 'group', + NotePrivacyScope::FOLLOWERS => 'groups', + NotePrivacyScope::PUBLIC => 'public' + } ?></span> </div> + <?php if (isset($note->inReplyTo)): ?> - <div class=" replyInfo"> - <a href="/@/<?= $note->inReplyTo->author->getFullHandle() ?>/note/<?= $note->inReplyTo->id ?>"> - <span class="material-symbols-outlined inlineIcon">reply</span> - <?= sprintf(__('note.info.replyTo'), - '<b>' . $note->inReplyTo->author->displayName) . '</b>' ?> - </a> + <div class="replyInfo"> + <a href="/@/<?= $note->inReplyTo->author->getFullHandle() ?>/note/<?= $note->inReplyTo->id ?>"> + <span class="material-symbols-outlined inlineIcon">reply</span> + <?= sprintf(__('note.info.replyTo'), + '<b>' . $note->inReplyTo->author->displayName) . '</b>' ?> + </a> </div> <?php endif; ?> + <div class="content"> <?php if (isset($note->summary)): ?> <details> @@ -58,6 +64,7 @@ if ($user != null) { </details> <?php endif; ?> </div> + <div class="buttons"> <?php foreach (['like', 'dislike', 'reshare'] as $action) { $kind = InteractionKind::from($action); @@ -65,12 +72,18 @@ if ($user != null) { 'action' => $action, 'note' => $note, 'active' => in_array($kind, $interKinds), - 'count' => $note->countInteractionsOfKind($kind) + 'count' => $note->countInteractionsOfKind($kind), + 'disabled' => $actionsDisabled ]); } - call_template('reply_button', ['note' => $note, 'count' => $note->countReplies()]); + call_template('reply_button', [ + 'note' => $note, + 'count' => $note->countReplies(), + 'disabled' => $actionsDisabled + ]); ?> </div> + <?php call_template('reply_form', ['note' => $note]); ?> </div> </article>
\ No newline at end of file diff --git a/templates/reply_button.php b/templates/reply_button.php index 4162d23..b86a21f 100644 --- a/templates/reply_button.php +++ b/templates/reply_button.php @@ -6,6 +6,7 @@ $id = "interactButton-reply-$note->id"; ?> <div class="interactButtonContainer reply"> <button title="<?= __('note.action.reply') ?>" class="icon material-symbols-outlined reply" id="<?= $id ?>" + <?= ($disabled ?? false) ? 'disabled' : '' ?> _="on click send toggle to [me, next .noteReplyForm] on toggle toggle .active on closest <div/>"><?= $icon ?></button> <label for="<?= $id ?>"><?= $count ?? '' ?></label> </div>
\ No newline at end of file |
