blob: 368cb1a1a769df456a3974b422c6c8d1c9cba44f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<?php
$active = $active ?? false;
$tooltip = match ($action) {
'like' => __('note.action.like'),
'dislike' => __('note.action.dislike'),
'reshare' => __('note.action.reshare')
};
$icon = match ($action) {
'like' => $active ? 'favorite' : 'favorite-outline',
'dislike' => $active ? 'heart-broken' : 'heart-broken-outline',
'reshare' => $active ? 'repeat-on' : 'repeat'
};
$id = "interactButton-$action-$note->id";
?>
<div class="interactButtonContainer <?= $action . ($active ? ' active' : '') ?>">
<button title="<?= $tooltip ?>" class="material-symbols <?= $icon ?>"
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" <?= ($disabled ?? false) ? 'disabled' : '' ?>>
</button>
<label for="<?= $id ?>" class="interactionCount"><?= $count ?? '' ?></label>
</div>
|