diff --git a/src/components/layout/app-shell.tsx b/src/components/layout/app-shell.tsx
index 2a50805..6f1414a 100644
--- a/src/components/layout/app-shell.tsx
+++ b/src/components/layout/app-shell.tsx
@@ -7,6 +7,7 @@ import { SideNav } from "@/components/layout/side-nav";
import { SidebarAccount } from "@/components/layout/sidebar-account";
import { Button } from "@/components/ui/button";
import { IconPanelLeft, IconX } from "@/components/ui/icons";
+import { Toaster } from "@/components/ui/toast";
import { useAuth } from "@/stores/auth-context";
import { usePreferences, useT } from "@/stores/preferences-context";
import { cn } from "@/lib/cn";
@@ -128,6 +129,7 @@ export function AppShell(props: ParentProps) {
setMobileOpen(true)} />
+
);
}
diff --git a/src/components/ui/toast.tsx b/src/components/ui/toast.tsx
new file mode 100644
index 0000000..a059e2e
--- /dev/null
+++ b/src/components/ui/toast.tsx
@@ -0,0 +1,49 @@
+import { For, createSignal } from "solid-js";
+import { Portal } from "solid-js/web";
+import { IconCheck, IconX } from "@/components/ui/icons";
+import { cn } from "@/lib/cn";
+
+type Toast = {
+ id: number;
+ title: string;
+};
+
+const [toasts, setToasts] = createSignal([]);
+let nextId = 1;
+
+export function showToast(props: { title: string }) {
+ const id = nextId++;
+ setToasts((items) => [...items, { id, title: props.title }].slice(-4));
+ window.setTimeout(() => dismissToast(id), 3000);
+}
+
+function dismissToast(id: number) {
+ setToasts((items) => items.filter((item) => item.id !== id));
+}
+
+export function Toaster() {
+ return (
+
+
+
+ {(toast) => (
+
+
+
+
+
{toast.title}
+
+
+ )}
+
+
+
+ );
+}
diff --git a/src/lib/flash.ts b/src/lib/flash.ts
index 5e84486..922eaaf 100644
--- a/src/lib/flash.ts
+++ b/src/lib/flash.ts
@@ -1,18 +1,11 @@
-import { createEffect, createSignal, onCleanup, type Accessor } from "solid-js";
+import { createSignal, type Accessor } from "solid-js";
+import { showToast } from "@/components/ui/toast";
-/** Short-lived success banner; auto-clears after `ms` (default 3s). */
-export function createFlash(ms = 3000): [Accessor, (text: string) => void] {
+/** Short-lived success feedback; page banners stay empty, global toast renders it. */
+export function createFlash(_ms = 3000): [Accessor, (text: string) => void] {
const [message, setMessage] = createSignal("");
- const [tick, setTick] = createSignal(0);
- createEffect(() => {
- tick();
- const text = message();
- if (!text) return;
- const id = window.setTimeout(() => setMessage(""), ms);
- onCleanup(() => window.clearTimeout(id));
- });
return [message, (text) => {
- setMessage(text);
- setTick((value) => value + 1);
+ setMessage("");
+ showToast({ title: text });
}];
}