diff --git a/web/src/lib/components/shared-components/notification/notification-card.svelte b/web/src/lib/components/shared-components/notification/notification-card.svelte new file mode 100644 index 0000000000..5e4efba38a --- /dev/null +++ b/web/src/lib/components/shared-components/notification/notification-card.svelte @@ -0,0 +1,70 @@ + + +
+
+ +

{notificationInfo.type.toString()}

+
+ +

{notificationInfo.message} {notificationInfo.id}

+
diff --git a/web/src/lib/components/shared-components/notification/notification-list.svelte b/web/src/lib/components/shared-components/notification/notification-list.svelte new file mode 100644 index 0000000000..6abc478efe --- /dev/null +++ b/web/src/lib/components/shared-components/notification/notification-list.svelte @@ -0,0 +1,22 @@ + + +{#if $notificationList?.length > 0} +
+ {#each $notificationList as notificationInfo (notificationInfo.id)} +
+ +
+ {/each} +
+{/if} diff --git a/web/src/lib/components/shared-components/notification/notification.ts b/web/src/lib/components/shared-components/notification/notification.ts new file mode 100644 index 0000000000..dba110ac4a --- /dev/null +++ b/web/src/lib/components/shared-components/notification/notification.ts @@ -0,0 +1,36 @@ +import { writable } from 'svelte/store'; + +export enum NotificationType { + Info = 'Info', + Error = 'Error' +} + +export class ImmichNotification { + id = new Date().getTime(); + type!: NotificationType; + message!: string; +} + +function createNotificationList() { + const { set, update, subscribe } = writable([]); + + const show = ({ message = '', type = NotificationType.Info }) => { + const notification = new ImmichNotification(); + notification.message = message; + notification.type = type; + + update((currentList) => [...currentList, notification]); + }; + + const removeNotificationById = (id: number) => { + update((currentList) => currentList.filter((n) => n.id != id)); + }; + + return { + show, + removeNotificationById, + subscribe + }; +} + +export const notificationList = createNotificationList(); diff --git a/web/src/lib/components/shared-components/side-bar/side-bar.svelte b/web/src/lib/components/shared-components/side-bar/side-bar.svelte index 3760bf0f56..690772af95 100644 --- a/web/src/lib/components/shared-components/side-bar/side-bar.svelte +++ b/web/src/lib/components/shared-components/side-bar/side-bar.svelte @@ -1,5 +1,4 @@