DetailsPanel: log GA events on icon details viewed

This commit is contained in:
rektdeckard
2020-10-10 01:17:02 -04:00
parent 9a4d545dc5
commit 079633d8f6

View File

@@ -1,9 +1,10 @@
import React, { useRef } from "react"; import React, { useRef, useEffect } from "react";
import { useRecoilValue, useSetRecoilState } from "recoil"; import { useRecoilValue, useSetRecoilState } from "recoil";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import { Svg2Png } from "svg2png-converter"; import { Svg2Png } from "svg2png-converter";
import { saveAs } from "file-saver"; import { saveAs } from "file-saver";
import { Copy, X, CheckCircle, Download } from "phosphor-react"; import { Copy, X, CheckCircle, Download } from "phosphor-react";
import ReactGA from "react-ga";
import { import {
iconWeightAtom, iconWeightAtom,
@@ -58,6 +59,11 @@ const DetailsPanel: React.FC<InfoPanelProps> = (props) => {
const [copied, setCopied] = useTransientState<string | false>(false, 2000); const [copied, setCopied] = useTransientState<string | false>(false, 2000);
const ref = useRef<SVGSVGElement>(null); const ref = useRef<SVGSVGElement>(null);
useEffect(
() => ReactGA.event({ category: "Grid", action: "Details", label: name }),
[name]
);
const buttonBarStyle: React.CSSProperties = { const buttonBarStyle: React.CSSProperties = {
color: isDark ? "white" : buttonColor, color: isDark ? "white" : buttonColor,
}; };