Chore: Restructure Repository for SvelteKit

This commit is contained in:
Youwes09
2026-05-22 04:04:59 -05:00
parent bf071dcfc7
commit 8cef74bb98
266 changed files with 5093 additions and 396 deletions
+36
View File
@@ -0,0 +1,36 @@
export interface Toast {
id: string;
kind: "success" | "error" | "info" | "download";
title: string;
body?: string;
duration?: number;
}
export interface ActiveDownload {
chapterId: number;
mangaId: number;
progress: number;
}
class NotificationStore {
toasts: Toast[] = $state([]);
activeDownloads: ActiveDownload[] = $state([]);
addToast(toast: Omit<Toast, "id">) {
this.toasts = [...this.toasts, { ...toast, id: Math.random().toString(36).slice(2) }].slice(-5);
}
dismissToast(id: string) {
this.toasts = this.toasts.filter(x => x.id !== id);
}
setActiveDownloads(next: ActiveDownload[]) {
this.activeDownloads = next;
}
}
export const notifications = new NotificationStore();
export function addToast(toast: Omit<Toast, "id">) { notifications.addToast(toast); }
export function dismissToast(id: string) { notifications.dismissToast(id); }
export function setActiveDownloads(next: ActiveDownload[]) { notifications.setActiveDownloads(next); }