Consolidate frontend storage keys into constants module
- Move magic strings from AuthProvider, MainLayout, and ThemeProvider to frontend/src/utils/constants.ts - Add STORAGE_KEY_AUTHENTICATED, STORAGE_KEY_SIDEBAR_COLLAPSED, and STORAGE_KEY_THEME constants with JSDoc descriptions - Update all three files to import and use centralized keys - Prevents key drift and typo regressions across the frontend Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
*/
|
||||
import type { BanOriginFilter, TimeRange } from "../types/ban";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// UI Constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export const BAN_ORIGIN_FILTER_LABELS: Record<BanOriginFilter, string> = {
|
||||
all: "All",
|
||||
blocklist: "Blocklist",
|
||||
@@ -21,3 +25,16 @@ export const BAN_PAGE_SIZE = 100 as const;
|
||||
|
||||
/** Items per page for the history table. */
|
||||
export const HISTORY_PAGE_SIZE = 50 as const;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Storage Keys
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** SessionStorage key for authentication state persistence. */
|
||||
export const STORAGE_KEY_AUTHENTICATED = "bangui_authenticated" as const;
|
||||
|
||||
/** LocalStorage key for sidebar collapsed state. */
|
||||
export const STORAGE_KEY_SIDEBAR_COLLAPSED = "bangui_sidebar_collapsed" as const;
|
||||
|
||||
/** LocalStorage key for theme preference. */
|
||||
export const STORAGE_KEY_THEME = "bangui_theme" as const;
|
||||
|
||||
Reference in New Issue
Block a user