diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 19975c6ee..4ecac8b32 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -344,5 +344,6 @@ export enum Submit { SiteActivateDeployment = 'submit_site_activate_deployment', RecordCreate = 'submit_dns_record_create', RecordUpdate = 'submit_dns_record_update', - RecordDelete = 'submit_dns_record_delete' + RecordDelete = 'submit_dns_record_delete', + SearchClear = 'submit_clear_search' } diff --git a/src/lib/commandCenter/panels/template.svelte b/src/lib/commandCenter/panels/template.svelte index d23c1f405..83071bcaf 100644 --- a/src/lib/commandCenter/panels/template.svelte +++ b/src/lib/commandCenter/panels/template.svelte @@ -10,6 +10,7 @@ import { clearSubPanels, popSubPanel, subPanels } from '../subPanels'; import { IconArrowSmRight } from '@appwrite.io/pink-icons-svelte'; import { Icon, Keyboard, Layout } from '@appwrite.io/pink-svelte'; + import { Submit, trackEvent } from '$lib/actions/analytics'; /* eslint no-undef: "off" */ type Option = $$Generic & { group?: string }>; @@ -22,6 +23,7 @@ let selected = 0; let usingKeyboard = false; let contentEl: HTMLElement; + let didSearch = false; async function triggerOption(option: Option) { const prevPanels = $subPanels.length; @@ -43,6 +45,14 @@ if (!open) return; usingKeyboard = true; + if (search.length > 0) { + didSearch = true; + } + + if (search === '' && didSearch) { + trackEvent(Submit.SearchClear); + } + let canceled = false; dispatch('keydown', { originalEvent: event,