Skip to content

Commit

Permalink
feat: Enable space as hotkey for start/stop-button
Browse files Browse the repository at this point in the history
Co-authored-by: Sivert Schou Olsen <sivertschou@hotmail.com>
  • Loading branch information
morteako and sivertschou committed Jan 5, 2025
1 parent 766c48c commit abdd799
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/frontend/src/components/MainActionBar/StartButton.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Button
Expand Down

0 comments on commit abdd799

Please sign in to comment.