From 7c814de28e4d4f511e61207c5364f34313c06bc6 Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Sun, 24 Aug 2025 21:54:04 -0600 Subject: [PATCH] Rule Stack interactive states and analytics --- app/components/RuleCard.js | 35 ++++++++++++++++++++++++++++++++++- app/components/RuleStack.js | 10 ++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/app/components/RuleCard.js b/app/components/RuleCard.js index 245e7ac..291b90f 100644 --- a/app/components/RuleCard.js +++ b/app/components/RuleCard.js @@ -6,10 +6,43 @@ const RuleCard = ({ icon, backgroundColor = "bg-[var(--color-community-teal-100)]", className = "", + onClick, }) => { + const handleClick = () => { + // Basic analytics event tracking + if (typeof window !== "undefined" && window.gtag) { + window.gtag("event", "template_selected", { + template_name: title, + template_type: "governance_pattern", + }); + } + + // Custom analytics event for other tracking systems + if (typeof window !== "undefined" && window.analytics) { + window.analytics.track("Template Selected", { + templateName: title, + templateType: "governance_pattern", + }); + } + + if (onClick) onClick(); + }; + + const handleKeyDown = (event) => { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + handleClick(); + } + }; + return (