From 60af17c095ae6f034dac96ce64bfb5cd76fe603a Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Wed, 13 Apr 2022 22:31:07 -0400 Subject: use goatcounter the right way --- src/App.jsx | 169 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 88 insertions(+), 81 deletions(-) (limited to 'src/App.jsx') diff --git a/src/App.jsx b/src/App.jsx index af8f570..42c3f36 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,14 +1,22 @@ -import { BrowserRouter, Routes, Route, Link } from "react-router-dom"; +import { useLocation, Routes, Route, Link } from "react-router-dom"; import { useState } from "react"; import useFetch from "./useFetch"; import Index from "./pages/Index"; import { DateTime } from "luxon"; import "./App.css"; import Graph from "./pages/Graph"; +import { useEffect } from "react"; const App = () => { const url = localStorage.getItem("url") ?? "https://ritcoviddashboard.com/api/v0/history"; + let routerLocation = useLocation(); + useEffect(() => { + !window.goatcounter ?? window.goatcounter.count({ + path: location.pathname + location.search + location.hash, + }); + }, [routerLocation]); + const response = useFetch(url); const [timeDifference, setTimeDifference] = useState(1); @@ -23,86 +31,85 @@ const App = () => { const priorUpdate = response.loading ? null : DateTime.fromSQL(prior.last_updated).setZone(local); return ( - -
-
- -

RIT COVID Dashboard

- - -
- - - } - > - - } - > - - } - > - - } - > - } /> - - -
-
+
+
+ +

RIT COVID Dashboard

+ + +
+ + + } + > + + } + > + + } + > + + } + > + } /> + + + +
); }; -- cgit v1.2.3