fix: connect command palette to analytics modal and update github link
All checks were successful
Deploy Portfolio to VPS / deploy (push) Successful in 21s

This commit is contained in:
Chneemann 2026-07-31 09:17:23 +02:00
parent d4f76bb1ff
commit 7b6f2299bb
No known key found for this signature in database
2 changed files with 15 additions and 7 deletions

View file

@ -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 (

View file

@ -71,7 +71,7 @@ export const getCommands = (
icon: "🐙",
action: () => {
window.open(
"https://github.com/andre-kempf",
"https://github.com/Chneemann",
"_blank",
"noopener,noreferrer",
);