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