From b3bb759ba8502da45f972407ae2d574244d7eb10 Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Sat, 6 Jul 2024 12:42:24 +0300 Subject: [PATCH] Event updates - deduplicate events (for some reason contract event subscription callbacks are firing more than once - order events by timestamp - prettify event names - give each event a unique id so they can be deleted one-by-one --- src/components/NotificationCentre.vue | 26 ++++++++++------ src/stores/events.js | 44 +++++++++++++++++++-------- src/utils/events.js | 13 ++++---- 3 files changed, 56 insertions(+), 27 deletions(-) diff --git a/src/components/NotificationCentre.vue b/src/components/NotificationCentre.vue index d89a2da..40b3bd8 100644 --- a/src/components/NotificationCentre.vue +++ b/src/components/NotificationCentre.vue @@ -45,6 +45,11 @@ const buttonClass = computed(() => { hover: showNotifCentre.value } }) +const eventsOrdered = computed(() => { + return Object.entries(events.value).sort(([eventIdA, eventA], [eventIdB, eventB]) => { + return eventB.timestamp - eventA.timestamp + }) +})