diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 74cf8e510..9874c7363 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -1,4 +1,5 @@
-
+
+
+ Add
diff --git a/frontend/src/components/Notification.vue b/frontend/src/components/Notification.vue
index f0da3dbc1..c3f5746c3 100644
--- a/frontend/src/components/Notification.vue
+++ b/frontend/src/components/Notification.vue
@@ -1,29 +1,36 @@
[
+const themeOptions = computed(() => [
{
name: "dark",
icon: "mdi-moon-waning-crescent",
@@ -45,7 +45,13 @@ function toggleTheme() {
@update:model-value="toggleTheme"
>
-
+
+import Notification from "@/components/Notification.vue";
+import storeNotifications from "@/stores/notifications";
+import type { SnackbarStatus } from "@/types/emitter";
+import type { Emitter } from "mitt";
+import { storeToRefs } from "pinia";
+import type { Events } from "@/types/emitter";
+import { inject } from "vue";
+const notificationStore = storeNotifications();
+const { notifications } = storeToRefs(notificationStore);
+const emitter = inject>("emitter");
+emitter?.on("snackbarShow", (snackbar: SnackbarStatus) => {
+ snackbar.id = notificationStore.notifications.length + 1;
+ notificationStore.add(snackbar);
+});
+
+
+
+
+
diff --git a/frontend/src/stores/notifications.ts b/frontend/src/stores/notifications.ts
new file mode 100644
index 000000000..ed8722f22
--- /dev/null
+++ b/frontend/src/stores/notifications.ts
@@ -0,0 +1,22 @@
+import type { SnackbarStatus } from "@/types/emitter";
+import { defineStore } from "pinia";
+
+export default defineStore("notifications", {
+ state: () => ({
+ notifications: [] as SnackbarStatus[],
+ }),
+
+ actions: {
+ add(notification: SnackbarStatus) {
+ this.notifications.push(notification);
+ },
+ remove(id: number | undefined) {
+ this.notifications = this.notifications.filter(
+ (notification) => notification.id !== id
+ );
+ },
+ clear() {
+ this.notifications = [] as SnackbarStatus[];
+ },
+ },
+});
diff --git a/frontend/src/types/emitter.d.ts b/frontend/src/types/emitter.d.ts
index 0c049aca2..d8412b2cb 100644
--- a/frontend/src/types/emitter.d.ts
+++ b/frontend/src/types/emitter.d.ts
@@ -2,6 +2,7 @@ import type { SaveSchema, SearchRomSchema, StateSchema } from "@/__generated__";
import type { Platform } from "@/stores/platforms";
import type { SimpleRom } from "@/stores/roms";
import type { User } from "@/stores/users";
+import type internal from "stream";
export type UserItem = User & {
password: string;
@@ -9,6 +10,7 @@ export type UserItem = User & {
};
export type SnackbarStatus = {
+ id?: number;
msg: string;
timeout?: number;
icon?: string;