mirror of
https://github.com/Dvorinka/Dash.git
synced 2026-06-03 15:02:56 +00:00
17a579880f
Relocate frontend source code from `next-app/` to `frontend/` to align with the new project structure. This includes removing the old Next.js boilerplate files and establishing a cleaner workspace. Additionally, updates the OpenAPI specification to include support for the `immich` widget type and its corresponding configuration schema. - Move frontend files to `frontend/` - Delete obsolete `next-app/` directory and its configuration - Add `immich` widget type to `openapi.yaml` - Update `FrontendPlan.md` with dashboard refactor and UX direction
27 lines
739 B
TypeScript
27 lines
739 B
TypeScript
export type Theme = "light" | "dark" | "casaos";
|
|
|
|
const STORAGE_KEY = "dash-theme";
|
|
|
|
export function getStoredTheme(): Theme {
|
|
if (typeof window === "undefined") return "dark";
|
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
if (stored === "light" || stored === "dark" || stored === "casaos") return stored;
|
|
return "dark";
|
|
}
|
|
|
|
export function setStoredTheme(theme: Theme) {
|
|
if (typeof window === "undefined") return;
|
|
localStorage.setItem(STORAGE_KEY, theme);
|
|
}
|
|
|
|
export function applyTheme(theme: Theme) {
|
|
if (typeof document === "undefined") return;
|
|
document.documentElement.setAttribute("data-theme", theme);
|
|
}
|
|
|
|
export const themeLabels: Record<Theme, string> = {
|
|
light: "Light",
|
|
dark: "Dark",
|
|
casaos: "CasaOS",
|
|
};
|