Files
o11y/frontend/stubs/next-themes.ts
zeekayandGitHub b27d2eef7d fix(frontend): render-safe SPA — tsgo 0, kill next-themes blank-page crash, o11y-site from source (#14)
tsgo 707->0; alias next-themes/next/* to browser stubs (kills blank-page crash); resolve [[.BaseHref]]/[[.Settings]] at build time; Dockerfile.site builds from source; [email protected].4 pin. Render-proven (Playwright, all routes, 0 ReferenceError).
2026-07-03 16:21:48 -07:00

28 lines
922 B
TypeScript

// Browser stub for `next-themes`, eagerly imported by the @hanzo/ui barrel
// (`import { useTheme } from 'next-themes'`). o11y is not a Next app and drives
// its own theming (index.html boot script + hooks/useDarkMode), so this returns a
// stable dark default. A real browser cannot resolve the bare `next-themes`
// specifier, so it must resolve to this module (aliased in vite.config.ts) instead
// of being externalized — otherwise the SPA crashes at load with a blank page.
import type { ReactNode } from 'react';
export function useTheme(): {
theme: string;
setTheme: (t: string) => void;
resolvedTheme: string;
systemTheme: string;
themes: string[];
} {
return {
theme: 'dark',
setTheme: () => undefined,
resolvedTheme: 'dark',
systemTheme: 'dark',
themes: ['light', 'dark'],
};
}
export function ThemeProvider({ children }: { children?: ReactNode }): ReactNode {
return children ?? null;
}