feat: add initialStyle prop to ComplementRaceProvider
- Add ComplementRaceProviderProps interface with optional initialStyle
- Accept initialStyle param ('practice' | 'sprint' | 'survival')
- Initialize game state with provided style or default to 'practice'
- Enables URL-based routing for different game modes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8c3a855239
commit
f3bc2f6d92
|
|
@ -403,8 +403,16 @@ interface ComplementRaceContextType {
|
|||
|
||||
const ComplementRaceContext = createContext<ComplementRaceContextType | undefined>(undefined)
|
||||
|
||||
export function ComplementRaceProvider({ children }: { children: ReactNode }) {
|
||||
const [state, dispatch] = useReducer(gameReducer, initialState)
|
||||
interface ComplementRaceProviderProps {
|
||||
children: ReactNode
|
||||
initialStyle?: 'practice' | 'sprint' | 'survival'
|
||||
}
|
||||
|
||||
export function ComplementRaceProvider({ children, initialStyle }: ComplementRaceProviderProps) {
|
||||
const [state, dispatch] = useReducer(gameReducer, {
|
||||
...initialState,
|
||||
style: initialStyle || initialState.style
|
||||
})
|
||||
|
||||
return (
|
||||
<ComplementRaceContext.Provider value={{ state, dispatch }}>
|
||||
|
|
|
|||
Loading…
Reference in New Issue