From abdd79945c0d2f2662916ef2de96db07b86f5dd0 Mon Sep 17 00:00:00 2001 From: Morten Kolstad Date: Sat, 4 Jan 2025 19:27:46 +0100 Subject: [PATCH] feat: Enable space as hotkey for start/stop-button Co-authored-by: Sivert Schou Olsen --- apps/frontend/src/components/MainActionBar/StartButton.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/frontend/src/components/MainActionBar/StartButton.tsx b/apps/frontend/src/components/MainActionBar/StartButton.tsx index 61cd761d..8bae46f1 100644 --- a/apps/frontend/src/components/MainActionBar/StartButton.tsx +++ b/apps/frontend/src/components/MainActionBar/StartButton.tsx @@ -1,9 +1,14 @@ import { Button, Icon } from '@chakra-ui/react'; import { PauseFill, PlayFill } from 'react-bootstrap-icons'; import { useData } from '../../context/DataContext'; +import * as React from 'react'; +import { useHotkey } from '../../hooks/useHotkey'; export const StartButton = () => { const { hasValidData, isRunning, start, stop } = useData(); + + useHotkey('Space', () => (isRunning ? stop() : start())); + if (isRunning) return (