Skip to content

Commit 4885e5d

Browse files
committed
Add arrowleft/right hotkeys; remove mousetrap
1 parent 7654d2c commit 4885e5d

File tree

4 files changed

+10
-34
lines changed

4 files changed

+10
-34
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"isomorphic-fetch": "3.0.0",
2828
"ky": "^1.2.4",
2929
"ky-universal": "^0.12.0",
30-
"mousetrap": "1.6.5",
3130
"next": "15.2.4",
3231
"next-redux-wrapper": "8.1.0",
3332
"nextjs-toploader": "^3.7.15",

pnpm-lock.yaml

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/Providers.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,21 @@ export default function Providers({ children }: PropsWithChildren) {
2121
);
2222

2323
useEffect(() => {
24-
const playpause = (e: KeyboardEvent) => {
24+
const onKeyDown = (e: KeyboardEvent) => {
25+
console.log(e.code);
2526
if (e.code === 'Space') {
2627
player.togglePlayPause();
2728
}
29+
if (e.code === 'ArrowRight') {
30+
player.playNext();
31+
}
32+
if (e.code === 'ArrowLeft') {
33+
player.playPrevious();
34+
}
2835
};
29-
document.addEventListener('keydown', playpause);
36+
document.addEventListener('keydown', onKeyDown);
3037

31-
return () => document.removeEventListener('keydown', playpause);
38+
return () => document.removeEventListener('keydown', onKeyDown);
3239
}, []);
3340

3441
return (

src/lib/hotkeys.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)