aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/interaction_button.php
diff options
context:
space:
mode:
authorwinter2025-01-14 18:13:57 +0000
committerwinter2025-01-14 18:13:57 +0000
commit25b748f04911262826d0a0bc9609e03ee47c3232 (patch)
tree35dc82bd0cb1798913f726fb6bb74be97e5b83ba /templates/interaction_button.php
parent2082bfe9a378a90b33d4ab5c05dbb19a3457bef6 (diff)
add interaction counters
Diffstat (limited to 'templates/interaction_button.php')
-rw-r--r--templates/interaction_button.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/templates/interaction_button.php b/templates/interaction_button.php
index 9115435..edd1a25 100644
--- a/templates/interaction_button.php
+++ b/templates/interaction_button.php
@@ -10,6 +10,13 @@ $icon = match ($action) {
'dislike' => 'heart_broken',
'reshare' => $active ? 'repeat_on' : 'repeat'
};
+$id = "interactButton-$action-$note->id";
?>
-<button title="<?= $tooltip ?>" class="icon material-symbols-outlined <?= $action . ($active ? ' active' : '') ?>"
- hx-post="<?= "/fragment/note/$note->id/$action" ?>" hx-swap="outerHTML" hx-disabled-elt="this"><?= $icon ?></button> \ No newline at end of file
+<div class="interactButtonContainer <?= $action . ($active ? ' active' : '') ?>">
+ <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 ?>">
+ <?= $icon ?>
+ </button>
+ <label for="<?= $id ?>" class="interactionCount"><?= $count ?? '' ?></label>
+</div> \ No newline at end of file