Download src/components/theme/ThemeLayoutWrapper.tsx from asnannp/DocDoeAI: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/asnannp/DocDoeAI/resolve/main/src/components/theme/ThemeLayoutWrapper.tsx
- Command line
-
hf download hf://spaces/asnannp/DocDoeAI/src/components/theme/ThemeLayoutWrapper.tsx
-
curl -L -o ThemeLayoutWrapper.tsx https://huggingface.co/spaces/asnannp/DocDoeAI/resolve/main/src/components/theme/ThemeLayoutWrapper.tsx
1.18 kB
| "use client"; | |
| import { useTheme } from "next-themes"; | |
| import { usePathname } from "next/navigation"; | |
| import { useHydrated } from "@/hooks/useHydrated"; | |
| import { AppShellDark } from "@/components/dark/layout/AppShellDark"; | |
| import { CleanAppLayout } from "@/components/clean/layout/CleanAppLayout"; | |
| export function ThemeLayoutWrapper({ children }: { children: React.ReactNode }) { | |
| const { resolvedTheme } = useTheme(); | |
| const mounted = useHydrated(); | |
| const pathname = usePathname(); | |
| const isTuitionWorkspace = pathname === "/tuition" || pathname?.startsWith("/tuition/"); | |
| // Tuition is intentionally light-only so the class never changes visual | |
| // systems when the student's device theme changes. | |
| if (isTuitionWorkspace) { | |
| return <CleanAppLayout>{children}</CleanAppLayout>; | |
| } | |
| // During SSR and initial hydration, default to AppShellDark to prevent flash if dark was default, | |
| // or return a simpler loading skeleton if you prefer. | |
| if (!mounted) { | |
| return <AppShellDark>{children}</AppShellDark>; | |
| } | |
| if (resolvedTheme === "light") { | |
| return <CleanAppLayout>{children}</CleanAppLayout>; | |
| } | |
| return <AppShellDark>{children}</AppShellDark>; | |
| } | |