- 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>
41 lines
1.3 KiB
TypeScript
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;
|