From 373e52dd796a9ef9754c8a914d7585f875f71115 Mon Sep 17 00:00:00 2001 From: Padreug Date: Wed, 17 Jun 2026 10:13:24 +0200 Subject: [PATCH] feat(events): show a live like count on the favorite heart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Display how many people have favorited (liked) an event next to its heart, updating in real time. A like == the event appearing in someone's NIP-51 bookmark list (kind 10003) — the same action the heart performs. New useEventLikes composable keeps ONE batched subscription over every mounted heart's event coordinate (filtered by #a). It stays open after EOSE, so a like published by anyone is pushed live and the count ticks up for everyone — verified end-to-end against a relay (a like from a fresh key bumped the shown count 2→3 with no reload). The heart also pops on a live increment (gated past the initial historical-load window), and the user's own like/un-like reflects instantly via the optimistic heart state. Caveat: an un-like by another user only reflects on next load — a replaceable list that no longer contains the coord stops matching the #a filter, so the removal isn't pushed. Counts are correct on fresh load. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../events/components/BookmarkButton.vue | 57 +++++++-- .../events/composables/useEventLikes.ts | 108 ++++++++++++++++++ 2 files changed, 154 insertions(+), 11 deletions(-) create mode 100644 src/modules/events/composables/useEventLikes.ts diff --git a/src/modules/events/components/BookmarkButton.vue b/src/modules/events/components/BookmarkButton.vue index 132fb48..a99d9c2 100644 --- a/src/modules/events/components/BookmarkButton.vue +++ b/src/modules/events/components/BookmarkButton.vue @@ -1,11 +1,12 @@