fix(room): update GAME_TYPE_TO_NAME mapping for memory-quiz
The GAMES_CONFIG was changed from 'memory-lightning' to 'memory-quiz' but the GAME_TYPE_TO_NAME mapping in room/page.tsx still used the old key. This caused the handleGameSelect function to fail silently when users clicked on Memory Lightning in the "Change Game" screen, as it couldn't find the mapping for 'memory-quiz'. Also added debug logging to GameCard component to help diagnose issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -68,7 +68,8 @@
|
||||
"Bash(python3:*)",
|
||||
"Bash(git reset:*)",
|
||||
"Bash(lsof:*)",
|
||||
"Bash(killall:*)"
|
||||
"Bash(killall:*)",
|
||||
"Bash(echo:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
@@ -14,7 +14,7 @@ import { css } from '../../../../styled-system/css'
|
||||
// Map GameType keys to internal game names
|
||||
const GAME_TYPE_TO_NAME: Record<GameType, string> = {
|
||||
'battle-arena': 'matching',
|
||||
'memory-lightning': 'memory-quiz',
|
||||
'memory-quiz': 'memory-quiz',
|
||||
'complement-race': 'complement-race',
|
||||
'master-organizer': 'master-organizer',
|
||||
}
|
||||
|
||||
@@ -23,10 +23,23 @@ export function GameCard({ gameType, config, variant = 'detailed', className }:
|
||||
}
|
||||
|
||||
const handleGameClick = () => {
|
||||
console.log(`[GameCard] Clicked on ${config.name}:`, {
|
||||
activePlayerCount,
|
||||
maxPlayers: config.maxPlayers,
|
||||
isGameAvailable: isGameAvailable(),
|
||||
configAvailable: config.available,
|
||||
willNavigate: isGameAvailable() && config.available !== false,
|
||||
url: config.url,
|
||||
})
|
||||
|
||||
if (isGameAvailable() && config.available !== false) {
|
||||
console.log('🔄 GameCard: Navigating with Next.js router (no page reload)')
|
||||
// Use Next.js router for client-side navigation - this preserves fullscreen!
|
||||
router.push(config.url)
|
||||
} else {
|
||||
console.warn('❌ GameCard: Navigation blocked', {
|
||||
reason: !isGameAvailable() ? 'Player count mismatch' : 'Game not available',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user