mirror of
https://github.com/supabase/supabase.git
synced 2026-07-01 20:54:19 +08:00
* 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>
25 lines
750 B
TypeScript
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>
|
|
)
|
|
}
|