From 264e571b0ca34d24f4997c5864a43d4f475e14dc Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Wed, 13 Apr 2022 19:10:44 -0400 Subject: full version 2 re-write --- src/History.js | 89 ---------------------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 src/History.js (limited to 'src/History.js') diff --git a/src/History.js b/src/History.js deleted file mode 100644 index 58085ac..0000000 --- a/src/History.js +++ /dev/null @@ -1,89 +0,0 @@ -import { React, PureComponent } from "react"; -import { DateTime } from "luxon"; -import { - BarChart, - Bar, - LineChart, - Line, - CartesianGrid, - XAxis, - YAxis, - Tooltip, - ReferenceLine, - ResponsiveContainer, - Label, -} from "recharts"; -import GoatCounter from "./GoatCounter"; - -const History = (props) => { - const offset = DateTime.fromSQL(props.data[0].date, { zone: "UTC" }).setZone(DateTime.local().zoneName).toSeconds(); - const data = props.data.map((d) => { - return { - value: d.value, - date: DateTime.fromSQL(d.date, { zone: "UTC" }).setZone(DateTime.local().zoneName).toSeconds(), - }; - }); - - if (process.env.NODE_ENV == "development") { - console.log(data); - } - - return ( - <> -

{props.name}

- - - {/* */} - - - } - height={90} - /> - - - - - - ); -}; - -class CustomizedAxisTick extends PureComponent { - render() { - const { x, y, payload } = this.props; - - return ( - - - {DateTime.fromSeconds(payload.value).toLocaleString()} - - - ); - } -} - -const CustomTooltip = ({ active, payload, label }) => { - if (active) { - return ( -
-

- {DateTime.fromSeconds(label).toLocaleString({ weekday: "long", month: "long", day: "2-digit" })} -

-

{payload[0].value}

-
- ); - } - return null; -}; - -export default History; -- cgit v1.2.3