diff --git a/src/ui/routes/SummaryRoute.tsx b/src/ui/routes/SummaryRoute.tsx index 4f0ee44..8a2be02 100644 --- a/src/ui/routes/SummaryRoute.tsx +++ b/src/ui/routes/SummaryRoute.tsx @@ -7,6 +7,7 @@ import { useDataset } from "../hooks/useDataset.ts"; import { datasetMonthSpan, summaryView } from "../../domain/views.ts"; import { formatAmount, formatMoney } from "../format.ts"; import { Section, Stat } from "../components/Section.tsx"; +import { Segmented } from "../components/Segmented.tsx"; export function SummaryRoute() { const dataset = useDataset(); @@ -24,91 +25,87 @@ export function SummaryRoute() {

Summary

-
-
- - setFrom(e.target.value)} /> +
+
+ + setFrom(e.target.value)} /> +
+
+ + setTo(e.target.value)} /> +
+
-
- - setTo(e.target.value)} /> -
- -
-
+
{formatMoney(view.totalIncome, base)} {formatMoney(view.totalCharges, base)} - - {formatMoney(difference, base)} - -
+ + {formatMoney(difference, base)} + +
- {(["post", "month"] as const).map((option) => ( - - ))} - + } > - - - - - - - - - - {groupBy === "post" - ? view.byPost.map((entry) => ( - - - - - - )) - : view.byMonth.map((entry) => ( - - - - - - ))} - -
{groupBy === "post" ? "Post" : "Month"}SpentShare
{entry.post.name}{formatAmount(entry.charges)} - {view.totalCharges === 0 - ? "—" - : `${((entry.charges / view.totalCharges) * 100).toFixed(1)}%`} -
- - {entry.monthId} - - {formatAmount(entry.charges)} - {view.totalCharges === 0 - ? "—" - : `${((entry.charges / view.totalCharges) * 100).toFixed(1)}%`} -
+ + + + + + + + + + {groupBy === "post" + ? view.byPost.map((entry) => ( + + + + + + )) + : view.byMonth.map((entry) => ( + + + + + + ))} + +
{groupBy === "post" ? "Post" : "Month"}SpentShare
{entry.post.name}{formatAmount(entry.charges)} + {view.totalCharges === 0 + ? "—" + : `${((entry.charges / view.totalCharges) * 100).toFixed(1)}%`} +
+ + {entry.monthId} + + {formatAmount(entry.charges)} + {view.totalCharges === 0 + ? "—" + : `${((entry.charges / view.totalCharges) * 100).toFixed(1)}%`} +
); diff --git a/src/ui/routes/YearRoute.tsx b/src/ui/routes/YearRoute.tsx index 9b8cdb1..54ae246 100644 --- a/src/ui/routes/YearRoute.tsx +++ b/src/ui/routes/YearRoute.tsx @@ -1,10 +1,10 @@ import { useState } from "react"; import { Link, useParams } from "react-router"; -import { Button } from "@/components/ui/button"; import { useDataset } from "../hooks/useDataset.ts"; import { yearView } from "../../domain/views.ts"; import { formatMoney } from "../format.ts"; import { YearMatrix } from "../components/YearMatrix.tsx"; +import { Segmented } from "../components/Segmented.tsx"; import { Section, Stat } from "../components/Section.tsx"; export function YearRoute() { @@ -20,14 +20,14 @@ export function YearRoute() {
← {numericYear - 1}

{year}

{numericYear + 1} → @@ -43,18 +43,15 @@ export function YearRoute() {
- {(["spend", "balance"] as const).map((option) => ( - - ))} - + } >