HotkeySettings.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Card } from 'ui'
  2. import {
  3. PageSection,
  4. PageSectionContent,
  5. PageSectionDescription,
  6. PageSectionMeta,
  7. PageSectionSummary,
  8. PageSectionTitle,
  9. } from 'ui-patterns/PageSection'
  10. import { HotkeyToggle } from './HotkeyToggle'
  11. import { SHORTCUT_DEFINITIONS } from '@/state/shortcuts/registry'
  12. const SHORTCUT_ORDER = Object.values(SHORTCUT_DEFINITIONS).filter(
  13. (definition) => definition.showInSettings !== false
  14. )
  15. export const HotkeySettings = () => {
  16. return (
  17. <PageSection>
  18. <PageSectionMeta>
  19. <PageSectionSummary>
  20. <PageSectionTitle id="keyboard-shortcuts">Keyboard shortcuts</PageSectionTitle>
  21. <PageSectionDescription>
  22. Choose which shortcuts stay active while working in the dashboard.
  23. </PageSectionDescription>
  24. </PageSectionSummary>
  25. </PageSectionMeta>
  26. <PageSectionContent>
  27. <Card>
  28. {SHORTCUT_ORDER.map((definition, index) => (
  29. <HotkeyToggle
  30. key={definition.id}
  31. definition={definition}
  32. isLast={index === SHORTCUT_ORDER.length - 1}
  33. />
  34. ))}
  35. </Card>
  36. </PageSectionContent>
  37. </PageSection>
  38. )
  39. }