Files
BanGUI/frontend/src/utils/constants.ts
Lukas 252204ed97 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>
2026-04-28 09:48:28 +02:00

41 lines
1.3 KiB
TypeScript

/**
* Shared runtime constants used by the frontend UI.
*/
import type { BanOriginFilter, TimeRange } from "../types/ban";
// ---------------------------------------------------------------------------
// UI Constants
// ---------------------------------------------------------------------------
export const BAN_ORIGIN_FILTER_LABELS: Record<BanOriginFilter, string> = {
all: "All",
blocklist: "Blocklist",
selfblock: "Selfblock",
} as const;
export const TIME_RANGE_LABELS: Record<TimeRange, string> = {
"24h": "Last 24 h",
"7d": "Last 7 days",
"30d": "Last 30 days",
"365d": "Last 365 days",
} as const;
/** Items per page for the ban dashboard table. */
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;