diff --git a/apps/web/src/components/AppNavBar.tsx b/apps/web/src/components/AppNavBar.tsx index 2d6593da..0d7cade2 100644 --- a/apps/web/src/components/AppNavBar.tsx +++ b/apps/web/src/components/AppNavBar.tsx @@ -18,11 +18,12 @@ export function AppNavBar({ variant = 'full' }: AppNavBarProps) { const isGamePage = pathname?.startsWith('/games') const isArcadePage = pathname?.startsWith('/arcade') const { isFullscreen, toggleFullscreen, exitFullscreen } = useFullscreen() - const { theme: gameTheme } = useGameTheme() + const { theme: gameTheme, isHydrated } = useGameTheme() // Helper function to get themed background colors const getThemedBackground = (opacity: number = 0.85) => { - if (gameTheme?.backgroundColor) { + // Only apply theming after hydration to prevent SSR/client mismatch + if (isHydrated && gameTheme?.backgroundColor) { const color = gameTheme.backgroundColor if (color.startsWith('#')) { // Convert hex to rgba @@ -103,7 +104,7 @@ export function AppNavBar({ variant = 'full' }: AppNavBarProps) { backgroundClip: 'text', color: 'transparent' })}> - 🕹️ {gameTheme?.gameName || (isArcadePage ? 'Arcade' : 'Game')} + 🕹️ {(isHydrated && gameTheme?.gameName) || (isArcadePage ? 'Arcade' : 'Game')}
void + isHydrated: boolean } const GameThemeContext = createContext(undefined) export function GameThemeProvider({ children }: { children: ReactNode }) { const [theme, setTheme] = useState(null) + const [isHydrated, setIsHydrated] = useState(false) + + useEffect(() => { + setIsHydrated(true) + }, []) return ( - + {children} )