feat: sync URL with selected game mode

Add Next.js router integration to update URL when user selects
a game mode in GameControls. Now when selecting:
- Practice Mode → URL becomes /games/complement-race/practice
- Steam Sprint → URL becomes /games/complement-race/sprint
- Survival Mode → URL becomes /games/complement-race/survival

This makes URLs shareable at any point in the setup flow.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-09-30 15:02:05 -05:00
parent 80e33e25b3
commit 3920bbad33

View File

@@ -1,10 +1,12 @@
'use client'
import { useRouter } from 'next/navigation'
import { useComplementRace } from '../context/ComplementRaceContext'
import type { GameMode, GameStyle, TimeoutSetting } from '../lib/gameTypes'
export function GameControls() {
const { state, dispatch } = useComplementRace()
const router = useRouter()
const handleModeSelect = (mode: GameMode) => {
dispatch({ type: 'SET_MODE', mode })
@@ -12,6 +14,8 @@ export function GameControls() {
const handleStyleSelect = (style: GameStyle) => {
dispatch({ type: 'SET_STYLE', style })
// Update URL to match selected game style
router.push(`/games/complement-race/${style}`)
}
const handleTimeoutSelect = (timeout: TimeoutSetting) => {