mirror of
https://github.com/supabase/supabase.git
synced 2026-05-14 14:49:37 +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>
29 lines
632 B
TypeScript
29 lines
632 B
TypeScript
'use client'
|
|
|
|
import { useCallback } from 'react'
|
|
|
|
import type {
|
|
CommandMenuOpenedEvent,
|
|
CommandMenuCommandSelectedEvent,
|
|
CommandMenuSearchSubmittedEvent,
|
|
} from 'common/telemetry-constants'
|
|
import { useSendTelemetryEvent } from 'lib/telemetry'
|
|
|
|
export function useDocsCommandMenuTelemetry() {
|
|
const sendTelemetryEvent = useSendTelemetryEvent()
|
|
|
|
const onTelemetry = useCallback(
|
|
(
|
|
event:
|
|
| CommandMenuOpenedEvent
|
|
| CommandMenuCommandSelectedEvent
|
|
| CommandMenuSearchSubmittedEvent
|
|
) => {
|
|
sendTelemetryEvent(event)
|
|
},
|
|
[sendTelemetryEvent]
|
|
)
|
|
|
|
return { onTelemetry }
|
|
}
|