aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/note.php
diff options
context:
space:
mode:
Diffstat (limited to 'templates/note.php')
-rw-r--r--templates/note.php8
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]); ?>