Files
supabase/apps/studio/components/interfaces/App/CommandMenu/StudioCommandProvider.tsx
Francesco Sansalvadore af43adb9a4 chore: command events (#39775)
* add CommandMenuTriggerInput in ui-patterns
* optimize search input responsiveness
* add event on commandMenu opened
* add event on debounced commandMenu input submission
* add event on commandMenu command selection
* add commandMenu telemetry to studio, www and docs

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2025-10-24 11:06:31 +02:00

25 lines
750 B
TypeScript

import type { PropsWithChildren } from 'react'
import { CommandProvider } from 'ui-patterns/CommandMenu'
import { useStudioCommandMenuTelemetry } from 'hooks/misc/useStudioCommandMenuTelemetry'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { LOCAL_STORAGE_KEYS } from 'common'
export function StudioCommandProvider({ children }: PropsWithChildren) {
const { onTelemetry } = useStudioCommandMenuTelemetry()
const [commandMenuHotkeyEnabled] = useLocalStorageQuery<boolean>(
LOCAL_STORAGE_KEYS.HOTKEY_COMMAND_MENU,
true
)
return (
<CommandProvider
app="studio"
onTelemetry={onTelemetry}
openKey={commandMenuHotkeyEnabled ? 'k' : ''}
>
{children}
</CommandProvider>
)
}