Files
duty-teller/webapp-next/src/store/slices/session-slice.ts
Nikolay Tatarinov fa22976e75 feat: enhance Mini App design guidelines and refactor layout components
- Updated Mini App design guidelines to include detailed instructions on UI changes, accessibility rules, and verification processes.
- Refactored multiple components to utilize `MiniAppScreen` and `MiniAppScreenContent` for consistent layout structure across the application.
- Improved error handling in `GlobalError` and `NotFound` components by integrating new layout components for better user experience.
- Introduced new hooks for admin functionality, streamlining access checks and data loading processes.
- Enhanced documentation to reflect changes in design policies and component usage, ensuring clarity for future development.
2026-03-06 17:51:33 +03:00

22 lines
792 B
TypeScript

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<SessionSlice> | ((state: SessionSlice) => Partial<SessionSlice>)) => 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 }),
});