StudioCommandProvider.tsx 741 B

123456789101112131415161718192021
  1. import type { PropsWithChildren } from 'react'
  2. import { CommandProvider } from 'ui-patterns/CommandMenu'
  3. import { useStudioCommandMenuTelemetry } from '@/hooks/misc/useStudioCommandMenuTelemetry'
  4. import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
  5. import { useIsShortcutEnabled } from '@/state/shortcuts/useIsShortcutEnabled'
  6. export function StudioCommandProvider({ children }: PropsWithChildren) {
  7. const { onTelemetry } = useStudioCommandMenuTelemetry()
  8. const commandMenuHotkeyEnabled = useIsShortcutEnabled(SHORTCUT_IDS.COMMAND_MENU_OPEN)
  9. return (
  10. <CommandProvider
  11. app="studio"
  12. onTelemetry={onTelemetry}
  13. openKey={commandMenuHotkeyEnabled ? 'k' : ''}
  14. >
  15. {children}
  16. </CommandProvider>
  17. )
  18. }