From c582543fdac01e1a37a473e25a202f88409db7c4 Mon Sep 17 00:00:00 2001 From: anastasiia Date: Wed, 1 Mar 2023 09:33:11 +0700 Subject: [PATCH 1/3] improve search analytics --- client/src/hooks/useAnalytics.ts | 4 +++- client/src/hooks/useSearch.tsx | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/hooks/useAnalytics.ts b/client/src/hooks/useAnalytics.ts index 3d87e5e76f..8da169a339 100644 --- a/client/src/hooks/useAnalytics.ts +++ b/client/src/hooks/useAnalytics.ts @@ -3,9 +3,11 @@ import * as analytics from 'rudder-sdk-js'; const useAnalytics = () => { const trackSearch = useCallback( - (queryTime: number) => { + (queryTime: number, query: string, searchId?: string) => { analytics?.track('Search', { queryTime, + query, + searchId, }); }, [analytics], diff --git a/client/src/hooks/useSearch.tsx b/client/src/hooks/useSearch.tsx index 099e2e20c7..7900da23a6 100644 --- a/client/src/hooks/useSearch.tsx +++ b/client/src/hooks/useSearch.tsx @@ -69,7 +69,7 @@ export const useSearch = ( if (i === 0) { const queryTime = Date.now() - startTime; setLastQueryTime(queryTime); - trackSearch(queryTime); + trackSearch(queryTime, query, newData.query_id); if (newData.Err) { setStatus((prev) => ({ ...prev, @@ -104,7 +104,7 @@ export const useSearch = ( .then((res: any) => { const queryTime = Date.now() - startTime; setLastQueryTime(queryTime); - trackSearch(queryTime); + trackSearch(queryTime, query); setStatus({ loading: false, data: res }); }) .catch((error: Error) => { From d0332a381c5268d1aac6bef9b6c77b8a69a206d9 Mon Sep 17 00:00:00 2001 From: anastasiia Date: Wed, 1 Mar 2023 10:06:28 +0700 Subject: [PATCH 2/3] prevent select all override if target is input --- client/src/components/CodeBlock/CodeFull/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/CodeBlock/CodeFull/index.tsx b/client/src/components/CodeBlock/CodeFull/index.tsx index 07abaa41fb..1549cb0088 100644 --- a/client/src/components/CodeBlock/CodeFull/index.tsx +++ b/client/src/components/CodeBlock/CodeFull/index.tsx @@ -283,7 +283,11 @@ const CodeFull = ({ useEffect(() => { const handler = (event: KeyboardEvent) => { - if ((event.ctrlKey || event.metaKey) && event.key === 'a') { + if ( + (event.ctrlKey || event.metaKey) && + event.key === 'a' && + (event.target as HTMLElement)?.tagName !== 'INPUT' + ) { // Prevent the default action (i.e. selecting all text in the browser) event.preventDefault(); setCurrentSelection([ From f0573b88c50b89477ea27eb752aed79766f28135 Mon Sep 17 00:00:00 2001 From: anastasiia Date: Wed, 1 Mar 2023 16:06:08 +0700 Subject: [PATCH 3/3] bump version --- Cargo.lock | 2 +- apps/desktop/src-tauri/Cargo.toml | 2 +- apps/desktop/src-tauri/tauri.conf.json | 2 +- client/README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e79a1b5e9d..cded24c439 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -462,7 +462,7 @@ dependencies = [ [[package]] name = "bloop" -version = "0.2.2" +version = "0.2.3" dependencies = [ "anyhow", "bleep", diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index 52a1829eab..50f384d4e5 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bloop" -version = "0.2.2" +version = "0.2.3" description = "Search code. Fast." authors = ["Bloop AI Developers"] license = "" diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index d8b82b5e0b..8cf1f755da 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "bloop", - "version": "0.2.2" + "version": "0.2.3" }, "tauri": { "allowlist": { diff --git a/client/README.md b/client/README.md index 32cdc6d370..7adbf95a6f 100644 --- a/client/README.md +++ b/client/README.md @@ -9,4 +9,4 @@ pnpm install npm run start-web ``` -Open `localhost:5173` in a browser and, hey presto, you've got bloop in the browser. \ No newline at end of file +Open `localhost:5173` in a browser and, hey presto, you've got bloop in the browser.