feat: 1-to-1 message render + web data-lake backend

This commit is contained in:
hh committed 2026-05-31 01:45:05 +02:00
1 parent f0afb7ec5b
commit 75425d1bee
110 files changed
+10199 -54

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
type ToastType = "info" | "error" | "success";
interface Toast {
id: number;
message: string;
type: ToastType;
}
const DEFAULT_TIMEOUT = 4000;
function createToasts() {
let items = $state<Toast[]>([]);
let nextId = 0;
function dismiss(id: number) {
items = items.filter((toast) => toast.id !== id);
}
function show(
message: string,
type: ToastType = "info",
timeout = DEFAULT_TIMEOUT
) {
const id = nextId++;
items = [...items, { id, type, message }];
if (timeout > 0) {
setTimeout(() => dismiss(id), timeout);
}
return id;
}
return {
get items() {
return items;
},
show,
error(message: string) {
return show(message, "error");
},
success(message: string) {
return show(message, "success");
},
dismiss,
};
}
export const toasts = createToasts();