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:
parent
aee5f21ecc
commit
cdc94514d9
|
|
@ -1052,12 +1052,22 @@ export function MapRenderer({
|
||||||
}
|
}
|
||||||
}, [giveUpReveal?.timestamp]) // Re-run when timestamp changes
|
}, [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(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (e: KeyboardEvent) => {
|
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) {
|
if (e.key === 'Shift' && !e.repeat) {
|
||||||
setShiftPressed(true)
|
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) => {
|
const handleKeyUp = (e: KeyboardEvent) => {
|
||||||
|
|
@ -1073,7 +1083,7 @@ export function MapRenderer({
|
||||||
window.removeEventListener('keydown', handleKeyDown)
|
window.removeEventListener('keydown', handleKeyDown)
|
||||||
window.removeEventListener('keyup', handleKeyUp)
|
window.removeEventListener('keyup', handleKeyUp)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [hasHint])
|
||||||
|
|
||||||
const [labelPositions, setLabelPositions] = useState<RegionLabelPosition[]>([])
|
const [labelPositions, setLabelPositions] = useState<RegionLabelPosition[]>([])
|
||||||
const [smallRegionLabelPositions, setSmallRegionLabelPositions] = useState<
|
const [smallRegionLabelPositions, setSmallRegionLabelPositions] = useState<
|
||||||
|
|
@ -4120,7 +4130,7 @@ export function MapRenderer({
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
💡 Hint
|
💡 Hint (H)
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* Speech bubble for hint */}
|
{/* Speech bubble for hint */}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue