diff options
Diffstat (limited to 'src/App.js')
-rw-r--r-- | src/App.js | 48 |
1 files changed, 32 insertions, 16 deletions
@@ -1,6 +1,8 @@ import useSWR from "swr"; import { DateTime } from "luxon"; +import { BrowserRouter, Route, Switch } from "react-router-dom"; import MainPage from "./MainPage"; +import History from "./History"; import "./App.css"; const url = "https://rcpoller.galenguyer.com/api/v0/history"; @@ -29,22 +31,36 @@ function App() { const lastUpdate = DateTime.fromSQL(latest.last_updated, { zone: "UTC" }).setZone(local); return ( - <div className="App"> - <h1 className="text-4xl">RIT Covid Dashboard</h1> - <h3> - Last Updated:{" "} - {lastUpdate.toLocaleString({ - weekday: "long", - month: "long", - day: "2-digit", - hour: "2-digit", - minute: "2-digit", - })} - </h3> - <br /> - <br /> - <MainPage latest={latest} prior={prior} /> - </div> + <BrowserRouter> + <div className="App"> + <h1 className="text-4xl">RIT Covid Dashboard</h1> + <h3> + Last Updated:{" "} + {lastUpdate.toLocaleString({ + weekday: "long", + month: "long", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + })} + </h3> + <br /> + <br /> + <Switch> + <Route exact path="/"> + <MainPage latest={latest} prior={prior} />{" "} + </Route> + <Route path="/totalstudents"> + <History + name="Total Student Cases" + data={data.map((d) => { + return { value: d.total_students, date: d.last_updated }; + })} + /> + </Route> + </Switch> + </div> + </BrowserRouter> ); } |