diff options
| author | winter | 2025-01-14 18:13:57 +0000 |
|---|---|---|
| committer | winter | 2025-01-14 18:13:57 +0000 |
| commit | 25b748f04911262826d0a0bc9609e03ee47c3232 (patch) | |
| tree | 35dc82bd0cb1798913f726fb6bb74be97e5b83ba /templates/note.php | |
| parent | 2082bfe9a378a90b33d4ab5c05dbb19a3457bef6 (diff) | |
add interaction counters
Diffstat (limited to 'templates/note.php')
| -rw-r--r-- | templates/note.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/templates/note.php b/templates/note.php index 1fb03a9..0a19475 100644 --- a/templates/note.php +++ b/templates/note.php @@ -9,7 +9,7 @@ if ($user != null) { $interKinds = array_map(fn($inter) => $inter->kind, $interactions); } ?> -<article class="note <?= $selected ? 'selected' : '' ?>"> +<article class="note <?= ($selected ?? false) ? 'selected' : '' ?>"> <a href="/@/<?= $note->author->getFullHandle() ?>"> <?php call_template('actor_avatar', ['actor' => $note->author]); ?> </a> @@ -41,13 +41,15 @@ if ($user != null) { </div> <div class="buttons"> <?php foreach (['like', 'dislike', 'reshare'] as $action) { + $kind = InteractionKind::from($action); call_template('interaction_button', [ 'action' => $action, 'note' => $note, - 'active' => in_array(InteractionKind::from($action), $interKinds) + 'active' => in_array($kind, $interKinds), + 'count' => $note->countInteractionsOfKind($kind) ]); } - call_template('reply_button', ['note' => $note]); + call_template('reply_button', ['note' => $note, 'count' => $note->countReplies()]); ?> </div> <?php call_template('reply_form', ['note' => $note]); ?> |
