-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vinvoor: merge vinvoor-heatmap into voor-en-achter
- Loading branch information
Showing
13 changed files
with
567 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Box, Paper, Switch, Typography } from "@mui/material"; | ||
import { useState } from "react"; | ||
import { Tooltip } from "react-tooltip"; | ||
import { LoadingSkeleton } from "../components/LoadingSkeleton"; | ||
import { useFetch } from "../hooks/useFetch"; | ||
import { Scan } from "../types/scans"; | ||
import { Heatmap, HeatmapVariant } from "./heatmap/Heatmap"; | ||
|
||
export const Overview = () => { | ||
const [scans, setScans] = useState<Scan[]>([]); | ||
const { loading } = useFetch<Scan[]>("scans", setScans); | ||
const [checked, setChecked] = useState<boolean>(true); | ||
|
||
const dates = scans.map((scan) => new Date(scan.scanTime)); | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
setChecked(event.target.checked); | ||
}; | ||
|
||
return ( | ||
<LoadingSkeleton loading={loading}> | ||
<Paper elevation={4} sx={{ padding: 2 }}> | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
justifyContent: "right", | ||
}} | ||
> | ||
<Typography variant="h6">Months</Typography> | ||
<Switch checked={checked} onChange={handleChange} /> | ||
<Typography variant="h6">Days</Typography> | ||
</Box> | ||
<Heatmap | ||
startDate={new Date("2024-01-01")} | ||
endDate={new Date("2024-12-31")} | ||
days={dates} | ||
variant={ | ||
checked ? HeatmapVariant.DAYS : HeatmapVariant.MONTHS | ||
} | ||
/> | ||
<Tooltip id="heatmap" /> | ||
</Paper> | ||
</LoadingSkeleton> | ||
); | ||
}; |
Oops, something went wrong.