Files
gridline/desktop/src/stores/notificationStore.ts
T
adrianbonpin 6854d889c5 refactor: convert to bun-workspaces monorepo (desktop/ + www/)
- Move the Tauri app (React frontend + Rust backend) into desktop/ via
  git mv — configs unchanged (relative paths: tauri.conf.json, vite.config.ts)
- Root package.json becomes a private bun workspace container with
  orchestration scripts; desktop package renamed gridline-desktop
- Scaffold www/ with Astro 7 + Tailwind v4 (hand-wired vite plugin,
  static output, ready for Dokploy)
- Update release.yml for the new layout: projectPath: desktop,
  desktop/src-tauri resource paths, rust-cache workspace path
- Update README + AGENTS.md structure trees and dev commands
- Verified: vitest (1074), cargo test (354), desktop build, tauri dev
  (window launches), tauri build (dmg + app bundles), Astro build
2026-08-16 19:31:53 +08:00

27 lines
803 B
TypeScript

import { create } from "zustand";
export interface Notification {
id: string;
message: string;
type: "success" | "error" | "info";
}
interface NotificationState {
notifications: Notification[];
notify: (message: string, type?: Notification["type"]) => void;
dismiss: (id: string) => void;
}
let counter = 0;
export const useNotificationStore = create<NotificationState>((set) => ({
notifications: [],
notify: (message, type = "info") => {
const id = `notif-${++counter}`;
set((s) => ({ notifications: [...s.notifications, { id, message, type }] }));
setTimeout(() => {
set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) }));
}, 4000);
},
dismiss: (id) => set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),
}));