@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.
Files changed (41) hide show
  1. package/dist/healthybowl/HealthyBowlRoutes.js +135 -95
  2. package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
  3. package/dist/healthybowl/hooks/useHealthyBowlAccounting.js +316 -0
  4. package/dist/healthybowl/hooks/useHealthyBowlAccounting.js.map +1 -0
  5. package/dist/healthybowl/hooks/useWeatherIntelligence.js +224 -0
  6. package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -0
  7. package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js +297 -0
  8. package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js.map +1 -0
  9. package/dist/healthybowl/pages/financial/ChartOfAccountsPage.js +233 -0
  10. package/dist/healthybowl/pages/financial/ChartOfAccountsPage.js.map +1 -0
  11. package/dist/healthybowl/pages/financial/CostByCropPage.js +365 -0
  12. package/dist/healthybowl/pages/financial/CostByCropPage.js.map +1 -0
  13. package/dist/healthybowl/pages/financial/FarmAccountingPage.js +384 -0
  14. package/dist/healthybowl/pages/financial/FarmAccountingPage.js.map +1 -0
  15. package/dist/healthybowl/pages/financial/FinancialDashboardPage.js +32 -16
  16. package/dist/healthybowl/pages/financial/FinancialDashboardPage.js.map +1 -1
  17. package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +221 -0
  18. package/dist/healthybowl/pages/financial/GeneralLedgerPage.js.map +1 -0
  19. package/dist/healthybowl/pages/financial/JournalEntryModal.js +261 -0
  20. package/dist/healthybowl/pages/financial/JournalEntryModal.js.map +1 -0
  21. package/dist/healthybowl/pages/financial/ProfitLossPage.js +202 -0
  22. package/dist/healthybowl/pages/financial/ProfitLossPage.js.map +1 -0
  23. package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js +258 -0
  24. package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js.map +1 -0
  25. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +255 -0
  26. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -0
  27. package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js +387 -0
  28. package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js.map +1 -0
  29. package/dist/healthybowl/pages/weather/WeatherHistoryPage.js +313 -114
  30. package/dist/healthybowl/pages/weather/WeatherHistoryPage.js.map +1 -1
  31. package/dist/healthybowl/pages/weather/WeatherOverviewPage.js +554 -213
  32. package/dist/healthybowl/pages/weather/WeatherOverviewPage.js.map +1 -1
  33. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +457 -0
  34. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -0
  35. package/dist/healthybowl/utils/download.js +11 -0
  36. package/dist/healthybowl/utils/download.js.map +1 -0
  37. package/dist/healthybowl/utils/helpers.js +11 -8
  38. package/dist/healthybowl/utils/helpers.js.map +1 -1
  39. package/dist/healthybowl/utils/period.js +15 -0
  40. package/dist/healthybowl/utils/period.js.map +1 -0
  41. package/package.json +1 -1
