feat(know-your-world): add 'H' keyboard shortcut for hint

- Press 'H' to toggle the hint bubble (similar to 'G' for give up)
- Only works when a hint is available for the current region
- Doesn't trigger when typing in input fields
- Updated button label to show "(H)" keyboard shortcut

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-11-26 14:59:36 -06:00
parent aee5f21ecc
commit cdc94514d9
1 changed files with 13 additions and 3 deletions

View File

@ -1052,12 +1052,22 @@ export function MapRenderer({
}
}, [giveUpReveal?.timestamp]) // Re-run when timestamp changes
// Shift key listener - show magnifier when Shift is held
// Keyboard shortcuts - Shift for magnifier, H for hint
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
// Don't trigger shortcuts if user is typing in an input
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
return
}
if (e.key === 'Shift' && !e.repeat) {
setShiftPressed(true)
}
// 'H' key to toggle hint bubble
if ((e.key === 'h' || e.key === 'H') && !e.repeat && hasHint) {
setShowHintBubble((prev) => !prev)
}
}
const handleKeyUp = (e: KeyboardEvent) => {
@ -1073,7 +1083,7 @@ export function MapRenderer({
window.removeEventListener('keydown', handleKeyDown)
window.removeEventListener('keyup', handleKeyUp)
}
}, [])
}, [hasHint])
const [labelPositions, setLabelPositions] = useState<RegionLabelPosition[]>([])
const [smallRegionLabelPositions, setSmallRegionLabelPositions] = useState<
@ -4120,7 +4130,7 @@ export function MapRenderer({
},
})}
>
💡 Hint
💡 Hint (H)
</button>
{/* Speech bubble for hint */}