mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: add analytics init, identify, search tracking, consent header, settings toggle
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import type { CategoryInfo, Tool } from "@ashim/shared";
|
||||
import { CATEGORIES, TOOLS } from "@ashim/shared";
|
||||
import { ANALYTICS_EVENTS, CATEGORIES, TOOLS } from "@ashim/shared";
|
||||
import { Eye, EyeOff, FileImage, LayoutGrid, List, Search } from "lucide-react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { GemLogo } from "@/components/common/gem-logo";
|
||||
import { track } from "@/lib/analytics";
|
||||
import { apiGet } from "@/lib/api";
|
||||
import { ICON_MAP } from "@/lib/icon-map";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -51,6 +52,17 @@ export function FullscreenGridPage() {
|
||||
);
|
||||
}, [search, visibleTools]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!search) return;
|
||||
const timer = setTimeout(() => {
|
||||
track(ANALYTICS_EVENTS.SEARCH, {
|
||||
query: search,
|
||||
results_count: filteredTools.length,
|
||||
});
|
||||
}, 1000);
|
||||
return () => clearTimeout(timer);
|
||||
}, [search, filteredTools.length]);
|
||||
|
||||
const groupedTools = useMemo(() => {
|
||||
const groups = new Map<string, Tool[]>();
|
||||
for (const tool of filteredTools) {
|
||||
|
||||
Reference in New Issue
Block a user