39
apps/web/src/stores/ui.ts
Executable file
39
apps/web/src/stores/ui.ts
Executable file
@@ -0,0 +1,39 @@
|
||||
"use client";
|
||||
|
||||
import { create } from "zustand";
|
||||
|
||||
interface UiState {
|
||||
xpToast: { amount: number; message: string } | null;
|
||||
showXpToast: (amount: number, message: string) => void;
|
||||
clearXpToast: () => void;
|
||||
actionToast: {
|
||||
summary: string;
|
||||
actionEventId: string;
|
||||
} | null;
|
||||
showActionToast: (summary: string, actionEventId: string) => void;
|
||||
clearActionToast: () => void;
|
||||
bookCelebration: { title: string } | null;
|
||||
showBookCelebration: (title: string) => void;
|
||||
clearBookCelebration: () => void;
|
||||
welcomeBack: boolean;
|
||||
setWelcomeBack: (v: boolean) => void;
|
||||
aiOnline: boolean | null;
|
||||
setAiOnline: (v: boolean | null) => void;
|
||||
}
|
||||
|
||||
export const useUiStore = create<UiState>((set) => ({
|
||||
xpToast: null,
|
||||
showXpToast: (amount, message) => set({ xpToast: { amount, message } }),
|
||||
clearXpToast: () => set({ xpToast: null }),
|
||||
actionToast: null,
|
||||
showActionToast: (summary, actionEventId) =>
|
||||
set({ actionToast: { summary, actionEventId } }),
|
||||
clearActionToast: () => set({ actionToast: null }),
|
||||
bookCelebration: null,
|
||||
showBookCelebration: (title) => set({ bookCelebration: { title } }),
|
||||
clearBookCelebration: () => set({ bookCelebration: null }),
|
||||
welcomeBack: false,
|
||||
setWelcomeBack: (v) => set({ welcomeBack: v }),
|
||||
aiOnline: null,
|
||||
setAiOnline: (v) => set({ aiOnline: v }),
|
||||
}));
|
||||
Reference in New Issue
Block a user