export interface SessionSlice { lang: "ru" | "en"; /** True when the first visible screen has finished loading; used to hide content until ready(). */ appContentReady: boolean; /** True when GET /api/admin/me returned is_admin: true; used to show Admin link. */ isAdmin: boolean; setLang: (v: "ru" | "en") => void; setAppContentReady: (v: boolean) => void; setIsAdmin: (v: boolean) => void; } type SessionSet = (updater: Partial | ((state: SessionSlice) => Partial)) => void; export const createSessionSlice = (set: SessionSet): SessionSlice => ({ lang: "en", appContentReady: false, isAdmin: false, setLang: (v) => set({ lang: v }), setAppContentReady: (v) => set({ appContentReady: v }), setIsAdmin: (v) => set({ isAdmin: v }), });