Add 2,3,6 months to weight graph

This commit is contained in:
Brandon Presley 2023-11-09 13:27:34 +13:00
parent 9fee26f7c8
commit e5db6fe34b
1 changed files with 7 additions and 1 deletions

View File

@ -15,11 +15,14 @@ import Weight from "./weight";
export default function ViewWeightGraph() {
const [weights, setWeights] = useState<Weight[]>();
const [period, setPeriod] = useState(Periods.Monthly);
const [period, setPeriod] = useState(Periods.TwoMonths);
useEffect(() => {
let difference = "-7 days";
if (period === Periods.Monthly) difference = "-1 months";
else if (period === Periods.TwoMonths) difference = "-2 months";
else if (period === Periods.ThreeMonths) difference = "-3 months";
else if (period === Periods.SixMonths) difference = "-6 months";
else if (period === Periods.Yearly) difference = "-1 years";
let group = "%Y-%m-%d";
@ -81,6 +84,9 @@ export default function ViewWeightGraph() {
items={[
{ value: Periods.Weekly, label: Periods.Weekly },
{ value: Periods.Monthly, label: Periods.Monthly },
{ value: Periods.TwoMonths, label: Periods.TwoMonths },
{ value: Periods.ThreeMonths, label: Periods.ThreeMonths },
{ value: Periods.SixMonths, label: Periods.SixMonths },
{ value: Periods.Yearly, label: Periods.Yearly },
]}
onChange={(value) => setPeriod(value as Periods)}