MCPcopy Create free account
hub / github.com/code100x/daily-code / handleKeyPress

Function handleKeyPress

apps/web/components/BlogAppbar.tsx:274–284  ·  view source on GitHub ↗
(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

272
273 useEffect(() => {
274 const handleKeyPress = (event: KeyboardEvent) => {
275 if (event.key === "ArrowRight") {
276 router.push(
277 problemIndex + 1 === track.problems.length
278 ? ``
279 : `/tracks/${track.id}/${track.problems[problemIndex + 1]?.id}`
280 );
281 } else if (event.key === "ArrowLeft") {
282 router.push(problemIndex !== 0 ? `/tracks/${track.id}/${track.problems[problemIndex - 1]?.id}` : ``);
283 }
284 };
285
286 window.addEventListener("keydown", handleKeyPress);
287 return () => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected