feat(notifications): added notification system w/ interwoven refactoring

This commit is contained in:
DecDuck
2024-11-16 19:41:19 +11:00
parent 62ea9a116b
commit 6e6f09dba0
22 changed files with 498 additions and 56 deletions

View File

@ -0,0 +1,12 @@
import type { Notification } from "@prisma/client";
const ws = new WebSocketHandler("/api/v1/notifications/ws");
export const useNotifications = () =>
useState<Array<Notification>>("notifications", () => []);
ws.listen((e) => {
const notification = JSON.parse(e) as Notification;
const notifications = useNotifications();
notifications.value.push(notification);
});

View File

@ -8,6 +8,6 @@ export type NavigationItem = {
export type QuickActionNav = {
icon: Component,
notifications?: number,
notifications?: Ref<number>,
action: () => Promise<void>,
}