@@ -0,0 +1,258 @@
1
+ import { PageLayout as e } from "../../components/PageLayout.js";
2
+ import { EmptyState as t } from "../../components/EmptyState.js";
3
+ import { ErrorState as n } from "../../components/ErrorState.js";
4
+ import { PageLoader as r } from "../../components/PageLoader.js";
5
+ import { useToast as i } from "../../hooks/useToast.js";
6
+ import "../../components/index.js";
7
+ import { useWeatherIntelligence as a } from "../../hooks/useWeatherIntelligence.js";
8
+ import { useEffect as o, useMemo as s, useState as c } from "react";
9
+ import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
10
+ import { CalendarDays as u, ChevronLeft as d, ChevronRight as f, Snowflake as p } from "lucide-react";
11
+ import { useNavigate as m } from "react-router-dom";
12
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
13
+ import { Button as v } from "@burdenoff/fe-libs/ui";
14
+ //#region src/healthybowl/pages/weather/FrostRiskCalendarPage.tsx
15
+ var y = [
16
+ "Sun",
17
+ "Mon",
18
+ "Tue",
19
+ "Wed",
20
+ "Thu",
21
+ "Fri",
22
+ "Sat"
23
+ ], b = {
24
+ FROST_HIGH: {
25
+ key: "frostHigh",
26
+ label: "Frost - High risk",
27
+ swatch: "bg-red-600",
28
+ block: "bg-red-600 text-white",
29
+ tint: "bg-red-500/10"
30
+ },
31
+ FROST_WATCH: {
32
+ key: "frostWatch",
33
+ label: "Frost - Watch",
34
+ swatch: "bg-amber-500",
35
+ block: "bg-amber-500 text-white",
36
+ tint: "bg-amber-500/10"
37
+ },
38
+ HEAT: {
39
+ key: "heat",
40
+ label: "Heat",
41
+ swatch: "bg-orange-500",
42
+ block: "bg-orange-500 text-white",
43
+ tint: "bg-orange-500/10"
44
+ },
45
+ STORM: {
46
+ key: "storm",
47
+ label: "Storm",
48
+ swatch: "bg-slate-500",
49
+ block: "bg-slate-500 text-white",
50
+ tint: "bg-slate-500/10"
51
+ },
52
+ DISEASE_WINDOW: {
53
+ key: "diseaseWindow",
54
+ label: "Disease-favourable window (DEWS)",
55
+ swatch: "bg-violet-600",
56
+ block: "bg-violet-600 text-white",
57
+ tint: "bg-violet-500/10"
58
+ },
59
+ CLEAR: {
60
+ key: "clear",
61
+ label: "Clear",
62
+ swatch: "bg-emerald-500",
63
+ block: "bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",
64
+ tint: "",
65
+ soft: !0
66
+ },
67
+ UNKNOWN: {
68
+ key: "unknown",
69
+ label: "Unknown",
70
+ swatch: "bg-bg-sunken",
71
+ block: "bg-bg-sunken text-text-secondary",
72
+ tint: "",
73
+ soft: !0
74
+ }
75
+ }, x = [
76
+ "FROST_HIGH",
77
+ "FROST_WATCH",
78
+ "HEAT",
79
+ "DISEASE_WINDOW",
80
+ "STORM",
81
+ "CLEAR",
82
+ "UNKNOWN"
83
+ ], S = (e) => b[e] ?? b.UNKNOWN, C = (e, t, n) => {
84
+ let r = t - 1 + n;
85
+ return {
86
+ year: e + Math.floor(r / 12),
87
+ month: (r % 12 + 12) % 12 + 1
88
+ };
89
+ }, w = (e) => {
90
+ let t = new Date(e);
91
+ return Number.isNaN(t.getTime()) ? e : t.toLocaleDateString("en-US", {
92
+ day: "numeric",
93
+ month: "short"
94
+ });
95
+ }, T = () => {
96
+ let { t: T } = l(), E = m(), { toast: D } = i(), { frostCalendar: O, loadingCalendar: k, errorCalendar: A, refetchCalendar: j, loadCalendar: M } = a(), [N, P] = c(null), [F, I] = c(!1);
97
+ o(() => {
98
+ O && P(O);
99
+ }, [O]);
100
+ let L = N ?? O, R = async (e, t) => {
101
+ I(!0);
102
+ try {
103
+ let n = await M(e, t);
104
+ n ? P(n) : D({
105
+ title: T("healthybowl.weather.calendar.toast.noData.title", "No calendar data"),
106
+ description: T("healthybowl.weather.calendar.toast.noData.description", "No frost-risk data is available for that month yet."),
107
+ variant: "info"
108
+ });
109
+ } catch {
110
+ D({
111
+ title: T("healthybowl.weather.calendar.toast.error.title", "Could not load month"),
112
+ description: T("healthybowl.weather.calendar.toast.error.description", "Something went wrong loading that month. Please try again."),
113
+ variant: "error"
114
+ });
115
+ } finally {
116
+ I(!1);
117
+ }
118
+ }, { weeks: z } = s(() => {
119
+ if (!L) return { weeks: [] };
120
+ let e = /* @__PURE__ */ new Map();
121
+ for (let t of L.days) e.set(t.day, t);
122
+ let t = new Date(L.year, L.month, 0).getDate(), n = new Date(L.year, L.month - 1, 1).getDay(), r = [];
123
+ for (let e = 0; e < n; e += 1) r.push(null);
124
+ for (let n = 1; n <= t; n += 1) r.push(e.get(n) ?? null);
125
+ for (; r.length % 7 != 0;) r.push(null);
126
+ let i = [];
127
+ for (let e = 0; e < r.length; e += 7) i.push(r.slice(e, e + 7));
128
+ return { weeks: i };
129
+ }, [L]), B = L ? C(L.year, L.month, -1) : null, V = L ? C(L.year, L.month, 1) : null, H = /* @__PURE__ */ _("div", {
130
+ className: "flex items-center gap-1 rounded-lg border border-border-subtle bg-bg-surface p-1",
131
+ children: [
132
+ /* @__PURE__ */ g(v, {
133
+ variant: "ghost",
134
+ size: "sm",
135
+ disabled: !B || F,
136
+ onClick: () => B && R(B.year, B.month),
137
+ "aria-label": T("healthybowl.weather.calendar.nav.prev", "Previous month"),
138
+ children: /* @__PURE__ */ g(d, { className: "h-4 w-4" })
139
+ }),
140
+ /* @__PURE__ */ g("span", {
141
+ className: "min-w-[9rem] text-center text-sm font-medium text-text-primary",
142
+ children: L ? `${L.monthName} ${L.year}` : "—"
143
+ }),
144
+ /* @__PURE__ */ g(v, {
145
+ variant: "ghost",
146
+ size: "sm",
147
+ disabled: !V || F,
148
+ onClick: () => V && R(V.year, V.month),
149
+ "aria-label": T("healthybowl.weather.calendar.nav.next", "Next month"),
150
+ children: /* @__PURE__ */ g(f, { className: "h-4 w-4" })
151
+ })
152
+ ]
153
+ });
154
+ return /* @__PURE__ */ _(e, {
155
+ title: T("healthybowl.weather.calendar.title", "Frost-Risk Calendar"),
156
+ description: T("healthybowl.weather.calendar.description", "A month-by-month view of frost, heat, storm and disease-risk days for your farm site."),
157
+ purpose: "A daily risk calendar for your farm site so you can see, at a glance, which nights carry frost danger, which days bring heat or storm stress, and when conditions favour disease — and plan protective action (covers, irrigation, spraying) before the risk arrives.",
158
+ actions: H,
159
+ children: [k && !L ? /* @__PURE__ */ g(r, {}) : A && !L ? /* @__PURE__ */ g(n, { onRetry: j }) : L ? /* @__PURE__ */ _("div", {
160
+ className: "grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1fr)_18rem]",
161
+ children: [/* @__PURE__ */ _("div", {
162
+ className: "relative rounded-lg border border-border-subtle bg-bg-surface p-3 sm:p-4",
163
+ children: [
164
+ F && /* @__PURE__ */ g("div", {
165
+ className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-bg-surface/60",
166
+ children: /* @__PURE__ */ g(r, {})
167
+ }),
168
+ /* @__PURE__ */ g("div", {
169
+ className: "grid grid-cols-7 border-b border-border-subtle pb-2",
170
+ children: y.map((e) => /* @__PURE__ */ g("div", {
171
+ className: "px-1 text-center text-xs font-semibold text-text-secondary",
172
+ children: T(`healthybowl.weather.calendar.weekday.${e.toLowerCase()}`, e)
173
+ }, e))
174
+ }),
175
+ /* @__PURE__ */ g("div", {
176
+ className: "grid grid-cols-7",
177
+ children: z.map((e, t) => e.map((e, n) => {
178
+ let r = e ? S(e.risk) : null;
179
+ return /* @__PURE__ */ g("div", {
180
+ className: `min-h-[6.5rem] border-b border-r border-border-subtle p-1.5 last:border-r-0 ${r ? r.tint : ""} ${e ? "" : "bg-bg-sunken/30"}`,
181
+ title: e?.detail ?? void 0,
182
+ children: e && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", {
183
+ className: "mb-1 text-xs font-semibold text-text-primary",
184
+ children: e.day
185
+ }), r?.soft ? /* @__PURE__ */ _("span", {
186
+ className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${r.block}`,
187
+ children: [/* @__PURE__ */ g("span", { className: `h-1.5 w-1.5 rounded-full ${r.swatch}` }), e.label]
188
+ }) : r && /* @__PURE__ */ _("div", {
189
+ className: `rounded-md px-1.5 py-1 text-center leading-tight ${r.block}`,
190
+ children: [/* @__PURE__ */ g("div", {
191
+ className: "text-[10px] font-semibold uppercase tracking-wide",
192
+ children: e.label
193
+ }), e.tempMin != null && /* @__PURE__ */ _("div", {
194
+ className: "text-[11px] font-bold",
195
+ children: [e.tempMin, "°C"]
196
+ })]
197
+ })] })
198
+ }, `${t}-${n}`);
199
+ }))
200
+ })
201
+ ]
202
+ }), /* @__PURE__ */ _("div", {
203
+ className: "space-y-4",
204
+ children: [/* @__PURE__ */ _("div", {
205
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
206
+ children: [/* @__PURE__ */ g("h3", {
207
+ className: "mb-3 text-sm font-semibold text-text-primary",
208
+ children: T("healthybowl.weather.calendar.legend.title", "Legend")
209
+ }), /* @__PURE__ */ g("ul", {
210
+ className: "space-y-2.5",
211
+ children: x.map((e) => {
212
+ let t = b[e];
213
+ return /* @__PURE__ */ _("li", {
214
+ className: "flex items-center gap-2.5",
215
+ children: [/* @__PURE__ */ g("span", { className: `h-3 w-3 shrink-0 rounded-full ${t.swatch}` }), /* @__PURE__ */ g("span", {
216
+ className: "text-sm text-text-secondary",
217
+ children: T(`healthybowl.weather.calendar.legend.${t.key}`, t.label)
218
+ })]
219
+ }, e);
220
+ })
221
+ })]
222
+ }), /* @__PURE__ */ _("div", {
223
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
224
+ children: [/* @__PURE__ */ _("div", {
225
+ className: "flex items-start gap-3",
226
+ children: [/* @__PURE__ */ g("div", {
227
+ className: "rounded-md bg-bg-sunken p-2",
228
+ children: /* @__PURE__ */ g(p, { className: "h-5 w-5 text-info" })
229
+ }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
230
+ className: "text-2xl font-bold text-text-primary",
231
+ children: L.frostRiskDayCount
232
+ }), /* @__PURE__ */ g("p", {
233
+ className: "text-sm text-text-secondary",
234
+ children: L.frostRiskDayCount === 1 ? T("healthybowl.weather.calendar.summary.frostDaysSingular", "frost-risk day this month") : T("healthybowl.weather.calendar.summary.frostDaysPlural", "frost-risk days this month")
235
+ })] })]
236
+ }), /* @__PURE__ */ g("p", {
237
+ className: "mt-3 border-t border-border-subtle pt-3 text-xs text-text-secondary",
238
+ children: L.historicalFirstFrost ? T("healthybowl.weather.calendar.summary.historicalFirstFrost", "Historical avg first-frost: {{date}}", { date: w(L.historicalFirstFrost) }) : T("healthybowl.weather.calendar.summary.noHistoricalFrost", "No historical first-frost on record for this site.")
239
+ })]
240
+ })]
241
+ })]
242
+ }) : /* @__PURE__ */ g(t, {
243
+ icon: /* @__PURE__ */ g(u, { className: "h-8 w-8" }),
244
+ title: T("healthybowl.weather.calendar.empty.title", "No calendar data"),
245
+ description: T("healthybowl.weather.calendar.empty.description", "Frost-risk data will appear here once your weather history has been synced.")
246
+ }), /* @__PURE__ */ g("div", { children: /* @__PURE__ */ _(v, {
247
+ variant: "ghost",
248
+ size: "sm",
249
+ onClick: () => E(".."),
250
+ className: "gap-1 text-text-secondary hover:text-text-primary",
251
+ children: ["← ", T("healthybowl.weather.calendar.backToDashboard", "Back to Weather Dashboard")]
252
+ }) })]
253
+ });
254
+ };
255
+ //#endregion
256
+ export { T as FrostRiskCalendarPage };
257
+
258
+ //# sourceMappingURL=FrostRiskCalendarPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrostRiskCalendarPage.js","names":[],"sources":["../../../../src/healthybowl/pages/weather/FrostRiskCalendarPage.tsx"],"sourcesContent":["/**\n * Frost-Risk Calendar — month-view grid of daily weather-risk bands (frost,\n * heat, storm, disease-favourable window) for the active farm site, driven by\n * `useWeatherIntelligence().loadCalendar(year, month)` (roadmap #20 / BOFF-2892).\n *\n * The current month loads eagerly (`frostCalendar`); prev/next navigation pages\n * other months through the lazy `loadCalendar`. Every value — the risk band per\n * day, the frost-risk day count and the historical first-frost date — comes from\n * the GraphQL hook; there are no mocked cells.\n * @module healthybowl\n */\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { CalendarDays, ChevronLeft, ChevronRight, Snowflake } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { PageLayout, ErrorState, PageLoader, EmptyState } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useWeatherIntelligence, type FrostRiskCalendar, type FrostRiskDay } from '../../hooks/useWeatherIntelligence';\n\n/** Weekday column headers (Sun-first, matching the grid layout). */\nconst WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as const;\n\n/** Presentation metadata for each risk band (data-viz palette is the accepted exception). */\ninterface RiskMeta {\n /** i18n key suffix for the human label. */\n key: string;\n /** English fallback label. */\n label: string;\n /** Legend swatch colour. */\n swatch: string;\n /** Solid pill/block colour for flagged days. */\n block: string;\n /** Subtle cell background tint. */\n tint: string;\n /** True when the band renders as a soft \"all clear\" pill rather than a solid block. */\n soft?: boolean;\n}\n\nconst RISK_META: Record<string, RiskMeta> = {\n FROST_HIGH: {\n key: 'frostHigh',\n label: 'Frost - High risk',\n swatch: 'bg-red-600',\n block: 'bg-red-600 text-white',\n tint: 'bg-red-500/10',\n },\n FROST_WATCH: {\n key: 'frostWatch',\n label: 'Frost - Watch',\n swatch: 'bg-amber-500',\n block: 'bg-amber-500 text-white',\n tint: 'bg-amber-500/10',\n },\n HEAT: {\n key: 'heat',\n label: 'Heat',\n swatch: 'bg-orange-500',\n block: 'bg-orange-500 text-white',\n tint: 'bg-orange-500/10',\n },\n STORM: {\n key: 'storm',\n label: 'Storm',\n swatch: 'bg-slate-500',\n block: 'bg-slate-500 text-white',\n tint: 'bg-slate-500/10',\n },\n DISEASE_WINDOW: {\n key: 'diseaseWindow',\n label: 'Disease-favourable window (DEWS)',\n swatch: 'bg-violet-600',\n block: 'bg-violet-600 text-white',\n tint: 'bg-violet-500/10',\n },\n CLEAR: {\n key: 'clear',\n label: 'Clear',\n swatch: 'bg-emerald-500',\n block: 'bg-emerald-500/15 text-emerald-700 dark:text-emerald-300',\n tint: '',\n soft: true,\n },\n UNKNOWN: {\n key: 'unknown',\n label: 'Unknown',\n swatch: 'bg-bg-sunken',\n block: 'bg-bg-sunken text-text-secondary',\n tint: '',\n soft: true,\n },\n};\n\n/** Legend order (all bands, matching the mock). */\nconst LEGEND_ORDER = ['FROST_HIGH', 'FROST_WATCH', 'HEAT', 'DISEASE_WINDOW', 'STORM', 'CLEAR', 'UNKNOWN'] as const;\n\nconst metaFor = (risk: string): RiskMeta => RISK_META[risk] ?? RISK_META.UNKNOWN;\n\n/** Compute the {year, month} one step before/after the given month (1-indexed). */\nconst stepMonth = (year: number, month: number, delta: number): { year: number; month: number } => {\n const zero = month - 1 + delta;\n const y = year + Math.floor(zero / 12);\n const m = ((zero % 12) + 12) % 12;\n return { year: y, month: m + 1 };\n};\n\nconst formatFirstFrost = (iso: string): string => {\n const d = new Date(iso);\n return Number.isNaN(d.getTime()) ? iso : d.toLocaleDateString('en-US', { day: 'numeric', month: 'short' });\n};\n\nexport const FrostRiskCalendarPage: FC = () => {\n const { t } = useI18n();\n const navigate = useNavigate();\n const { toast } = useToast();\n const { frostCalendar, loadingCalendar, errorCalendar, refetchCalendar, loadCalendar } = useWeatherIntelligence();\n\n // Locally-tracked displayed month: seeded by the eager current-month query,\n // then advanced through the lazy loader on prev/next navigation.\n const [calendar, setCalendar] = useState<FrostRiskCalendar | null>(null);\n const [navLoading, setNavLoading] = useState(false);\n\n useEffect(() => {\n if (frostCalendar) setCalendar(frostCalendar);\n }, [frostCalendar]);\n\n const active = calendar ?? frostCalendar;\n\n const goToMonth = async (year: number, month: number) => {\n setNavLoading(true);\n try {\n const next = await loadCalendar(year, month);\n if (next) setCalendar(next);\n else\n toast({\n title: t('healthybowl.weather.calendar.toast.noData.title', 'No calendar data'),\n description: t(\n 'healthybowl.weather.calendar.toast.noData.description',\n 'No frost-risk data is available for that month yet.'\n ),\n variant: 'info',\n });\n } catch {\n toast({\n title: t('healthybowl.weather.calendar.toast.error.title', 'Could not load month'),\n description: t(\n 'healthybowl.weather.calendar.toast.error.description',\n 'Something went wrong loading that month. Please try again.'\n ),\n variant: 'error',\n });\n } finally {\n setNavLoading(false);\n }\n };\n\n // Map day-of-month → cell, and lay out the month into weeks (leading blanks\n // for the first weekday). Derived purely from the loaded calendar.\n const { weeks } = useMemo(() => {\n if (!active) return { weeks: [] as (FrostRiskDay | null)[][] };\n const byDay = new Map<number, FrostRiskDay>();\n for (const d of active.days) byDay.set(d.day, d);\n const daysInMonth = new Date(active.year, active.month, 0).getDate();\n const firstWeekday = new Date(active.year, active.month - 1, 1).getDay(); // 0=Sun\n const cells: (FrostRiskDay | null)[] = [];\n for (let i = 0; i < firstWeekday; i += 1) cells.push(null);\n for (let day = 1; day <= daysInMonth; day += 1) cells.push(byDay.get(day) ?? null);\n while (cells.length % 7 !== 0) cells.push(null);\n const rows: (FrostRiskDay | null)[][] = [];\n for (let i = 0; i < cells.length; i += 7) rows.push(cells.slice(i, i + 7));\n return { weeks: rows };\n }, [active]);\n\n const prev = active ? stepMonth(active.year, active.month, -1) : null;\n const next = active ? stepMonth(active.year, active.month, 1) : null;\n\n const monthNav = (\n <div className=\"flex items-center gap-1 rounded-lg border border-border-subtle bg-bg-surface p-1\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={!prev || navLoading}\n onClick={() => prev && goToMonth(prev.year, prev.month)}\n aria-label={t('healthybowl.weather.calendar.nav.prev', 'Previous month')}\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </Button>\n <span className=\"min-w-[9rem] text-center text-sm font-medium text-text-primary\">\n {active ? `${active.monthName} ${active.year}` : '—'}\n </span>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={!next || navLoading}\n onClick={() => next && goToMonth(next.year, next.month)}\n aria-label={t('healthybowl.weather.calendar.nav.next', 'Next month')}\n >\n <ChevronRight className=\"h-4 w-4\" />\n </Button>\n </div>\n );\n\n return (\n <PageLayout\n title={t('healthybowl.weather.calendar.title', 'Frost-Risk Calendar')}\n description={t(\n 'healthybowl.weather.calendar.description',\n 'A month-by-month view of frost, heat, storm and disease-risk days for your farm site.'\n )}\n purpose=\"A daily risk calendar for your farm site so you can see, at a glance, which nights carry frost danger, which days bring heat or storm stress, and when conditions favour disease — and plan protective action (covers, irrigation, spraying) before the risk arrives.\"\n actions={monthNav}\n >\n {loadingCalendar && !active ? (\n <PageLoader />\n ) : errorCalendar && !active ? (\n <ErrorState onRetry={refetchCalendar} />\n ) : !active ? (\n <EmptyState\n icon={<CalendarDays className=\"h-8 w-8\" />}\n title={t('healthybowl.weather.calendar.empty.title', 'No calendar data')}\n description={t(\n 'healthybowl.weather.calendar.empty.description',\n 'Frost-risk data will appear here once your weather history has been synced.'\n )}\n />\n ) : (\n <div className=\"grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1fr)_18rem]\">\n {/* Calendar grid */}\n <div className=\"relative rounded-lg border border-border-subtle bg-bg-surface p-3 sm:p-4\">\n {navLoading && (\n <div className=\"absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-bg-surface/60\">\n <PageLoader />\n </div>\n )}\n {/* Weekday header */}\n <div className=\"grid grid-cols-7 border-b border-border-subtle pb-2\">\n {WEEKDAYS.map((wd) => (\n <div key={wd} className=\"px-1 text-center text-xs font-semibold text-text-secondary\">\n {t(`healthybowl.weather.calendar.weekday.${wd.toLowerCase()}`, wd)}\n </div>\n ))}\n </div>\n {/* Weeks */}\n <div className=\"grid grid-cols-7\">\n {weeks.map((week, wi) =>\n week.map((cell, ci) => {\n const meta = cell ? metaFor(cell.risk) : null;\n return (\n <div\n key={`${wi}-${ci}`}\n className={`min-h-[6.5rem] border-b border-r border-border-subtle p-1.5 last:border-r-0 ${\n meta ? meta.tint : ''\n } ${!cell ? 'bg-bg-sunken/30' : ''}`}\n title={cell?.detail ?? undefined}\n >\n {cell && (\n <>\n <div className=\"mb-1 text-xs font-semibold text-text-primary\">{cell.day}</div>\n {meta?.soft ? (\n <span\n className={`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${meta.block}`}\n >\n <span className={`h-1.5 w-1.5 rounded-full ${meta.swatch}`} />\n {cell.label}\n </span>\n ) : (\n meta && (\n <div className={`rounded-md px-1.5 py-1 text-center leading-tight ${meta.block}`}>\n <div className=\"text-[10px] font-semibold uppercase tracking-wide\">{cell.label}</div>\n {cell.tempMin != null && <div className=\"text-[11px] font-bold\">{cell.tempMin}°C</div>}\n </div>\n )\n )}\n </>\n )}\n </div>\n );\n })\n )}\n </div>\n </div>\n\n {/* Legend + summary rail */}\n <div className=\"space-y-4\">\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">\n {t('healthybowl.weather.calendar.legend.title', 'Legend')}\n </h3>\n <ul className=\"space-y-2.5\">\n {LEGEND_ORDER.map((risk) => {\n const meta = RISK_META[risk];\n return (\n <li key={risk} className=\"flex items-center gap-2.5\">\n <span className={`h-3 w-3 shrink-0 rounded-full ${meta.swatch}`} />\n <span className=\"text-sm text-text-secondary\">\n {t(`healthybowl.weather.calendar.legend.${meta.key}`, meta.label)}\n </span>\n </li>\n );\n })}\n </ul>\n </div>\n\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"flex items-start gap-3\">\n <div className=\"rounded-md bg-bg-sunken p-2\">\n <Snowflake className=\"h-5 w-5 text-info\" />\n </div>\n <div>\n <p className=\"text-2xl font-bold text-text-primary\">{active.frostRiskDayCount}</p>\n <p className=\"text-sm text-text-secondary\">\n {active.frostRiskDayCount === 1\n ? t('healthybowl.weather.calendar.summary.frostDaysSingular', 'frost-risk day this month')\n : t('healthybowl.weather.calendar.summary.frostDaysPlural', 'frost-risk days this month')}\n </p>\n </div>\n </div>\n <p className=\"mt-3 border-t border-border-subtle pt-3 text-xs text-text-secondary\">\n {active.historicalFirstFrost\n ? t(\n 'healthybowl.weather.calendar.summary.historicalFirstFrost',\n 'Historical avg first-frost: {{date}}',\n { date: formatFirstFrost(active.historicalFirstFrost) }\n )\n : t(\n 'healthybowl.weather.calendar.summary.noHistoricalFrost',\n 'No historical first-frost on record for this site.'\n )}\n </p>\n </div>\n </div>\n </div>\n )}\n\n {/* Back nav */}\n <div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate('..')}\n className=\"gap-1 text-text-secondary hover:text-text-primary\"\n >\n &larr; {t('healthybowl.weather.calendar.backToDashboard', 'Back to Weather Dashboard')}\n </Button>\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAM,IAAW;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;CAAM,EAkB5D,IAAsC;CAC1C,YA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D;OAAK,WAAU;iBACb,kBAAC,GAAD,EAAW,WAAU,qBAAsB,CAAA;OACvC,CAAA,EACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;OAAG,WAAU;iBAAwC,EAAO;OAAsB,CAAA,EAClF,kBAAC,KAAD;OAAG,WAAU;iBACV,EAAO,sBAAsB,IAC1B,EAAE,0DAA0D,4BAA4B,GACxF,EAAE,wDAAwD,6BAA6B;OACzF,CAAA,CACA,EAAA,CAAA,CACF;SACN,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAO,uBACJ,EACE,6DACA,wCACA,EAAE,MAAM,EAAiB,EAAO,qBAAqB,EAAE,CACxD,GACD,EACE,0DACA,qDACD;MACH,CAAA,CACA;OACF;MACF;OAlHN,kBAAC,GAAD;GACE,MAAM,kBAAC,GAAD,EAAc,WAAU,WAAY,CAAA;GAC1C,OAAO,EAAE,4CAA4C,mBAAmB;GACxE,aAAa,EACX,kDACA,8EACD;GACD,CAAA,EA+GJ,kBAAC,OAAD,EAAA,UACE,kBAAC,GAAD;GACE,SAAQ;GACR,MAAK;GACL,eAAe,EAAS,KAAK;GAC7B,WAAU;aAJZ,CAKC,MACS,EAAE,gDAAgD,4BAA4B,CAC/E;MACL,CAAA,CACK"}
@@ -0,0 +1,255 @@
1
+ import { getRelativeTime as e } from "../../utils/helpers.js";
2
+ import { PageLayout as t } from "../../components/PageLayout.js";
3
+ import { StatusBadge as n } from "../../components/StatusBadge.js";
4
+ import { EmptyState as r } from "../../components/EmptyState.js";
5
+ import { ErrorState as i } from "../../components/ErrorState.js";
6
+ import { ToastContainer as a } from "../../components/Toast.js";
7
+ import { PageLoader as o } from "../../components/PageLoader.js";
8
+ import { useToast as s } from "../../hooks/useToast.js";
9
+ import "../../components/index.js";
10
+ import { useWeatherIntelligence as c } from "../../hooks/useWeatherIntelligence.js";
11
+ import { useCallback as l, useState as u } from "react";
12
+ import { useI18n as d } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
+ import { AlertTriangle as f, BellRing as p, Bug as m, Check as h, Clock as g, Cloud as _, CloudRain as v, Send as y, Snowflake as b, Sun as x } from "lucide-react";
14
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
15
+ import { Button as w } from "@burdenoff/fe-libs/ui";
16
+ //#region src/healthybowl/pages/weather/WeatherAlertHistoryPage.tsx
17
+ var T = [
18
+ "ALL",
19
+ "FROST",
20
+ "STORM",
21
+ "HEAT"
22
+ ], E = (e) => {
23
+ switch (e) {
24
+ case "RED": return "bg-red-600 text-white";
25
+ case "AMBER": return "bg-amber-500 text-white";
26
+ default: return "bg-slate-500 text-white";
27
+ }
28
+ }, D = (e, t) => {
29
+ switch (e) {
30
+ case "FROST": return /* @__PURE__ */ S(b, { className: t });
31
+ case "STORM": return /* @__PURE__ */ S(v, { className: t });
32
+ case "HEAT": return /* @__PURE__ */ S(x, { className: t });
33
+ case "DISEASE": return /* @__PURE__ */ S(m, { className: t });
34
+ default: return /* @__PURE__ */ S(_, { className: t });
35
+ }
36
+ }, O = (e) => {
37
+ let t = e.toLowerCase();
38
+ return t === "in_app" || t === "inapp" || t === "in-app" ? "In-app" : t === "sms" ? "SMS" : t === "email" ? "Email" : t === "webhook" ? "Webhook" : t === "push" ? "Push" : e.charAt(0).toUpperCase() + e.slice(1);
39
+ }, k = () => {
40
+ let { t: m } = d(), { toasts: _, toast: v, dismiss: b } = s(), { alertEvents: x, loadingEvents: k, errorEvents: A, refetchEvents: j, loadEvents: M, markHandled: N, snooze: P } = c(), [F, I] = u("ALL"), [L, R] = u(null), [z, B] = u(!1), [V, H] = u(null), U = F === "ALL" ? x : L ?? [], W = l(async (e) => {
41
+ if (I(e), e === "ALL") {
42
+ R(null);
43
+ return;
44
+ }
45
+ B(!0);
46
+ try {
47
+ R(await M({ alertType: e }));
48
+ } catch (e) {
49
+ v({
50
+ title: m("healthybowl.weather.alertHistory.toast.loadError.title", "Could not load alerts"),
51
+ description: e instanceof Error ? e.message : void 0,
52
+ variant: "error"
53
+ }), R([]);
54
+ } finally {
55
+ B(!1);
56
+ }
57
+ }, [
58
+ M,
59
+ m,
60
+ v
61
+ ]), G = l(async () => {
62
+ F !== "ALL" && R(await M({ alertType: F }));
63
+ }, [F, M]), K = l(async (e) => {
64
+ H(e.id);
65
+ try {
66
+ await N(e.id), await G(), v({
67
+ title: m("healthybowl.weather.alertHistory.toast.handled.title", "Alert marked as handled"),
68
+ variant: "success"
69
+ });
70
+ } catch (e) {
71
+ v({
72
+ title: m("healthybowl.weather.alertHistory.toast.error.title", "Could not update alert"),
73
+ description: e instanceof Error ? e.message : void 0,
74
+ variant: "error"
75
+ });
76
+ } finally {
77
+ H(null);
78
+ }
79
+ }, [
80
+ N,
81
+ G,
82
+ m,
83
+ v
84
+ ]), q = l(async (e) => {
85
+ let t = new Date(Date.now() + 1440 * 60 * 1e3).toISOString();
86
+ H(e.id);
87
+ try {
88
+ await P(e.id, t), await G(), v({
89
+ title: m("healthybowl.weather.alertHistory.toast.snoozed.title", "Alert snoozed for 1 day"),
90
+ variant: "success"
91
+ });
92
+ } catch (e) {
93
+ v({
94
+ title: m("healthybowl.weather.alertHistory.toast.error.title", "Could not update alert"),
95
+ description: e instanceof Error ? e.message : void 0,
96
+ variant: "error"
97
+ });
98
+ } finally {
99
+ H(null);
100
+ }
101
+ }, [
102
+ P,
103
+ G,
104
+ m,
105
+ v
106
+ ]), J = (e) => {
107
+ switch (e) {
108
+ case "handled": return /* @__PURE__ */ S(n, {
109
+ label: m("healthybowl.weather.alertHistory.status.handled", "Handled ✓"),
110
+ variant: "success"
111
+ });
112
+ case "snoozed": return /* @__PURE__ */ S(n, {
113
+ label: m("healthybowl.weather.alertHistory.status.snoozed", "Snoozed"),
114
+ variant: "warning"
115
+ });
116
+ default: return /* @__PURE__ */ S(n, {
117
+ label: m("healthybowl.weather.alertHistory.status.delivered", "Delivered"),
118
+ variant: "muted"
119
+ });
120
+ }
121
+ }, Y = (e) => {
122
+ switch (e) {
123
+ case "ALL": return m("healthybowl.weather.alertHistory.filter.all", "All");
124
+ case "FROST": return m("healthybowl.weather.alertHistory.filter.frost", "Frost");
125
+ case "STORM": return m("healthybowl.weather.alertHistory.filter.storm", "Storm");
126
+ case "HEAT": return m("healthybowl.weather.alertHistory.filter.heat", "Heat");
127
+ default: return e;
128
+ }
129
+ }, X = k && x.length === 0, Z = A && x.length === 0;
130
+ return /* @__PURE__ */ C(t, {
131
+ title: m("healthybowl.weather.alertHistory.title", "Alert History"),
132
+ description: m("healthybowl.weather.alertHistory.description", "Weather early-warnings triggered for this farm"),
133
+ purpose: "Every weather early-warning that has fired for your farm — frost, storm, heat and disease alerts — in one timeline. See what was sent, through which channels and when, then mark an alert as handled or snooze it for a day once you've acted.",
134
+ children: [X ? /* @__PURE__ */ S(o, {}) : Z ? /* @__PURE__ */ S(i, { onRetry: () => void j() }) : /* @__PURE__ */ C("div", {
135
+ className: "space-y-6",
136
+ children: [
137
+ /* @__PURE__ */ S("div", {
138
+ className: "flex flex-wrap items-center gap-1 border-b border-border-subtle",
139
+ children: T.map((e) => /* @__PURE__ */ S("button", {
140
+ type: "button",
141
+ onClick: () => void W(e),
142
+ className: `border-b-2 px-3 pb-2 text-sm font-medium transition-colors ${F === e ? "border-primary text-primary" : "border-transparent text-text-secondary hover:text-text-primary"}`,
143
+ children: Y(e)
144
+ }, e))
145
+ }),
146
+ z ? /* @__PURE__ */ S(o, {}) : U.length === 0 ? /* @__PURE__ */ S(r, {
147
+ icon: /* @__PURE__ */ S(p, { className: "h-6 w-6 text-text-secondary" }),
148
+ title: m("healthybowl.weather.alertHistory.empty.title", "No weather alerts yet"),
149
+ description: m("healthybowl.weather.alertHistory.empty.description", "Alerts appear here the moment one of your early-warning rules crosses its threshold — frost tonight, a storm tomorrow or a heat spike. Nothing has fired for this filter yet.")
150
+ }) : /* @__PURE__ */ C("ol", {
151
+ className: "relative space-y-4 sm:pl-6",
152
+ children: [/* @__PURE__ */ S("span", {
153
+ "aria-hidden": !0,
154
+ className: "absolute left-2 top-2 bottom-2 hidden w-px bg-border-subtle sm:block"
155
+ }), U.map((t) => {
156
+ let n = V === t.id, r = t.status === "handled";
157
+ return /* @__PURE__ */ C("li", {
158
+ className: "relative",
159
+ children: [/* @__PURE__ */ S("span", {
160
+ "aria-hidden": !0,
161
+ className: "absolute -left-[1.375rem] top-6 hidden h-2.5 w-2.5 rounded-full border-2 border-bg-canvas bg-border-subtle sm:block"
162
+ }), /* @__PURE__ */ C("div", {
163
+ className: "flex overflow-hidden rounded-xl border border-border-subtle bg-bg-surface",
164
+ children: [/* @__PURE__ */ C("div", {
165
+ className: `flex w-20 shrink-0 flex-col items-center justify-center gap-1 py-4 ${E(t.severity)}`,
166
+ children: [D(t.alertType, "h-6 w-6"), /* @__PURE__ */ S("span", {
167
+ className: "text-xs font-semibold tracking-wide",
168
+ children: t.severity
169
+ })]
170
+ }), /* @__PURE__ */ C("div", {
171
+ className: "min-w-0 flex-1 p-4",
172
+ children: [
173
+ /* @__PURE__ */ C("div", {
174
+ className: "flex flex-wrap items-start justify-between gap-2",
175
+ children: [/* @__PURE__ */ C("h3", {
176
+ className: "flex items-center gap-1.5 text-sm font-semibold text-text-primary",
177
+ children: [/* @__PURE__ */ S("span", {
178
+ className: "text-text-secondary",
179
+ children: D(t.alertType, "h-4 w-4")
180
+ }), t.title]
181
+ }), J(t.status)]
182
+ }),
183
+ t.advisory && /* @__PURE__ */ S("p", {
184
+ className: "mt-1 text-sm text-text-secondary",
185
+ children: t.advisory
186
+ }),
187
+ t.observedValue != null && t.threshold != null && /* @__PURE__ */ C("p", {
188
+ className: "mt-1 flex items-center gap-1 text-xs text-text-secondary",
189
+ children: [/* @__PURE__ */ S(f, { className: "h-3.5 w-3.5 text-warning" }), m("healthybowl.weather.alertHistory.metric", "{{metric}} {{observed}}{{unit}} · threshold {{threshold}}{{unit}}", {
190
+ metric: t.metric,
191
+ observed: t.observedValue,
192
+ threshold: t.threshold,
193
+ unit: t.unit ?? ""
194
+ })]
195
+ }),
196
+ /* @__PURE__ */ C("p", {
197
+ className: "mt-2 flex flex-wrap items-center gap-1 text-xs text-text-secondary",
198
+ children: [
199
+ /* @__PURE__ */ S(y, { className: "h-3.5 w-3.5" }),
200
+ t.channels.length > 0 ? m("healthybowl.weather.alertHistory.sentVia", "Sent via {{channels}} · {{when}}", {
201
+ channels: t.channels.map(O).join(" + "),
202
+ when: e(t.triggeredAt)
203
+ }) : m("healthybowl.weather.alertHistory.triggered", "Triggered {{when}}", { when: e(t.triggeredAt) }),
204
+ t.status === "snoozed" && t.snoozedUntil && /* @__PURE__ */ C("span", {
205
+ className: "inline-flex items-center gap-1 text-warning",
206
+ children: [
207
+ "· ",
208
+ /* @__PURE__ */ S(g, { className: "h-3.5 w-3.5" }),
209
+ m("healthybowl.weather.alertHistory.snoozedUntil", "snoozed until {{when}}", { when: e(t.snoozedUntil) })
210
+ ]
211
+ })
212
+ ]
213
+ }),
214
+ t.ruleName && /* @__PURE__ */ S("p", {
215
+ className: "mt-1 text-[11px] text-text-secondary",
216
+ children: m("healthybowl.weather.alertHistory.rule", "Rule: {{name}}", { name: t.ruleName })
217
+ }),
218
+ /* @__PURE__ */ C("div", {
219
+ className: "mt-3 flex flex-wrap items-center gap-2",
220
+ children: [!r && /* @__PURE__ */ C(w, {
221
+ variant: "outline",
222
+ size: "sm",
223
+ onClick: () => void K(t),
224
+ disabled: n,
225
+ children: [/* @__PURE__ */ S(h, { className: "h-3.5 w-3.5" }), m("healthybowl.weather.alertHistory.actions.markHandled", "Mark as handled")]
226
+ }), /* @__PURE__ */ C(w, {
227
+ variant: "ghost",
228
+ size: "sm",
229
+ onClick: () => void q(t),
230
+ disabled: n,
231
+ className: "text-text-secondary hover:text-text-primary",
232
+ children: [/* @__PURE__ */ S(g, { className: "h-3.5 w-3.5" }), m("healthybowl.weather.alertHistory.actions.snooze", "Snooze 1 day")]
233
+ })]
234
+ })
235
+ ]
236
+ })]
237
+ })]
238
+ }, t.id);
239
+ })]
240
+ }),
241
+ k && x.length > 0 && F === "ALL" && /* @__PURE__ */ S("p", {
242
+ className: "text-center text-[11px] text-text-secondary",
243
+ children: m("healthybowl.weather.alertHistory.refreshing", "Refreshing…")
244
+ })
245
+ ]
246
+ }), /* @__PURE__ */ S(a, {
247
+ toasts: _,
248
+ onDismiss: b
249
+ })]
250
+ });
251
+ };
252
+ //#endregion
253
+ export { k as WeatherAlertHistoryPage };
254
+
255
+ //# sourceMappingURL=WeatherAlertHistoryPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WeatherAlertHistoryPage.js","names":[],"sources":["../../../../src/healthybowl/pages/weather/WeatherAlertHistoryPage.tsx"],"sourcesContent":["/**\n * Weather Alert History — timeline feed of fired weather early-warnings\n * (roadmap #20 · BOFF-2892, Historical Weather & Early Warning).\n *\n * An honest, read-side feed of every weather alert that has fired for this farm:\n * frost / storm / heat / disease warnings raised when a rule crossed its\n * threshold. Each row shows the severity band (RED / AMBER / GREY), the alert\n * type, the advisory, the delivery channels + when it was sent, and its\n * lifecycle status (delivered / handled / snoozed). Farmers can mark an alert as\n * handled or snooze it for a day. Everything is live from the weather-intelligence\n * GraphQL API via {@link useWeatherIntelligence} — no fabricated events; a farm\n * whose rules have never fired shows an honest empty state.\n * @module healthybowl\n */\nimport { useCallback, useState, type FC } from 'react';\nimport { Snowflake, CloudRain, Sun, Bug, Cloud, AlertTriangle, Check, Clock, Send, BellRing } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { PageLayout, StatusBadge, EmptyState, ErrorState, PageLoader } from '../../components';\nimport { ToastContainer } from '../../components/Toast';\nimport { useToast } from '../../hooks/useToast';\nimport { useWeatherIntelligence, type WeatherAlertEvent } from '../../hooks/useWeatherIntelligence';\nimport { getRelativeTime } from '../../utils/helpers';\n\n// ── Filter tabs ────────────────────────────────────────────────────────────────\nconst FILTERS = ['ALL', 'FROST', 'STORM', 'HEAT'] as const;\ntype Filter = (typeof FILTERS)[number];\n\n// ── Severity tile styling (data-viz/severity palette exception) ──────────────────\nconst severityTileClass = (severity: string): string => {\n switch (severity) {\n case 'RED':\n return 'bg-red-600 text-white';\n case 'AMBER':\n return 'bg-amber-500 text-white';\n case 'GREY':\n default:\n return 'bg-slate-500 text-white';\n }\n};\n\nconst alertTypeIcon = (alertType: string, className: string) => {\n switch (alertType) {\n case 'FROST':\n return <Snowflake className={className} />;\n case 'STORM':\n return <CloudRain className={className} />;\n case 'HEAT':\n return <Sun className={className} />;\n case 'DISEASE':\n return <Bug className={className} />;\n default:\n return <Cloud className={className} />;\n }\n};\n\n// Humanise a delivery-channel key (e.g. \"in_app\" → \"In-app\", \"sms\" → \"SMS\").\nconst channelLabel = (channel: string): string => {\n const key = channel.toLowerCase();\n if (key === 'in_app' || key === 'inapp' || key === 'in-app') return 'In-app';\n if (key === 'sms') return 'SMS';\n if (key === 'email') return 'Email';\n if (key === 'webhook') return 'Webhook';\n if (key === 'push') return 'Push';\n return channel.charAt(0).toUpperCase() + channel.slice(1);\n};\n\nexport const WeatherAlertHistoryPage: FC = () => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const { alertEvents, loadingEvents, errorEvents, refetchEvents, loadEvents, markHandled, snooze } =\n useWeatherIntelligence();\n\n const [filter, setFilter] = useState<Filter>('ALL');\n // `null` → show the eager, unfiltered `alertEvents`; otherwise a filtered result set.\n const [filtered, setFiltered] = useState<WeatherAlertEvent[] | null>(null);\n const [switching, setSwitching] = useState(false);\n const [busyId, setBusyId] = useState<string | null>(null);\n\n const events = filter === 'ALL' ? alertEvents : (filtered ?? []);\n\n const selectFilter = useCallback(\n async (next: Filter) => {\n setFilter(next);\n if (next === 'ALL') {\n setFiltered(null);\n return;\n }\n setSwitching(true);\n try {\n const result = await loadEvents({ alertType: next });\n setFiltered(result);\n } catch (err) {\n toast({\n title: t('healthybowl.weather.alertHistory.toast.loadError.title', 'Could not load alerts'),\n description: err instanceof Error ? err.message : undefined,\n variant: 'error',\n });\n setFiltered([]);\n } finally {\n setSwitching(false);\n }\n },\n [loadEvents, t, toast]\n );\n\n // After a mutation, keep the currently-shown list in sync. On the ALL tab the\n // hook's own refetch updates `alertEvents`; on a filtered tab we re-run the\n // filtered query so the row's new status is reflected.\n const reloadFilteredIfNeeded = useCallback(async () => {\n if (filter === 'ALL') return;\n const result = await loadEvents({ alertType: filter });\n setFiltered(result);\n }, [filter, loadEvents]);\n\n const handleMarkHandled = useCallback(\n async (event: WeatherAlertEvent) => {\n setBusyId(event.id);\n try {\n await markHandled(event.id);\n await reloadFilteredIfNeeded();\n toast({\n title: t('healthybowl.weather.alertHistory.toast.handled.title', 'Alert marked as handled'),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.weather.alertHistory.toast.error.title', 'Could not update alert'),\n description: err instanceof Error ? err.message : undefined,\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n },\n [markHandled, reloadFilteredIfNeeded, t, toast]\n );\n\n const handleSnooze = useCallback(\n async (event: WeatherAlertEvent) => {\n const tomorrowISO = new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString();\n setBusyId(event.id);\n try {\n await snooze(event.id, tomorrowISO);\n await reloadFilteredIfNeeded();\n toast({\n title: t('healthybowl.weather.alertHistory.toast.snoozed.title', 'Alert snoozed for 1 day'),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.weather.alertHistory.toast.error.title', 'Could not update alert'),\n description: err instanceof Error ? err.message : undefined,\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n },\n [snooze, reloadFilteredIfNeeded, t, toast]\n );\n\n const statusBadge = (status: string) => {\n switch (status) {\n case 'handled':\n return (\n <StatusBadge label={t('healthybowl.weather.alertHistory.status.handled', 'Handled ✓')} variant=\"success\" />\n );\n case 'snoozed':\n return (\n <StatusBadge label={t('healthybowl.weather.alertHistory.status.snoozed', 'Snoozed')} variant=\"warning\" />\n );\n case 'delivered':\n default:\n return (\n <StatusBadge label={t('healthybowl.weather.alertHistory.status.delivered', 'Delivered')} variant=\"muted\" />\n );\n }\n };\n\n const filterLabel = (key: Filter): string => {\n switch (key) {\n case 'ALL':\n return t('healthybowl.weather.alertHistory.filter.all', 'All');\n case 'FROST':\n return t('healthybowl.weather.alertHistory.filter.frost', 'Frost');\n case 'STORM':\n return t('healthybowl.weather.alertHistory.filter.storm', 'Storm');\n case 'HEAT':\n return t('healthybowl.weather.alertHistory.filter.heat', 'Heat');\n default:\n return key;\n }\n };\n\n const isInitialLoading = loadingEvents && alertEvents.length === 0;\n const hasError = errorEvents && alertEvents.length === 0;\n\n return (\n <PageLayout\n title={t('healthybowl.weather.alertHistory.title', 'Alert History')}\n description={t('healthybowl.weather.alertHistory.description', 'Weather early-warnings triggered for this farm')}\n purpose=\"Every weather early-warning that has fired for your farm — frost, storm, heat and disease alerts — in one timeline. See what was sent, through which channels and when, then mark an alert as handled or snooze it for a day once you've acted.\"\n >\n {isInitialLoading ? (\n <PageLoader />\n ) : hasError ? (\n <ErrorState onRetry={() => void refetchEvents()} />\n ) : (\n <div className=\"space-y-6\">\n {/* Filter tabs */}\n <div className=\"flex flex-wrap items-center gap-1 border-b border-border-subtle\">\n {FILTERS.map((key) => {\n const active = filter === key;\n return (\n <button\n key={key}\n type=\"button\"\n onClick={() => void selectFilter(key)}\n className={`border-b-2 px-3 pb-2 text-sm font-medium transition-colors ${\n active\n ? 'border-primary text-primary'\n : 'border-transparent text-text-secondary hover:text-text-primary'\n }`}\n >\n {filterLabel(key)}\n </button>\n );\n })}\n </div>\n\n {switching ? (\n <PageLoader />\n ) : events.length === 0 ? (\n <EmptyState\n icon={<BellRing className=\"h-6 w-6 text-text-secondary\" />}\n title={t('healthybowl.weather.alertHistory.empty.title', 'No weather alerts yet')}\n description={t(\n 'healthybowl.weather.alertHistory.empty.description',\n 'Alerts appear here the moment one of your early-warning rules crosses its threshold — frost tonight, a storm tomorrow or a heat spike. Nothing has fired for this filter yet.'\n )}\n />\n ) : (\n /* Vertical timeline feed */\n <ol className=\"relative space-y-4 sm:pl-6\">\n {/* rail */}\n <span aria-hidden className=\"absolute left-2 top-2 bottom-2 hidden w-px bg-border-subtle sm:block\" />\n {events.map((event) => {\n const isBusy = busyId === event.id;\n const isHandled = event.status === 'handled';\n return (\n <li key={event.id} className=\"relative\">\n {/* rail dot */}\n <span\n aria-hidden\n className=\"absolute -left-[1.375rem] top-6 hidden h-2.5 w-2.5 rounded-full border-2 border-bg-canvas bg-border-subtle sm:block\"\n />\n <div className=\"flex overflow-hidden rounded-xl border border-border-subtle bg-bg-surface\">\n {/* Severity tile */}\n <div\n className={`flex w-20 shrink-0 flex-col items-center justify-center gap-1 py-4 ${severityTileClass(\n event.severity\n )}`}\n >\n {alertTypeIcon(event.alertType, 'h-6 w-6')}\n <span className=\"text-xs font-semibold tracking-wide\">{event.severity}</span>\n </div>\n\n {/* Body */}\n <div className=\"min-w-0 flex-1 p-4\">\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <h3 className=\"flex items-center gap-1.5 text-sm font-semibold text-text-primary\">\n <span className=\"text-text-secondary\">{alertTypeIcon(event.alertType, 'h-4 w-4')}</span>\n {event.title}\n </h3>\n {statusBadge(event.status)}\n </div>\n\n {event.advisory && <p className=\"mt-1 text-sm text-text-secondary\">{event.advisory}</p>}\n\n {/* Metric readout (only when the backend supplied one) */}\n {event.observedValue != null && event.threshold != null && (\n <p className=\"mt-1 flex items-center gap-1 text-xs text-text-secondary\">\n <AlertTriangle className=\"h-3.5 w-3.5 text-warning\" />\n {t(\n 'healthybowl.weather.alertHistory.metric',\n '{{metric}} {{observed}}{{unit}} · threshold {{threshold}}{{unit}}',\n {\n metric: event.metric,\n observed: event.observedValue,\n threshold: event.threshold,\n unit: event.unit ?? '',\n }\n )}\n </p>\n )}\n\n {/* Delivery line */}\n <p className=\"mt-2 flex flex-wrap items-center gap-1 text-xs text-text-secondary\">\n <Send className=\"h-3.5 w-3.5\" />\n {event.channels.length > 0\n ? t('healthybowl.weather.alertHistory.sentVia', 'Sent via {{channels}} · {{when}}', {\n channels: event.channels.map(channelLabel).join(' + '),\n when: getRelativeTime(event.triggeredAt),\n })\n : t('healthybowl.weather.alertHistory.triggered', 'Triggered {{when}}', {\n when: getRelativeTime(event.triggeredAt),\n })}\n {event.status === 'snoozed' && event.snoozedUntil && (\n <span className=\"inline-flex items-center gap-1 text-warning\">\n · <Clock className=\"h-3.5 w-3.5\" />\n {t('healthybowl.weather.alertHistory.snoozedUntil', 'snoozed until {{when}}', {\n when: getRelativeTime(event.snoozedUntil),\n })}\n </span>\n )}\n </p>\n\n {/* Rule attribution */}\n {event.ruleName && (\n <p className=\"mt-1 text-[11px] text-text-secondary\">\n {t('healthybowl.weather.alertHistory.rule', 'Rule: {{name}}', { name: event.ruleName })}\n </p>\n )}\n\n {/* Row actions */}\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">\n {!isHandled && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => void handleMarkHandled(event)}\n disabled={isBusy}\n >\n <Check className=\"h-3.5 w-3.5\" />\n {t('healthybowl.weather.alertHistory.actions.markHandled', 'Mark as handled')}\n </Button>\n )}\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => void handleSnooze(event)}\n disabled={isBusy}\n className=\"text-text-secondary hover:text-text-primary\"\n >\n <Clock className=\"h-3.5 w-3.5\" />\n {t('healthybowl.weather.alertHistory.actions.snooze', 'Snooze 1 day')}\n </Button>\n </div>\n </div>\n </div>\n </li>\n );\n })}\n </ol>\n )}\n\n {/* Background refresh hint */}\n {loadingEvents && alertEvents.length > 0 && filter === 'ALL' && (\n <p className=\"text-center text-[11px] text-text-secondary\">\n {t('healthybowl.weather.alertHistory.refreshing', 'Refreshing…')}\n </p>\n )}\n </div>\n )}\n\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,IAAM,IAAU;CAAC;CAAO;CAAS;CAAS;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