fix: add missing GameThemeContext file for themed navigation

The GameThemeContext.tsx file was referenced in layout.tsx but wasn't properly committed. This context enables games to declare their theming that flows through the navigation chrome.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-09-28 12:00:09 -05:00
parent b82e9bb9d6
commit d4fbdd1463

View File

@@ -0,0 +1,33 @@
'use client'
import { createContext, useContext, useState, ReactNode } from 'react'
export interface GameTheme {
gameName: string
backgroundColor: string
}
interface GameThemeContextType {
theme: GameTheme | null
setTheme: (theme: GameTheme | null) => void
}
const GameThemeContext = createContext<GameThemeContextType | undefined>(undefined)
export function GameThemeProvider({ children }: { children: ReactNode }) {
const [theme, setTheme] = useState<GameTheme | null>(null)
return (
<GameThemeContext.Provider value={{ theme, setTheme }}>
{children}
</GameThemeContext.Provider>
)
}
export function useGameTheme() {
const context = useContext(GameThemeContext)
if (context === undefined) {
throw new Error('useGameTheme must be used within a GameThemeProvider')
}
return context
}