import { useLocation, Routes, Route, Link } from "react-router-dom"; import { useState, lazy, Suspense } from "react"; import useFetch from "./useFetch"; import { DateTime } from "luxon"; import "./App.css"; const Index = lazy(() => import("./pages/Index")); const Graph = lazy(() => import("./pages/Graph")); import { useEffect } from "react"; const App = () => { const url = localStorage.getItem("url") ?? "/data.json"; 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); return (

2020-2021 RIT COVID Dashboard

} > } > } > } > } > } > } > } > } > } > } />
); }; const Updated = (props) => { const { loading, lastUpdate, priorUpdate, timeDifference } = props; if (loading) { return
; } return (
Last Updated:{" "} {lastUpdate.toLocaleString({ weekday: "long", month: "long", day: "2-digit", hour: "2-digit", minute: "2-digit", })}
Prior Update:{" "} {priorUpdate.toLocaleString({ weekday: "long", month: "long", day: "2-digit", hour: "2-digit", minute: "2-digit", })}{" "} ({timeDifference == 1 ? "one weekday ago" : timeDifference == 5 ? "one week ago" : "two weeks ago"})
); }; export default App;