diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-12-23 21:07:58 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-12-23 21:07:58 +0100 |
commit | 65708d1fe888207beb2ff904be5be4c2a5d43dce (patch) | |
tree | 98ce918d81f3972967bd92b7de5e04b5ad688402 /src-vue/src/plugins | |
parent | 33834f4ccee5ffcc80302d5dd27a025660113d37 (diff) | |
download | FlightCore-65708d1fe888207beb2ff904be5be4c2a5d43dce.tar.gz FlightCore-65708d1fe888207beb2ff904be5be4c2a5d43dce.zip |
Restore more files from main branch
Diffstat (limited to 'src-vue/src/plugins')
-rw-r--r-- | src-vue/src/plugins/modules/notifications.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src-vue/src/plugins/modules/notifications.ts b/src-vue/src/plugins/modules/notifications.ts new file mode 100644 index 00000000..ed57f8af --- /dev/null +++ b/src-vue/src/plugins/modules/notifications.ts @@ -0,0 +1,31 @@ +type NotificationType = 'success' | 'warning' | 'info' | 'error'; + +export interface Notification { + title: string; + text: string; + type: NotificationType; +} + +interface NotificationsStoreState { + notifications: Notification[]; +} + + +/** + * This notification module is meant to host the list of notifications that have been fired while the application was + * not focused. + * This list is then used by the [NotificationButton] component to display notifications to user. + **/ +export const notificationsModule = { + state: () => ({ + notifications: [] + }) as NotificationsStoreState, + mutations: { + addNotification(state: NotificationsStoreState, payload: Notification) { + state.notifications.push(payload); + }, + removeNotification(state: NotificationsStoreState, index: number): void { + state.notifications.splice(index, 1); + } + } + } |