From 57802c2ea0d51b044c36f83210b27c293fc30ad9 Mon Sep 17 00:00:00 2001 From: mdatelle Date: Fri, 4 Oct 2024 17:22:13 -0400 Subject: [PATCH] feat(web): wip query api for notifications --- web/components/Notifications/Item.vue | 18 ++-- web/components/Notifications/Sidebar.vue | 100 +++++++++-------------- web/store/notifications.ts | 14 ++-- web/types/ui/notification.ts | 11 +-- 4 files changed, 63 insertions(+), 80 deletions(-) diff --git a/web/components/Notifications/Item.vue b/web/components/Notifications/Item.vue index 6f7a33a7f..f3b860f01 100644 --- a/web/components/Notifications/Item.vue +++ b/web/components/Notifications/Item.vue @@ -1,8 +1,6 @@ @@ -99,7 +79,7 @@ const { teleportTarget, determineTeleportTarget } = useTeleport(); diff --git a/web/store/notifications.ts b/web/store/notifications.ts index 2fbeda90b..0cceeecc0 100644 --- a/web/store/notifications.ts +++ b/web/store/notifications.ts @@ -1,24 +1,28 @@ import { defineStore, createPinia, setActivePinia } from 'pinia'; -/** - * @see https://stackoverflow.com/questions/73476371/using-pinia-with-vue-js-web-components - * @see https://github.com/vuejs/pinia/discussions/1085 - */ +import type { NotificationItemProps } from "~/types/ui/notification"; + setActivePinia(createPinia()); export const useNotificationsStore = defineStore('notifications', () => { - + const notifications = ref([]); const isOpen = ref(false); const title = computed(() => isOpen.value ? 'Notifications Are Open' : 'Notifications Are Closed'); const toggle = () => isOpen.value = !isOpen.value; + const setNotifications = (newNotifications: NotificationItemProps[]) => { + notifications.value = newNotifications; + }; + return { // state isOpen, // getters title, + notifications, // actions + setNotifications, toggle, }; }); diff --git a/web/types/ui/notification.ts b/web/types/ui/notification.ts index 546193ed2..1f163a402 100644 --- a/web/types/ui/notification.ts +++ b/web/types/ui/notification.ts @@ -1,9 +1,10 @@ export interface NotificationItemProps { id: string; - event: string; - date: string; + title: string; subject: string; - message: string; + description: string; + importance: string; + link: string; type: 'success' | 'warning' | 'alert'; - view: string; -} \ No newline at end of file + timestamp: string; +}