mega-plant/components
David 681225e51d Charts: a profit line that changes colour, and a Series toggle
Profit was a single always-teal line, so a month that lost money looked
like a month that made a little. It is now drawn per sign: one <Line> per
same-sign run, plus a gradient <Line> across each crossing. Recharts draws
a Line as one <Curve> path, so <Cell> cannot recolour a segment — separate
series are the only way. Every variant is a key on the ONE shared dataset
rather than a sliced `data` prop, because Recharts builds a categorical axis
by concatenating every series' data and a short slice re-adds the month
labels ("Jan … Aug, Jan … Aug"). The tooltip needs a custom `content`
component to fold those per-run keys back into a single profit row.

Two honesty rules: profit stays null in a month with no income figure
(treating it as 0 drew a green dot for a month that was never billed), and
a month with no running-cost row gets a hollow dot, because its profit is
optimistic.

The toolbar's Series button toggles which lines a card draws, remembered in
localStorage. A hidden series takes its legend entry and its Y axis with it,
so there is never an axis for a line that is not drawn, and the last visible
series cannot be switched off.

Palette: Running moves off red to the project's existing brand purple,
because red is now reserved for a loss and a red Running line next to a red
loss segment was unreadable. `--color-chart-loss` and `--color-chart-profit`
are separate tokens on purpose — loss used to read the Running token, so
recolouring Running silently dragged the red with it.

/charts alone now reads profit including running cost, so the card badge,
the profit line and the Profit bars view cannot disagree. Scoped to the
page: lib/profit.ts keeps its workbook default for every other surface.
2026-10-03 09:20:16 +02:00
..
ChartsGrid.tsx Charts: a profit line that changes colour, and a Series toggle 2026-10-03 09:20:16 +02:00
DashboardCharts.tsx Charts: a profit line that changes colour, and a Series toggle 2026-10-03 09:20:16 +02:00
ExpenseSectionPage.tsx Fix: the mobile table was mislabelled and clipping its own totals 2026-10-02 15:34:19 +02:00
GlobalSearch.tsx Fix: the mobile table was mislabelled and clipping its own totals 2026-10-02 15:34:19 +02:00
IncomeView.tsx Fix: the mobile table was mislabelled and clipping its own totals 2026-10-02 15:34:19 +02:00
InvoiceIntake.tsx Fix: toast and machine dropdown were rendering behind the page chrome 2026-10-02 18:42:29 +02:00
InvoiceList.tsx Sites: a real Sites list, with the unbooked lines bookable to a site 2026-10-02 16:24:06 +02:00
InvoiceTable.tsx Invoices: keep the PDF on the invoice, and search the invoice's own words 2026-10-02 19:09:16 +02:00
InvoiceUploader.tsx Invoices: line-item extraction, booking to plant items, VAT-inclusive income 2026-10-01 15:59:30 +02:00
MachineCombobox.tsx Invoices: keep the PDF on the invoice, and search the invoice's own words 2026-10-02 19:09:16 +02:00
MachineLineChart.tsx Charts: a profit line that changes colour, and a Series toggle 2026-10-03 09:20:16 +02:00
PlantMap.tsx Sites: give every site coordinates 2026-10-02 16:33:43 +02:00
PlantMapLoader.tsx Sites: a real Sites list, with the unbooked lines bookable to a site 2026-10-02 16:24:06 +02:00
PlantRegisterTable.tsx Sites: auto-allocate container lines to the container the site hires 2026-10-02 18:32:12 +02:00
RunningView.tsx Fix: the mobile table was mislabelled and clipping its own totals 2026-10-02 15:34:19 +02:00
ScrollFade.tsx Fix: the mobile table was mislabelled and clipping its own totals 2026-10-02 15:34:19 +02:00
Sidebar.tsx Sites: auto-allocate container lines to the container the site hires 2026-10-02 18:32:12 +02:00
SiteBookingSelect.tsx Sites: a real Sites list, with the unbooked lines bookable to a site 2026-10-02 16:24:06 +02:00
SiteContainerEditor.tsx Sites: auto-allocate container lines to the container the site hires 2026-10-02 18:32:12 +02:00
SiteCoordinateEditor.tsx Sites: give every site coordinates 2026-10-02 16:33:43 +02:00
SitesView.tsx Invoices: keep the PDF on the invoice, and search the invoice's own words 2026-10-02 19:09:16 +02:00
Sparkline.tsx Invoices: keep the PDF on the invoice, and search the invoice's own words 2026-10-02 19:09:16 +02:00
ThemeProvider.tsx Mega Plant dashboard — fix & harden (Parts 0-5) 2026-09-12 09:35:48 +02:00
ThemeToggle.tsx Mega Plant dashboard — fix & harden (Parts 0-5) 2026-09-12 09:35:48 +02:00
Toast.tsx Fix: toast and machine dropdown were rendering behind the page chrome 2026-10-02 18:42:29 +02:00