@burdenoff/microfe-healthybowl 2026.714.6 → 2026.714.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/healthybowl/HealthyBowlRoutes.js +135 -95
- package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlAccounting.js +316 -0
- package/dist/healthybowl/hooks/useHealthyBowlAccounting.js.map +1 -0
- package/dist/healthybowl/hooks/useWeatherIntelligence.js +224 -0
- package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -0
- package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js +297 -0
- package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/ChartOfAccountsPage.js +233 -0
- package/dist/healthybowl/pages/financial/ChartOfAccountsPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/CostByCropPage.js +365 -0
- package/dist/healthybowl/pages/financial/CostByCropPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/FarmAccountingPage.js +384 -0
- package/dist/healthybowl/pages/financial/FarmAccountingPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/FinancialDashboardPage.js +32 -16
- package/dist/healthybowl/pages/financial/FinancialDashboardPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +221 -0
- package/dist/healthybowl/pages/financial/GeneralLedgerPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/JournalEntryModal.js +261 -0
- package/dist/healthybowl/pages/financial/JournalEntryModal.js.map +1 -0
- package/dist/healthybowl/pages/financial/ProfitLossPage.js +202 -0
- package/dist/healthybowl/pages/financial/ProfitLossPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js +258 -0
- package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +255 -0
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js +387 -0
- package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherHistoryPage.js +313 -114
- package/dist/healthybowl/pages/weather/WeatherHistoryPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js +554 -213
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +457 -0
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -0
- package/dist/healthybowl/utils/download.js +11 -0
- package/dist/healthybowl/utils/download.js.map +1 -0
- package/dist/healthybowl/utils/helpers.js +11 -8
- package/dist/healthybowl/utils/helpers.js.map +1 -1
- package/dist/healthybowl/utils/period.js +15 -0
- package/dist/healthybowl/utils/period.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { cn as e, formatDate as t } from "../../utils/helpers.js";
|
|
2
|
+
import { PageLayout as n } from "../../components/PageLayout.js";
|
|
3
|
+
import { EmptyState as r } from "../../components/EmptyState.js";
|
|
4
|
+
import { ErrorState as i } from "../../components/ErrorState.js";
|
|
5
|
+
import { ChartCard as a } from "../../components/ChartCard.js";
|
|
6
|
+
import { ToastContainer as o } from "../../components/Toast.js";
|
|
7
|
+
import { PageLoader as s } from "../../components/PageLoader.js";
|
|
8
|
+
import { useToast as c } from "../../hooks/useToast.js";
|
|
9
|
+
import "../../components/index.js";
|
|
10
|
+
import { Legend as l } from "../../../node_modules/recharts/es6/component/Legend.js";
|
|
11
|
+
import { Tooltip as u } from "../../../node_modules/recharts/es6/component/Tooltip.js";
|
|
12
|
+
import { ResponsiveContainer as d } from "../../../node_modules/recharts/es6/component/ResponsiveContainer.js";
|
|
13
|
+
import { Bar as f } from "../../../node_modules/recharts/es6/cartesian/Bar.js";
|
|
14
|
+
import { CartesianGrid as p } from "../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";
|
|
15
|
+
import { Line as m } from "../../../node_modules/recharts/es6/cartesian/Line.js";
|
|
16
|
+
import { Area as h } from "../../../node_modules/recharts/es6/cartesian/Area.js";
|
|
17
|
+
import { XAxis as g } from "../../../node_modules/recharts/es6/cartesian/XAxis.js";
|
|
18
|
+
import { YAxis as _ } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
|
|
19
|
+
import { ComposedChart as v } from "../../../node_modules/recharts/es6/chart/ComposedChart.js";
|
|
20
|
+
import { useWeatherIntelligence as y } from "../../hooks/useWeatherIntelligence.js";
|
|
21
|
+
import { useMemo as b } from "react";
|
|
22
|
+
import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
23
|
+
import { AlertTriangle as S, ArrowDown as C, ArrowUp as w, CalendarClock as T, CloudRain as E, Minus as D, Printer as O, RefreshCw as k, Snowflake as A, Thermometer as j } from "lucide-react";
|
|
24
|
+
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
25
|
+
import { Button as F } from "@burdenoff/fe-libs/ui";
|
|
26
|
+
//#region src/healthybowl/pages/weather/WeatherAnomalyReportPage.tsx
|
|
27
|
+
var I = {
|
|
28
|
+
backgroundColor: "var(--color-card)",
|
|
29
|
+
border: "1px solid var(--color-border)",
|
|
30
|
+
borderRadius: "8px"
|
|
31
|
+
}, L = (e) => e > 0 ? "up" : e < 0 ? "down" : "flat", R = (e, t, n) => e >= n ? "text-red-600" : e >= t ? "text-amber-600" : "text-emerald-600", z = (e) => {
|
|
32
|
+
let t = (e ?? "").toUpperCase();
|
|
33
|
+
return t === "RED" || t === "HIGH" ? {
|
|
34
|
+
label: "High",
|
|
35
|
+
className: "bg-red-100 text-red-700 dark:bg-red-950/40 dark:text-red-300"
|
|
36
|
+
} : t === "AMBER" || t === "MODERATE" || t === "MEDIUM" ? {
|
|
37
|
+
label: "Moderate",
|
|
38
|
+
className: "bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300"
|
|
39
|
+
} : {
|
|
40
|
+
label: "Low",
|
|
41
|
+
className: "bg-bg-sunken text-text-secondary"
|
|
42
|
+
};
|
|
43
|
+
}, B = ({ icon: t, label: n, headline: r, emphasis: i, detail: a, direction: o, colorClass: s }) => /* @__PURE__ */ P("div", {
|
|
44
|
+
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ P("div", {
|
|
47
|
+
className: "flex items-center justify-between",
|
|
48
|
+
children: [/* @__PURE__ */ N("span", {
|
|
49
|
+
className: "text-sm font-medium text-text-secondary",
|
|
50
|
+
children: n
|
|
51
|
+
}), /* @__PURE__ */ N("span", {
|
|
52
|
+
className: "flex size-8 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary",
|
|
53
|
+
children: /* @__PURE__ */ N(t, { className: "size-4" })
|
|
54
|
+
})]
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ P("div", {
|
|
57
|
+
className: e("mt-2 flex items-baseline gap-1.5", s),
|
|
58
|
+
children: [
|
|
59
|
+
o === "up" && /* @__PURE__ */ N(w, { className: "size-5 shrink-0" }),
|
|
60
|
+
o === "down" && /* @__PURE__ */ N(C, { className: "size-5 shrink-0" }),
|
|
61
|
+
o === "flat" && /* @__PURE__ */ N(D, { className: "size-5 shrink-0" }),
|
|
62
|
+
/* @__PURE__ */ N("span", {
|
|
63
|
+
className: "text-3xl font-semibold tabular-nums",
|
|
64
|
+
children: r
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ N("span", {
|
|
67
|
+
className: "text-sm font-medium uppercase",
|
|
68
|
+
children: i
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ N("p", {
|
|
73
|
+
className: "mt-1 text-xs text-text-secondary",
|
|
74
|
+
children: a
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}), V = () => {
|
|
78
|
+
let { t: C } = x(), { toasts: w, toast: D, dismiss: V } = c(), { anomaly: W, loadingAnomaly: G, errorAnomaly: K, refetchAnomaly: q, syncHistory: J } = y(), Y = b(() => (W?.monthlyRainfall ?? []).map((e) => ({
|
|
79
|
+
month: e.monthName,
|
|
80
|
+
current: e.currentValue,
|
|
81
|
+
baselineAvg: e.baselineAvg,
|
|
82
|
+
band: [e.baselineMin, e.baselineMax]
|
|
83
|
+
})), [W?.monthlyRainfall]), X = b(() => (W?.monthlyTemperature ?? []).map((e) => ({
|
|
84
|
+
month: e.monthName,
|
|
85
|
+
current: e.currentValue,
|
|
86
|
+
baselineAvg: e.baselineAvg,
|
|
87
|
+
band: [e.baselineMin, e.baselineMax]
|
|
88
|
+
})), [W?.monthlyTemperature]), Z = async () => {
|
|
89
|
+
try {
|
|
90
|
+
await J(), D({
|
|
91
|
+
title: C("healthybowl.weather.anomaly.toast.synced.title", "History synced"),
|
|
92
|
+
description: C("healthybowl.weather.anomaly.toast.synced.description", "The seasonal anomaly report has been recalculated from the latest archive."),
|
|
93
|
+
variant: "success"
|
|
94
|
+
});
|
|
95
|
+
} catch (e) {
|
|
96
|
+
D({
|
|
97
|
+
title: C("healthybowl.common.error", "Something went wrong"),
|
|
98
|
+
description: e instanceof Error ? e.message : void 0,
|
|
99
|
+
variant: "error"
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, Q = W ? C("healthybowl.weather.anomaly.subtitle", "This season vs {{years}}-year baseline ({{start}}–{{end}})", {
|
|
103
|
+
years: W.baselineYears,
|
|
104
|
+
start: W.startYear,
|
|
105
|
+
end: W.endYear - 1
|
|
106
|
+
}) : C("healthybowl.weather.anomaly.subtitleFallback", "This season vs the multi-year climate baseline");
|
|
107
|
+
return /* @__PURE__ */ P(n, {
|
|
108
|
+
title: C("healthybowl.weather.anomaly.title", "Seasonal Anomaly Report"),
|
|
109
|
+
description: Q,
|
|
110
|
+
purpose: "How this season is tracking against your farm's own multi-year climate baseline — is it wetter or drier than normal, warmer or cooler, and is frost arriving earlier than usual. Use it to spot when the weather is deviating from what your crops are used to, so you can adjust irrigation, protect against early frost, and understand an unusual yield.",
|
|
111
|
+
actions: /* @__PURE__ */ P(F, {
|
|
112
|
+
variant: "outline",
|
|
113
|
+
size: "sm",
|
|
114
|
+
onClick: () => window.print(),
|
|
115
|
+
className: "text-text-secondary hover:text-text-primary",
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ N(O, { className: "h-4 w-4" }),
|
|
118
|
+
" ",
|
|
119
|
+
C("healthybowl.weather.anomaly.actions.print", "Print")
|
|
120
|
+
]
|
|
121
|
+
}),
|
|
122
|
+
children: [G && !W ? /* @__PURE__ */ N(s, {}) : K && !W ? /* @__PURE__ */ N(i, { onRetry: q }) : !W || !W.synced ? /* @__PURE__ */ N(r, {
|
|
123
|
+
illustration: "empty-data",
|
|
124
|
+
title: C("healthybowl.weather.anomaly.empty.title", "No baseline yet"),
|
|
125
|
+
description: C("healthybowl.weather.anomaly.empty.description", "Sync your farm-site weather history to build a multi-year climate baseline. Once synced, this report compares the current season against it."),
|
|
126
|
+
action: /* @__PURE__ */ P(F, {
|
|
127
|
+
onClick: Z,
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ N(k, { className: "h-4 w-4" }),
|
|
130
|
+
" ",
|
|
131
|
+
C("healthybowl.weather.anomaly.empty.sync", "Sync history")
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
}) : /* @__PURE__ */ P(M, { children: [
|
|
135
|
+
/* @__PURE__ */ P("div", {
|
|
136
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ N(B, {
|
|
139
|
+
icon: E,
|
|
140
|
+
label: C("healthybowl.weather.anomaly.stats.rainfall.label", "Rainfall this month"),
|
|
141
|
+
headline: `${Math.abs(Math.round(W.rainfallDeviationPct))}%`,
|
|
142
|
+
emphasis: W.rainfallDeviationPct < 0 ? C("healthybowl.weather.anomaly.stats.rainfall.below", "below normal") : C("healthybowl.weather.anomaly.stats.rainfall.above", "above normal"),
|
|
143
|
+
detail: C("healthybowl.weather.anomaly.stats.rainfall.detail", "{{now}}mm vs {{avg}}mm avg", {
|
|
144
|
+
now: Math.round(W.rainfallThisMonthMm),
|
|
145
|
+
avg: Math.round(W.rainfallBaselineMm)
|
|
146
|
+
}),
|
|
147
|
+
direction: L(W.rainfallDeviationPct),
|
|
148
|
+
colorClass: R(Math.abs(W.rainfallDeviationPct), 15, 30)
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ N(B, {
|
|
151
|
+
icon: j,
|
|
152
|
+
label: C("healthybowl.weather.anomaly.stats.temp.label", "Avg temperature"),
|
|
153
|
+
headline: `${W.avgTempDeltaC > 0 ? "+" : ""}${W.avgTempDeltaC.toFixed(1)}°C`,
|
|
154
|
+
emphasis: W.avgTempDeltaC > 0 ? C("healthybowl.weather.anomaly.stats.temp.above", "above") : W.avgTempDeltaC < 0 ? C("healthybowl.weather.anomaly.stats.temp.below", "below") : C("healthybowl.weather.anomaly.stats.temp.normal", "normal"),
|
|
155
|
+
detail: C("healthybowl.weather.anomaly.stats.temp.detail", "vs baseline average"),
|
|
156
|
+
direction: L(W.avgTempDeltaC),
|
|
157
|
+
colorClass: R(Math.abs(W.avgTempDeltaC), 1, 2)
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ N(B, {
|
|
160
|
+
icon: A,
|
|
161
|
+
label: C("healthybowl.weather.anomaly.stats.frost.label", "Frost days"),
|
|
162
|
+
headline: `${W.frostDaysDelta > 0 ? "+" : ""}${W.frostDaysDelta}`,
|
|
163
|
+
emphasis: C("healthybowl.weather.anomaly.stats.frost.emphasis", "vs average"),
|
|
164
|
+
detail: C("healthybowl.weather.anomaly.stats.frost.detail", "{{now}} this season vs {{avg}} baseline", {
|
|
165
|
+
now: W.frostDaysThisSeason,
|
|
166
|
+
avg: W.frostDaysBaseline
|
|
167
|
+
}),
|
|
168
|
+
direction: L(W.frostDaysDelta),
|
|
169
|
+
colorClass: R(Math.abs(W.frostDaysDelta), 2, 4)
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ N(B, {
|
|
172
|
+
icon: T,
|
|
173
|
+
label: C("healthybowl.weather.anomaly.stats.firstFrost.label", "First-frost date"),
|
|
174
|
+
headline: W.firstFrostDate ? `${Math.abs(W.firstFrostDeltaDays)}` : C("healthybowl.weather.anomaly.stats.firstFrost.none", "—"),
|
|
175
|
+
emphasis: W.firstFrostDate ? W.firstFrostDeltaDays < 0 ? C("healthybowl.weather.anomaly.stats.firstFrost.early", "days early") : W.firstFrostDeltaDays > 0 ? C("healthybowl.weather.anomaly.stats.firstFrost.late", "days late") : C("healthybowl.weather.anomaly.stats.firstFrost.onTime", "on time") : C("healthybowl.weather.anomaly.stats.firstFrost.pending", "not yet"),
|
|
176
|
+
detail: W.firstFrostDate ? C("healthybowl.weather.anomaly.stats.firstFrost.detail", "{{now}} vs {{avg}}", {
|
|
177
|
+
now: t(W.firstFrostDate),
|
|
178
|
+
avg: W.baselineFirstFrostDate ? t(W.baselineFirstFrostDate) : "—"
|
|
179
|
+
}) : C("healthybowl.weather.anomaly.stats.firstFrost.detailPending", "No frost recorded yet this season"),
|
|
180
|
+
direction: W.firstFrostDate ? L(W.firstFrostDeltaDays) : "flat",
|
|
181
|
+
colorClass: W.firstFrostDate ? R(Math.abs(W.firstFrostDeltaDays), 5, 10) : "text-text-secondary"
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ P("div", {
|
|
186
|
+
className: "grid grid-cols-1 gap-4 lg:grid-cols-2",
|
|
187
|
+
children: [/* @__PURE__ */ N(a, {
|
|
188
|
+
title: C("healthybowl.weather.anomaly.charts.rainfall.title", "Monthly rainfall"),
|
|
189
|
+
description: C("healthybowl.weather.anomaly.charts.rainfall.description", "This season (bars) vs the baseline min–max band"),
|
|
190
|
+
children: Y.length === 0 ? /* @__PURE__ */ N(U, { label: C("healthybowl.weather.anomaly.charts.noData", "No monthly data yet") }) : /* @__PURE__ */ N(d, {
|
|
191
|
+
width: "100%",
|
|
192
|
+
height: 280,
|
|
193
|
+
children: /* @__PURE__ */ P(v, {
|
|
194
|
+
data: Y,
|
|
195
|
+
margin: {
|
|
196
|
+
top: 8,
|
|
197
|
+
right: 16,
|
|
198
|
+
left: 0,
|
|
199
|
+
bottom: 4
|
|
200
|
+
},
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ N(p, {
|
|
203
|
+
strokeDasharray: "3 3",
|
|
204
|
+
className: "stroke-border"
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ N(g, {
|
|
207
|
+
dataKey: "month",
|
|
208
|
+
className: "text-xs",
|
|
209
|
+
tick: { fill: "currentColor" }
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ N(_, {
|
|
212
|
+
className: "text-xs",
|
|
213
|
+
tick: { fill: "currentColor" },
|
|
214
|
+
tickFormatter: (e) => `${e}`
|
|
215
|
+
}),
|
|
216
|
+
/* @__PURE__ */ N(u, {
|
|
217
|
+
contentStyle: I,
|
|
218
|
+
labelStyle: { color: "var(--color-foreground)" },
|
|
219
|
+
formatter: H
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ N(l, {}),
|
|
222
|
+
/* @__PURE__ */ N(h, {
|
|
223
|
+
type: "monotone",
|
|
224
|
+
dataKey: "band",
|
|
225
|
+
name: C("healthybowl.weather.anomaly.charts.baselineBand", "Baseline range"),
|
|
226
|
+
stroke: "var(--color-border)",
|
|
227
|
+
strokeDasharray: "6 4",
|
|
228
|
+
fill: "var(--color-muted)",
|
|
229
|
+
fillOpacity: .35,
|
|
230
|
+
connectNulls: !0,
|
|
231
|
+
activeDot: !1
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ N(f, {
|
|
234
|
+
dataKey: "current",
|
|
235
|
+
name: C("healthybowl.weather.anomaly.charts.thisSeason", "This season"),
|
|
236
|
+
fill: "var(--color-success)",
|
|
237
|
+
radius: [
|
|
238
|
+
3,
|
|
239
|
+
3,
|
|
240
|
+
0,
|
|
241
|
+
0
|
|
242
|
+
],
|
|
243
|
+
barSize: 18
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ N(m, {
|
|
246
|
+
type: "monotone",
|
|
247
|
+
dataKey: "baselineAvg",
|
|
248
|
+
name: C("healthybowl.weather.anomaly.charts.baselineAvg", "Baseline avg"),
|
|
249
|
+
stroke: "var(--color-text-secondary)",
|
|
250
|
+
strokeWidth: 1.5,
|
|
251
|
+
strokeDasharray: "4 3",
|
|
252
|
+
dot: !1
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
}), /* @__PURE__ */ N(a, {
|
|
258
|
+
title: C("healthybowl.weather.anomaly.charts.temp.title", "Monthly temperature"),
|
|
259
|
+
description: C("healthybowl.weather.anomaly.charts.temp.description", "This season vs the baseline min–max band"),
|
|
260
|
+
children: X.length === 0 ? /* @__PURE__ */ N(U, { label: C("healthybowl.weather.anomaly.charts.noData", "No monthly data yet") }) : /* @__PURE__ */ N(d, {
|
|
261
|
+
width: "100%",
|
|
262
|
+
height: 280,
|
|
263
|
+
children: /* @__PURE__ */ P(v, {
|
|
264
|
+
data: X,
|
|
265
|
+
margin: {
|
|
266
|
+
top: 8,
|
|
267
|
+
right: 16,
|
|
268
|
+
left: 0,
|
|
269
|
+
bottom: 4
|
|
270
|
+
},
|
|
271
|
+
children: [
|
|
272
|
+
/* @__PURE__ */ N(p, {
|
|
273
|
+
strokeDasharray: "3 3",
|
|
274
|
+
className: "stroke-border"
|
|
275
|
+
}),
|
|
276
|
+
/* @__PURE__ */ N(g, {
|
|
277
|
+
dataKey: "month",
|
|
278
|
+
className: "text-xs",
|
|
279
|
+
tick: { fill: "currentColor" }
|
|
280
|
+
}),
|
|
281
|
+
/* @__PURE__ */ N(_, {
|
|
282
|
+
className: "text-xs",
|
|
283
|
+
tick: { fill: "currentColor" },
|
|
284
|
+
tickFormatter: (e) => `${e}°`
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ N(u, {
|
|
287
|
+
contentStyle: I,
|
|
288
|
+
labelStyle: { color: "var(--color-foreground)" },
|
|
289
|
+
formatter: H
|
|
290
|
+
}),
|
|
291
|
+
/* @__PURE__ */ N(l, {}),
|
|
292
|
+
/* @__PURE__ */ N(h, {
|
|
293
|
+
type: "monotone",
|
|
294
|
+
dataKey: "band",
|
|
295
|
+
name: C("healthybowl.weather.anomaly.charts.baselineBand", "Baseline range"),
|
|
296
|
+
stroke: "none",
|
|
297
|
+
fill: "var(--color-success)",
|
|
298
|
+
fillOpacity: .18,
|
|
299
|
+
connectNulls: !0,
|
|
300
|
+
activeDot: !1
|
|
301
|
+
}),
|
|
302
|
+
/* @__PURE__ */ N(m, {
|
|
303
|
+
type: "monotone",
|
|
304
|
+
dataKey: "baselineAvg",
|
|
305
|
+
name: C("healthybowl.weather.anomaly.charts.baselineAvg", "Baseline avg"),
|
|
306
|
+
stroke: "var(--color-text-secondary)",
|
|
307
|
+
strokeWidth: 1.5,
|
|
308
|
+
strokeDasharray: "4 3",
|
|
309
|
+
dot: !1
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ N(m, {
|
|
312
|
+
type: "monotone",
|
|
313
|
+
dataKey: "current",
|
|
314
|
+
name: C("healthybowl.weather.anomaly.charts.thisSeason", "This season"),
|
|
315
|
+
stroke: "var(--color-success)",
|
|
316
|
+
strokeWidth: 2,
|
|
317
|
+
dot: { r: 2 }
|
|
318
|
+
})
|
|
319
|
+
]
|
|
320
|
+
})
|
|
321
|
+
})
|
|
322
|
+
})]
|
|
323
|
+
}),
|
|
324
|
+
/* @__PURE__ */ N(a, {
|
|
325
|
+
title: C("healthybowl.weather.anomaly.callouts.title", "Anomaly callouts"),
|
|
326
|
+
description: C("healthybowl.weather.anomaly.callouts.description", "Notable deviations detected against your baseline"),
|
|
327
|
+
children: W.callouts.length === 0 ? /* @__PURE__ */ N("p", {
|
|
328
|
+
className: "py-6 text-center text-sm text-text-secondary",
|
|
329
|
+
children: C("healthybowl.weather.anomaly.callouts.none", "No anomalies flagged — this season is tracking normally.")
|
|
330
|
+
}) : /* @__PURE__ */ N("ul", {
|
|
331
|
+
className: "divide-y divide-border-subtle",
|
|
332
|
+
children: W.callouts.map((n) => {
|
|
333
|
+
let r = z(n.severity);
|
|
334
|
+
return /* @__PURE__ */ P("li", {
|
|
335
|
+
className: "flex items-center justify-between gap-4 py-3",
|
|
336
|
+
children: [/* @__PURE__ */ P("div", {
|
|
337
|
+
className: "flex min-w-0 items-center gap-3",
|
|
338
|
+
children: [/* @__PURE__ */ N(S, { className: "h-4 w-4 shrink-0 text-warning" }), /* @__PURE__ */ P("div", {
|
|
339
|
+
className: "min-w-0",
|
|
340
|
+
children: [/* @__PURE__ */ N("p", {
|
|
341
|
+
className: "truncate text-sm font-medium text-text-primary",
|
|
342
|
+
children: n.title
|
|
343
|
+
}), n.metric ? /* @__PURE__ */ N("p", {
|
|
344
|
+
className: "text-xs capitalize text-text-secondary",
|
|
345
|
+
children: n.metric.replace(/_/g, " ")
|
|
346
|
+
}) : null]
|
|
347
|
+
})]
|
|
348
|
+
}), /* @__PURE__ */ P("div", {
|
|
349
|
+
className: "flex shrink-0 items-center gap-4",
|
|
350
|
+
children: [/* @__PURE__ */ N("span", {
|
|
351
|
+
className: "hidden text-xs text-text-secondary sm:inline",
|
|
352
|
+
children: t(n.date)
|
|
353
|
+
}), /* @__PURE__ */ N("span", {
|
|
354
|
+
className: e("rounded-full px-2.5 py-0.5 text-xs font-medium", r.className),
|
|
355
|
+
children: r.label
|
|
356
|
+
})]
|
|
357
|
+
})]
|
|
358
|
+
}, n.id);
|
|
359
|
+
})
|
|
360
|
+
})
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ N("p", {
|
|
363
|
+
className: "text-xs text-text-secondary",
|
|
364
|
+
children: C("healthybowl.weather.anomaly.source", "Data source: {{source}} · generated {{when}}", {
|
|
365
|
+
source: W.source,
|
|
366
|
+
when: t(W.generatedAt)
|
|
367
|
+
})
|
|
368
|
+
})
|
|
369
|
+
] }), /* @__PURE__ */ N(o, {
|
|
370
|
+
toasts: w,
|
|
371
|
+
onDismiss: V
|
|
372
|
+
})]
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
function H(e) {
|
|
376
|
+
return Array.isArray(e) ? `${Math.round(e[0])} – ${Math.round(e[1])}` : `${Math.round(e)}`;
|
|
377
|
+
}
|
|
378
|
+
function U({ label: e }) {
|
|
379
|
+
return /* @__PURE__ */ N("div", {
|
|
380
|
+
className: "flex h-[280px] items-center justify-center text-sm text-text-secondary",
|
|
381
|
+
children: e
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
//#endregion
|
|
385
|
+
export { V as WeatherAnomalyReportPage };
|
|
386
|
+
|
|
387
|
+
//# sourceMappingURL=WeatherAnomalyReportPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeatherAnomalyReportPage.js","names":[],"sources":["../../../../src/healthybowl/pages/weather/WeatherAnomalyReportPage.tsx"],"sourcesContent":["/**\n * Seasonal Anomaly Report (BOFF-2892 · roadmap 20 · Historical Weather & Early\n * Warning). Compares the current season against the multi-year climate baseline\n * for the farm site: headline deviation cards (rainfall, temperature, frost days,\n * first-frost date), a monthly rainfall bar chart with the baseline min/max band,\n * a monthly temperature line chart against the baseline band, and the narrative\n * anomaly callouts. Every value is live from `getHealthyBowlWeatherAnomalyReport`\n * — no fabricated numbers; an un-synced farm shows an honest empty state.\n */\nimport { useMemo, type FC } from 'react';\nimport {\n ComposedChart,\n Bar,\n Line,\n Area,\n XAxis,\n YAxis,\n CartesianGrid,\n Tooltip,\n Legend,\n ResponsiveContainer,\n} from 'recharts';\nimport {\n CloudRain,\n Thermometer,\n Snowflake,\n CalendarClock,\n ArrowUp,\n ArrowDown,\n Minus,\n AlertTriangle,\n Printer,\n RefreshCw,\n type LucideIcon,\n} from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { PageLayout, ChartCard, EmptyState, ErrorState, PageLoader } from '../../components';\nimport { ToastContainer } from '../../components/Toast';\nimport { useToast } from '../../hooks/useToast';\nimport {\n useWeatherIntelligence,\n type WeatherAnomalyMonthPoint,\n type WeatherAnomalyCallout,\n} from '../../hooks/useWeatherIntelligence';\nimport { cn, formatDate } from '../../utils/helpers';\n\nconst tooltipStyle = {\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: '8px',\n} as const;\n\n/** Direction glyph for a signed deviation. */\ntype Direction = 'up' | 'down' | 'flat';\n\nconst directionOf = (value: number): Direction => (value > 0 ? 'up' : value < 0 ? 'down' : 'flat');\n\n/**\n * Severity → text-colour class keyed on the *magnitude* of a deviation. Small\n * deviations read as normal (emerald), moderate as amber, large as red. Data-viz\n * palette classes are the accepted exception to the semantic-token rule.\n */\nconst magnitudeColor = (magnitude: number, warn: number, danger: number): string =>\n magnitude >= danger ? 'text-red-600' : magnitude >= warn ? 'text-amber-600' : 'text-emerald-600';\n\n/** Callout severity badge classes (RED | AMBER | GREY, tolerant of high/moderate/low). */\nconst calloutSeverity = (severity: string): { label: string; className: string } => {\n const key = (severity ?? '').toUpperCase();\n if (key === 'RED' || key === 'HIGH') {\n return { label: 'High', className: 'bg-red-100 text-red-700 dark:bg-red-950/40 dark:text-red-300' };\n }\n if (key === 'AMBER' || key === 'MODERATE' || key === 'MEDIUM') {\n return { label: 'Moderate', className: 'bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300' };\n }\n return { label: 'Low', className: 'bg-bg-sunken text-text-secondary' };\n};\n\ninterface DeviationCardProps {\n icon: LucideIcon;\n label: string;\n /** Big headline value, e.g. \"40%\" or \"1.8°C\". */\n headline: string;\n /** Emphasis word, e.g. \"BELOW normal\". */\n emphasis: string;\n /** Sub-line, e.g. \"84mm vs 140mm avg\". */\n detail: string;\n direction: Direction;\n colorClass: string;\n}\n\nconst DeviationCard: FC<DeviationCardProps> = ({\n icon: Icon,\n label,\n headline,\n emphasis,\n detail,\n direction,\n colorClass,\n}) => (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-medium text-text-secondary\">{label}</span>\n <span className=\"flex size-8 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary\">\n <Icon className=\"size-4\" />\n </span>\n </div>\n <div className={cn('mt-2 flex items-baseline gap-1.5', colorClass)}>\n {direction === 'up' && <ArrowUp className=\"size-5 shrink-0\" />}\n {direction === 'down' && <ArrowDown className=\"size-5 shrink-0\" />}\n {direction === 'flat' && <Minus className=\"size-5 shrink-0\" />}\n <span className=\"text-3xl font-semibold tabular-nums\">{headline}</span>\n <span className=\"text-sm font-medium uppercase\">{emphasis}</span>\n </div>\n <p className=\"mt-1 text-xs text-text-secondary\">{detail}</p>\n </div>\n);\n\nexport const WeatherAnomalyReportPage: FC = () => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const { anomaly, loadingAnomaly, errorAnomaly, refetchAnomaly, syncHistory } = useWeatherIntelligence();\n\n // Row shapes for the composed charts: bundle the baseline min/max into a tuple so\n // recharts renders a range Area (the shaded baseline band) behind the current series.\n const rainfallRows = useMemo(\n () =>\n (anomaly?.monthlyRainfall ?? []).map((p: WeatherAnomalyMonthPoint) => ({\n month: p.monthName,\n current: p.currentValue,\n baselineAvg: p.baselineAvg,\n band: [p.baselineMin, p.baselineMax] as [number, number],\n })),\n [anomaly?.monthlyRainfall]\n );\n const temperatureRows = useMemo(\n () =>\n (anomaly?.monthlyTemperature ?? []).map((p: WeatherAnomalyMonthPoint) => ({\n month: p.monthName,\n current: p.currentValue,\n baselineAvg: p.baselineAvg,\n band: [p.baselineMin, p.baselineMax] as [number, number],\n })),\n [anomaly?.monthlyTemperature]\n );\n\n const handleSync = async () => {\n try {\n await syncHistory();\n toast({\n title: t('healthybowl.weather.anomaly.toast.synced.title', 'History synced'),\n description: t(\n 'healthybowl.weather.anomaly.toast.synced.description',\n 'The seasonal anomaly report has been recalculated from the latest archive.'\n ),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.common.error', 'Something went wrong'),\n description: err instanceof Error ? err.message : undefined,\n variant: 'error',\n });\n }\n };\n\n const subtitle = anomaly\n ? t('healthybowl.weather.anomaly.subtitle', 'This season vs {{years}}-year baseline ({{start}}–{{end}})', {\n years: anomaly.baselineYears,\n start: anomaly.startYear,\n end: anomaly.endYear - 1,\n })\n : t('healthybowl.weather.anomaly.subtitleFallback', 'This season vs the multi-year climate baseline');\n\n return (\n <PageLayout\n title={t('healthybowl.weather.anomaly.title', 'Seasonal Anomaly Report')}\n description={subtitle}\n purpose=\"How this season is tracking against your farm's own multi-year climate baseline — is it wetter or drier than normal, warmer or cooler, and is frost arriving earlier than usual. Use it to spot when the weather is deviating from what your crops are used to, so you can adjust irrigation, protect against early frost, and understand an unusual yield.\"\n actions={\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => window.print()}\n className=\"text-text-secondary hover:text-text-primary\"\n >\n <Printer className=\"h-4 w-4\" /> {t('healthybowl.weather.anomaly.actions.print', 'Print')}\n </Button>\n }\n >\n {loadingAnomaly && !anomaly ? (\n <PageLoader />\n ) : errorAnomaly && !anomaly ? (\n <ErrorState onRetry={refetchAnomaly} />\n ) : !anomaly || !anomaly.synced ? (\n <EmptyState\n illustration=\"empty-data\"\n title={t('healthybowl.weather.anomaly.empty.title', 'No baseline yet')}\n description={t(\n 'healthybowl.weather.anomaly.empty.description',\n 'Sync your farm-site weather history to build a multi-year climate baseline. Once synced, this report compares the current season against it.'\n )}\n action={\n <Button onClick={handleSync}>\n <RefreshCw className=\"h-4 w-4\" /> {t('healthybowl.weather.anomaly.empty.sync', 'Sync history')}\n </Button>\n }\n />\n ) : (\n <>\n {/* Deviation stat cards */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <DeviationCard\n icon={CloudRain}\n label={t('healthybowl.weather.anomaly.stats.rainfall.label', 'Rainfall this month')}\n headline={`${Math.abs(Math.round(anomaly.rainfallDeviationPct))}%`}\n emphasis={\n anomaly.rainfallDeviationPct < 0\n ? t('healthybowl.weather.anomaly.stats.rainfall.below', 'below normal')\n : t('healthybowl.weather.anomaly.stats.rainfall.above', 'above normal')\n }\n detail={t('healthybowl.weather.anomaly.stats.rainfall.detail', '{{now}}mm vs {{avg}}mm avg', {\n now: Math.round(anomaly.rainfallThisMonthMm),\n avg: Math.round(anomaly.rainfallBaselineMm),\n })}\n direction={directionOf(anomaly.rainfallDeviationPct)}\n colorClass={magnitudeColor(Math.abs(anomaly.rainfallDeviationPct), 15, 30)}\n />\n <DeviationCard\n icon={Thermometer}\n label={t('healthybowl.weather.anomaly.stats.temp.label', 'Avg temperature')}\n headline={`${anomaly.avgTempDeltaC > 0 ? '+' : ''}${anomaly.avgTempDeltaC.toFixed(1)}°C`}\n emphasis={\n anomaly.avgTempDeltaC > 0\n ? t('healthybowl.weather.anomaly.stats.temp.above', 'above')\n : anomaly.avgTempDeltaC < 0\n ? t('healthybowl.weather.anomaly.stats.temp.below', 'below')\n : t('healthybowl.weather.anomaly.stats.temp.normal', 'normal')\n }\n detail={t('healthybowl.weather.anomaly.stats.temp.detail', 'vs baseline average')}\n direction={directionOf(anomaly.avgTempDeltaC)}\n colorClass={magnitudeColor(Math.abs(anomaly.avgTempDeltaC), 1, 2)}\n />\n <DeviationCard\n icon={Snowflake}\n label={t('healthybowl.weather.anomaly.stats.frost.label', 'Frost days')}\n headline={`${anomaly.frostDaysDelta > 0 ? '+' : ''}${anomaly.frostDaysDelta}`}\n emphasis={t('healthybowl.weather.anomaly.stats.frost.emphasis', 'vs average')}\n detail={t('healthybowl.weather.anomaly.stats.frost.detail', '{{now}} this season vs {{avg}} baseline', {\n now: anomaly.frostDaysThisSeason,\n avg: anomaly.frostDaysBaseline,\n })}\n direction={directionOf(anomaly.frostDaysDelta)}\n colorClass={magnitudeColor(Math.abs(anomaly.frostDaysDelta), 2, 4)}\n />\n <DeviationCard\n icon={CalendarClock}\n label={t('healthybowl.weather.anomaly.stats.firstFrost.label', 'First-frost date')}\n headline={\n anomaly.firstFrostDate\n ? `${Math.abs(anomaly.firstFrostDeltaDays)}`\n : t('healthybowl.weather.anomaly.stats.firstFrost.none', '—')\n }\n emphasis={\n !anomaly.firstFrostDate\n ? t('healthybowl.weather.anomaly.stats.firstFrost.pending', 'not yet')\n : anomaly.firstFrostDeltaDays < 0\n ? t('healthybowl.weather.anomaly.stats.firstFrost.early', 'days early')\n : anomaly.firstFrostDeltaDays > 0\n ? t('healthybowl.weather.anomaly.stats.firstFrost.late', 'days late')\n : t('healthybowl.weather.anomaly.stats.firstFrost.onTime', 'on time')\n }\n detail={\n anomaly.firstFrostDate\n ? t('healthybowl.weather.anomaly.stats.firstFrost.detail', '{{now}} vs {{avg}}', {\n now: formatDate(anomaly.firstFrostDate),\n avg: anomaly.baselineFirstFrostDate ? formatDate(anomaly.baselineFirstFrostDate) : '—',\n })\n : t('healthybowl.weather.anomaly.stats.firstFrost.detailPending', 'No frost recorded yet this season')\n }\n direction={anomaly.firstFrostDate ? directionOf(anomaly.firstFrostDeltaDays) : 'flat'}\n colorClass={\n !anomaly.firstFrostDate\n ? 'text-text-secondary'\n : magnitudeColor(Math.abs(anomaly.firstFrostDeltaDays), 5, 10)\n }\n />\n </div>\n\n {/* Charts */}\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-2\">\n <ChartCard\n title={t('healthybowl.weather.anomaly.charts.rainfall.title', 'Monthly rainfall')}\n description={t(\n 'healthybowl.weather.anomaly.charts.rainfall.description',\n 'This season (bars) vs the baseline min–max band'\n )}\n >\n {rainfallRows.length === 0 ? (\n <NoSeries label={t('healthybowl.weather.anomaly.charts.noData', 'No monthly data yet')} />\n ) : (\n <ResponsiveContainer width=\"100%\" height={280}>\n <ComposedChart data={rainfallRows} margin={{ top: 8, right: 16, left: 0, bottom: 4 }}>\n <CartesianGrid strokeDasharray=\"3 3\" className=\"stroke-border\" />\n <XAxis dataKey=\"month\" className=\"text-xs\" tick={{ fill: 'currentColor' }} />\n <YAxis className=\"text-xs\" tick={{ fill: 'currentColor' }} tickFormatter={(v: number) => `${v}`} />\n <Tooltip\n contentStyle={tooltipStyle}\n labelStyle={{ color: 'var(--color-foreground)' }}\n formatter={formatChartValue}\n />\n <Legend />\n <Area\n type=\"monotone\"\n dataKey=\"band\"\n name={t('healthybowl.weather.anomaly.charts.baselineBand', 'Baseline range')}\n stroke=\"var(--color-border)\"\n strokeDasharray=\"6 4\"\n fill=\"var(--color-muted)\"\n fillOpacity={0.35}\n connectNulls\n activeDot={false}\n />\n <Bar\n dataKey=\"current\"\n name={t('healthybowl.weather.anomaly.charts.thisSeason', 'This season')}\n fill=\"var(--color-success)\"\n radius={[3, 3, 0, 0]}\n barSize={18}\n />\n <Line\n type=\"monotone\"\n dataKey=\"baselineAvg\"\n name={t('healthybowl.weather.anomaly.charts.baselineAvg', 'Baseline avg')}\n stroke=\"var(--color-text-secondary)\"\n strokeWidth={1.5}\n strokeDasharray=\"4 3\"\n dot={false}\n />\n </ComposedChart>\n </ResponsiveContainer>\n )}\n </ChartCard>\n\n <ChartCard\n title={t('healthybowl.weather.anomaly.charts.temp.title', 'Monthly temperature')}\n description={t(\n 'healthybowl.weather.anomaly.charts.temp.description',\n 'This season vs the baseline min–max band'\n )}\n >\n {temperatureRows.length === 0 ? (\n <NoSeries label={t('healthybowl.weather.anomaly.charts.noData', 'No monthly data yet')} />\n ) : (\n <ResponsiveContainer width=\"100%\" height={280}>\n <ComposedChart data={temperatureRows} margin={{ top: 8, right: 16, left: 0, bottom: 4 }}>\n <CartesianGrid strokeDasharray=\"3 3\" className=\"stroke-border\" />\n <XAxis dataKey=\"month\" className=\"text-xs\" tick={{ fill: 'currentColor' }} />\n <YAxis className=\"text-xs\" tick={{ fill: 'currentColor' }} tickFormatter={(v: number) => `${v}°`} />\n <Tooltip\n contentStyle={tooltipStyle}\n labelStyle={{ color: 'var(--color-foreground)' }}\n formatter={formatChartValue}\n />\n <Legend />\n <Area\n type=\"monotone\"\n dataKey=\"band\"\n name={t('healthybowl.weather.anomaly.charts.baselineBand', 'Baseline range')}\n stroke=\"none\"\n fill=\"var(--color-success)\"\n fillOpacity={0.18}\n connectNulls\n activeDot={false}\n />\n <Line\n type=\"monotone\"\n dataKey=\"baselineAvg\"\n name={t('healthybowl.weather.anomaly.charts.baselineAvg', 'Baseline avg')}\n stroke=\"var(--color-text-secondary)\"\n strokeWidth={1.5}\n strokeDasharray=\"4 3\"\n dot={false}\n />\n <Line\n type=\"monotone\"\n dataKey=\"current\"\n name={t('healthybowl.weather.anomaly.charts.thisSeason', 'This season')}\n stroke=\"var(--color-success)\"\n strokeWidth={2}\n dot={{ r: 2 }}\n />\n </ComposedChart>\n </ResponsiveContainer>\n )}\n </ChartCard>\n </div>\n\n {/* Anomaly callouts */}\n <ChartCard\n title={t('healthybowl.weather.anomaly.callouts.title', 'Anomaly callouts')}\n description={t(\n 'healthybowl.weather.anomaly.callouts.description',\n 'Notable deviations detected against your baseline'\n )}\n >\n {anomaly.callouts.length === 0 ? (\n <p className=\"py-6 text-center text-sm text-text-secondary\">\n {t(\n 'healthybowl.weather.anomaly.callouts.none',\n 'No anomalies flagged — this season is tracking normally.'\n )}\n </p>\n ) : (\n <ul className=\"divide-y divide-border-subtle\">\n {anomaly.callouts.map((c: WeatherAnomalyCallout) => {\n const sev = calloutSeverity(c.severity);\n return (\n <li key={c.id} className=\"flex items-center justify-between gap-4 py-3\">\n <div className=\"flex min-w-0 items-center gap-3\">\n <AlertTriangle className=\"h-4 w-4 shrink-0 text-warning\" />\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{c.title}</p>\n {c.metric ? (\n <p className=\"text-xs capitalize text-text-secondary\">{c.metric.replace(/_/g, ' ')}</p>\n ) : null}\n </div>\n </div>\n <div className=\"flex shrink-0 items-center gap-4\">\n <span className=\"hidden text-xs text-text-secondary sm:inline\">{formatDate(c.date)}</span>\n <span className={cn('rounded-full px-2.5 py-0.5 text-xs font-medium', sev.className)}>\n {sev.label}\n </span>\n </div>\n </li>\n );\n })}\n </ul>\n )}\n </ChartCard>\n\n {/* Source caption */}\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.weather.anomaly.source', 'Data source: {{source}} · generated {{when}}', {\n source: anomaly.source,\n when: formatDate(anomaly.generatedAt),\n })}\n </p>\n </>\n )}\n\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </PageLayout>\n );\n};\n\n/** Recharts tooltip/value formatter tolerant of the [min, max] band tuple. */\nfunction formatChartValue(value: number | [number, number]): string {\n if (Array.isArray(value)) {\n return `${Math.round(value[0])} – ${Math.round(value[1])}`;\n }\n return `${Math.round(value)}`;\n}\n\nfunction NoSeries({ label }: { label: string }) {\n return <div className=\"flex h-[280px] items-center justify-center text-sm text-text-secondary\">{label}</div>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAM,IAAe;CACnB,iBAAiB;CACjB,QAAQ;CACR,cAAc;CACf,EAKK,KAAe,MAA8B,IAAQ,IAAI,OAAO,IAAQ,IAAI,SAAS,QAOrF,KAAkB,GAAmB,GAAc,MACvD,KAAa,IAAS,iBAAiB,KAAa,IAAO,mBAAmB,oBAG1E,KAAmB,MAA2D;CAClF,IAAM,KAAO,KAAY,IAAI,aAAa;AAO1C,QANI,MAAQ,SAAS,MAAQ,SACpB;EAAE,OAAO;EAAQ,WAAW;EAAgE,GAEjG,MAAQ,WAAW,MAAQ,cAAc,MAAQ,WAC5C;EAAE,OAAO;EAAY,WAAW;EAAwE,GAE1G;EAAE,OAAO;EAAO,WAAW;EAAoC;GAgBlE,KAA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