diff --git a/src/components/AnalyticsWidget.tsx b/src/components/AnalyticsWidget.tsx index 01670db..9a2726e 100644 --- a/src/components/AnalyticsWidget.tsx +++ b/src/components/AnalyticsWidget.tsx @@ -24,18 +24,26 @@ export default function AnalyticsWidget() { .catch((err) => console.error("Analytics Widget Fetch Error:", err)); }; - // Initial load on client hydration: track page view - useEffect(() => { - setMounted(true); - fetchStats(true); // track=true on initial page visit - }, []); - // Open modal and silently refresh stats without incrementing view count const handleOpenModal = () => { fetchStats(false); // track=false when clicking badge setIsOpen(true); }; + // Hydrate client, fetch initial page metrics, and listen for custom Cmd+K palette events + useEffect(() => { + setMounted(true); + fetchStats(true); // Track initial page view + + // Listen for custom trigger event fired from CommandPalette + const handleCustomOpen = () => handleOpenModal(); + window.addEventListener("open-analytics", handleCustomOpen); + + return () => { + window.removeEventListener("open-analytics", handleCustomOpen); + }; + }, []); + // Skeleton badge while client hydration occurs or metrics are loading if (!mounted || !stats) { return ( diff --git a/src/lib/paletteCommands.ts b/src/lib/paletteCommands.ts index fd896fe..da47fcd 100644 --- a/src/lib/paletteCommands.ts +++ b/src/lib/paletteCommands.ts @@ -71,7 +71,7 @@ export const getCommands = ( icon: "🐙", action: () => { window.open( - "https://github.com/andre-kempf", + "https://github.com/Chneemann", "_blank", "noopener,noreferrer", );