@burdenoff/microfe-healthybowl 2026.812.10 → 2026.812.11
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/pages/satellite/SatelliteFieldDetailPage.js +182 -168
- package/dist/healthybowl/pages/satellite/SatelliteFieldDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/satellite/SatelliteSettingsPage.js +100 -100
- package/dist/healthybowl/pages/satellite/SatelliteSettingsPage.js.map +1 -1
- package/dist/healthybowl/pages/satellite/ndviColors.js +29 -1
- package/dist/healthybowl/pages/satellite/ndviColors.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,40 +16,40 @@ import { XAxis as f } from "../../../node_modules/recharts/es6/cartesian/XAxis.j
|
|
|
16
16
|
import { YAxis as p } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
|
|
17
17
|
import { ComposedChart as m } from "../../../node_modules/recharts/es6/chart/ComposedChart.js";
|
|
18
18
|
import { useSatelliteApi as te } from "./useSatelliteApi.js";
|
|
19
|
-
import { formatDate as
|
|
20
|
-
import { NdviHeatmapMap as
|
|
19
|
+
import { formatDate as h, formatNdvi as g, formatTonnes as _, healthBandVariant as ne, ndviSourceBadge as v, reasonLabel as y, severityVariant as b, trendArrow as x } from "./ndviColors.js";
|
|
20
|
+
import { NdviHeatmapMap as re } from "./NdviHeatmapMap.js";
|
|
21
21
|
import { YieldSimulationPanel as S } from "./YieldSimulationPanel.js";
|
|
22
22
|
import { NdviComparePanel as C } from "./NdviComparePanel.js";
|
|
23
23
|
import { YieldReportPanel as w } from "./YieldReportPanel.js";
|
|
24
|
-
import { useCallback as T, useEffect as
|
|
25
|
-
import { ArrowLeft as ie, Bug as
|
|
26
|
-
import { useNavigate as A, useParams as
|
|
27
|
-
import { jsx as
|
|
28
|
-
import { Button as
|
|
24
|
+
import { useCallback as T, useEffect as E, useMemo as D, useState as O } from "react";
|
|
25
|
+
import { ArrowLeft as ie, Bug as k, ClipboardList as ae, Minus as oe, RefreshCw as se, TrendingDown as ce, TrendingUp as le } from "lucide-react";
|
|
26
|
+
import { useNavigate as A, useParams as ue } from "react-router";
|
|
27
|
+
import { jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
28
|
+
import { Button as N } from "@burdenoff/fe-libs/ui";
|
|
29
29
|
//#region src/healthybowl/pages/satellite/SatelliteFieldDetailPage.tsx
|
|
30
|
-
var
|
|
31
|
-
let { fieldId: s = "" } =
|
|
32
|
-
|
|
30
|
+
var P = () => {
|
|
31
|
+
let { fieldId: s = "" } = ue(), { api: c } = te(), l = A(), { buildPath: u } = e(), { toast: d } = o(), [f, p] = O(null), [m, _] = O(!0), [D, P] = O(null), [L, R] = O(!1), [z, B] = O("overview"), [V, H] = O(null), [U, W] = O(!1), G = T(async () => {
|
|
32
|
+
P(null);
|
|
33
33
|
try {
|
|
34
34
|
p(await c.getFieldCropHealth(s));
|
|
35
35
|
} catch (e) {
|
|
36
|
-
|
|
36
|
+
P(e instanceof Error ? e.message : "Failed to load field crop health.");
|
|
37
37
|
} finally {
|
|
38
|
-
|
|
38
|
+
_(!1);
|
|
39
39
|
}
|
|
40
40
|
}, [c, s]);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [
|
|
44
|
-
let
|
|
45
|
-
|
|
41
|
+
E(() => {
|
|
42
|
+
G();
|
|
43
|
+
}, [G]);
|
|
44
|
+
let de = T(async () => {
|
|
45
|
+
R(!0);
|
|
46
46
|
try {
|
|
47
47
|
let e = (f?.timeline.length ?? 0) > 0, t = await c.refreshNdvi(s, e ? 0 : 5);
|
|
48
48
|
d({
|
|
49
49
|
title: "NDVI refreshed",
|
|
50
50
|
description: `${t.readingsCreated} reading(s), ${t.stressedZonesDetected} stressed zone(s) detected.`,
|
|
51
51
|
variant: "success"
|
|
52
|
-
}), await
|
|
52
|
+
}), await G();
|
|
53
53
|
} catch (e) {
|
|
54
54
|
d({
|
|
55
55
|
title: "Refresh failed",
|
|
@@ -57,23 +57,23 @@ var F = () => {
|
|
|
57
57
|
variant: "error"
|
|
58
58
|
});
|
|
59
59
|
} finally {
|
|
60
|
-
|
|
60
|
+
R(!1);
|
|
61
61
|
}
|
|
62
62
|
}, [
|
|
63
63
|
c,
|
|
64
64
|
s,
|
|
65
65
|
f,
|
|
66
66
|
d,
|
|
67
|
-
|
|
68
|
-
]),
|
|
69
|
-
if (
|
|
70
|
-
|
|
67
|
+
G
|
|
68
|
+
]), K = T(async (e) => {
|
|
69
|
+
if (V) {
|
|
70
|
+
W(!0);
|
|
71
71
|
try {
|
|
72
|
-
await c.escalateZone(
|
|
72
|
+
await c.escalateZone(V.id, e), d({
|
|
73
73
|
title: e === "PEST" ? "Pest issue created" : "Scouting task created",
|
|
74
|
-
description: `${
|
|
74
|
+
description: `${V.label} escalated. ${e === "PEST" ? "Track it under Pest Management." : "Track it under the field activity log."}`,
|
|
75
75
|
variant: "success"
|
|
76
|
-
}),
|
|
76
|
+
}), H(null), await G();
|
|
77
77
|
} catch (e) {
|
|
78
78
|
d({
|
|
79
79
|
title: "Escalation failed",
|
|
@@ -81,61 +81,61 @@ var F = () => {
|
|
|
81
81
|
variant: "error"
|
|
82
82
|
});
|
|
83
83
|
} finally {
|
|
84
|
-
|
|
84
|
+
W(!1);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}, [
|
|
88
88
|
c,
|
|
89
|
-
|
|
89
|
+
V,
|
|
90
90
|
d,
|
|
91
|
-
|
|
91
|
+
G
|
|
92
92
|
]);
|
|
93
|
-
if (m) return /* @__PURE__ */
|
|
94
|
-
if (
|
|
93
|
+
if (m) return /* @__PURE__ */ j(i, {});
|
|
94
|
+
if (D) return /* @__PURE__ */ j(ee, {
|
|
95
95
|
title: "Couldn't load field crop health",
|
|
96
|
-
description:
|
|
97
|
-
onRetry: () => void
|
|
96
|
+
description: D,
|
|
97
|
+
onRetry: () => void G()
|
|
98
98
|
});
|
|
99
99
|
if (!f) return null;
|
|
100
|
-
let { field:
|
|
101
|
-
return /* @__PURE__ */
|
|
100
|
+
let { field: q, healthScore: J, latestReading: Y, stressedZones: X, timeline: Z, yieldForecast: Q } = f, $ = Y ? v(Y.source, Y.cloudCoverPct) : null, fe = J.trendDirection === "UP" ? le : J.trendDirection === "DOWN" ? ce : oe;
|
|
101
|
+
return /* @__PURE__ */ M(t, {
|
|
102
102
|
title: "Satellite Crop Health & Yield Forecast",
|
|
103
|
-
description: `Field: ${
|
|
103
|
+
description: `Field: ${q.name} · ${q.areaAcres.toFixed(1)} ${q.unit}${q.cropName ? ` · ${q.cropName}${q.variety ? ` (${q.variety})` : ""}` : ""}${q.farmName ? ` · ${q.farmName}` : ""}`,
|
|
104
104
|
helpPrompt: "Explain this field's NDVI heatmap, stressed zones, health score and yield forecast.",
|
|
105
|
-
actions: /* @__PURE__ */
|
|
105
|
+
actions: /* @__PURE__ */ M("div", {
|
|
106
106
|
className: "flex flex-wrap items-center gap-2",
|
|
107
|
-
children: [/* @__PURE__ */ N
|
|
107
|
+
children: [/* @__PURE__ */ M(N, {
|
|
108
108
|
variant: "ghost",
|
|
109
109
|
size: "sm",
|
|
110
110
|
onClick: () => l(u("satellite")),
|
|
111
|
-
children: [/* @__PURE__ */
|
|
112
|
-
}), /* @__PURE__ */ N
|
|
111
|
+
children: [/* @__PURE__ */ j(ie, { className: "me-1.5 h-4 w-4" }), " All fields"]
|
|
112
|
+
}), /* @__PURE__ */ M(N, {
|
|
113
113
|
size: "sm",
|
|
114
|
-
onClick: () => void
|
|
115
|
-
disabled:
|
|
116
|
-
children: [/* @__PURE__ */
|
|
114
|
+
onClick: () => void de(),
|
|
115
|
+
disabled: L,
|
|
116
|
+
children: [/* @__PURE__ */ j(se, { className: `me-1.5 h-4 w-4 ${L ? "animate-spin" : ""}` }), " Refresh NDVI"]
|
|
117
117
|
})]
|
|
118
118
|
}),
|
|
119
119
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ j("div", {
|
|
121
121
|
className: "mb-4 flex flex-wrap gap-1 border-b border-border-subtle",
|
|
122
122
|
children: [
|
|
123
123
|
["overview", "Overview"],
|
|
124
124
|
["simulation", "Yield Simulation"],
|
|
125
125
|
["compare", "NDVI Comparison"],
|
|
126
126
|
["report", "Season Report"]
|
|
127
|
-
].map(([e, t]) => /* @__PURE__ */
|
|
128
|
-
onClick: () =>
|
|
129
|
-
className: `-mb-px border-b-2 px-3 py-2 text-sm font-medium transition-colors ${
|
|
127
|
+
].map(([e, t]) => /* @__PURE__ */ j("button", {
|
|
128
|
+
onClick: () => B(e),
|
|
129
|
+
className: `-mb-px border-b-2 px-3 py-2 text-sm font-medium transition-colors ${z === e ? "border-accent-teal text-text-primary" : "border-transparent text-text-secondary hover:text-text-primary"}`,
|
|
130
130
|
children: t
|
|
131
131
|
}, e))
|
|
132
132
|
}),
|
|
133
|
-
!
|
|
133
|
+
!q.hasBoundary && /* @__PURE__ */ M("div", {
|
|
134
134
|
className: "mb-4 rounded-lg border border-warning/40 bg-warning/10 p-3 text-sm text-text-primary",
|
|
135
135
|
children: [
|
|
136
136
|
"This field has no saved boundary yet, so no NDVI heatmap can be clipped to it. Draw the field boundary on the",
|
|
137
137
|
" ",
|
|
138
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ j("button", {
|
|
139
139
|
className: "underline",
|
|
140
140
|
onClick: () => l(u("field-map")),
|
|
141
141
|
children: "Field Map"
|
|
@@ -144,181 +144,195 @@ var F = () => {
|
|
|
144
144
|
"first."
|
|
145
145
|
]
|
|
146
146
|
}),
|
|
147
|
-
|
|
147
|
+
z === "overview" && /* @__PURE__ */ M("div", {
|
|
148
148
|
className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
|
|
149
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ M("div", {
|
|
150
150
|
className: "lg:col-span-2",
|
|
151
|
-
children: [
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
151
|
+
children: [
|
|
152
|
+
Y && $ && /* @__PURE__ */ M("div", {
|
|
153
|
+
className: "mb-2 flex items-center justify-between gap-2",
|
|
154
|
+
children: [/* @__PURE__ */ M("span", {
|
|
155
|
+
className: "text-xs text-text-secondary",
|
|
156
|
+
children: ["Latest reading · ", h(Y.capturedDate)]
|
|
157
|
+
}), /* @__PURE__ */ j(n, {
|
|
158
|
+
label: $.label,
|
|
159
|
+
variant: $.variant,
|
|
160
|
+
dot: $.variant === "info"
|
|
161
|
+
})]
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ j(re, {
|
|
164
|
+
boundary: q.boundary,
|
|
165
|
+
grid: Y?.grid ?? null,
|
|
166
|
+
zones: X,
|
|
167
|
+
onZoneClick: (e) => {
|
|
168
|
+
let t = X.find((t) => t.id === e);
|
|
169
|
+
t && H(t);
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ j(r, {
|
|
173
|
+
title: "NDVI over time",
|
|
174
|
+
className: "mt-4",
|
|
175
|
+
children: Z.length === 0 ? /* @__PURE__ */ j("p", {
|
|
176
|
+
className: "py-6 text-center text-sm text-text-secondary",
|
|
177
|
+
children: "No readings yet — refresh NDVI."
|
|
178
|
+
}) : /* @__PURE__ */ j("div", {
|
|
179
|
+
className: "flex gap-3 overflow-x-auto pb-1",
|
|
180
|
+
children: Z.map((e) => /* @__PURE__ */ M("div", {
|
|
181
|
+
className: "flex min-w-[92px] flex-col items-center",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ j(F, {
|
|
184
|
+
band: e.healthBand,
|
|
185
|
+
ndvi: e.meanNdvi
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ j("span", {
|
|
188
|
+
className: "mt-1 text-xs font-medium text-text-primary",
|
|
189
|
+
children: g(e.meanNdvi)
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ j("span", {
|
|
192
|
+
className: "text-[11px] text-text-secondary",
|
|
193
|
+
children: h(e.capturedDate)
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
}, e.readingId))
|
|
197
|
+
})
|
|
184
198
|
})
|
|
185
|
-
|
|
186
|
-
}), /* @__PURE__ */
|
|
199
|
+
]
|
|
200
|
+
}), /* @__PURE__ */ M("div", {
|
|
187
201
|
className: "flex flex-col gap-4",
|
|
188
202
|
children: [
|
|
189
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ M(r, {
|
|
190
204
|
title: "Field Health Score",
|
|
191
|
-
children: [/* @__PURE__ */
|
|
205
|
+
children: [/* @__PURE__ */ M("div", {
|
|
192
206
|
className: "flex items-start justify-between",
|
|
193
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ M("div", {
|
|
194
208
|
className: "text-4xl font-bold tabular-nums text-text-primary",
|
|
195
209
|
children: [
|
|
196
|
-
|
|
210
|
+
g(J.meanNdvi),
|
|
197
211
|
" ",
|
|
198
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ j("span", {
|
|
199
213
|
className: "text-lg font-medium text-text-secondary",
|
|
200
214
|
children: "NDVI"
|
|
201
215
|
})
|
|
202
216
|
]
|
|
203
|
-
}), /* @__PURE__ */
|
|
217
|
+
}), /* @__PURE__ */ j("div", {
|
|
204
218
|
className: "mt-1",
|
|
205
|
-
children: /* @__PURE__ */
|
|
206
|
-
label:
|
|
207
|
-
variant:
|
|
219
|
+
children: /* @__PURE__ */ j(n, {
|
|
220
|
+
label: J.healthLabel,
|
|
221
|
+
variant: ne(J.healthBand)
|
|
208
222
|
})
|
|
209
|
-
})] }), /* @__PURE__ */
|
|
210
|
-
className: `flex items-center gap-1 rounded-md px-2 py-1 text-sm ${
|
|
211
|
-
children: [/* @__PURE__ */
|
|
223
|
+
})] }), /* @__PURE__ */ M("div", {
|
|
224
|
+
className: `flex items-center gap-1 rounded-md px-2 py-1 text-sm ${J.trendDirection === "DOWN" ? "text-destructive" : J.trendDirection === "UP" ? "text-success" : "text-text-secondary"}`,
|
|
225
|
+
children: [/* @__PURE__ */ j(fe, { className: "h-4 w-4" }), J.readingsCount >= 2 ? `${Math.abs(J.trendPct).toFixed(1)}%` : "—"]
|
|
212
226
|
})]
|
|
213
|
-
}), /* @__PURE__ */
|
|
227
|
+
}), /* @__PURE__ */ j("p", {
|
|
214
228
|
className: "mt-2 text-xs text-text-secondary",
|
|
215
|
-
children:
|
|
229
|
+
children: J.readingsCount >= 2 ? `${x(J.trendDirection)} ${J.trendDelta >= 0 ? "+" : ""}${J.trendDelta.toFixed(2)} NDVI vs previous reading (${g(J.previousNdvi)})` : `From ${J.readingsCount} reading(s) — refresh again for a trend.`
|
|
216
230
|
})]
|
|
217
231
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
title: `Stressed Zones Detected: ${
|
|
220
|
-
children:
|
|
232
|
+
/* @__PURE__ */ j(r, {
|
|
233
|
+
title: `Stressed Zones Detected: ${X.length}`,
|
|
234
|
+
children: X.length === 0 ? /* @__PURE__ */ j("p", {
|
|
221
235
|
className: "py-2 text-sm text-text-secondary",
|
|
222
236
|
children: "No stressed zones on the latest reading. 🎉"
|
|
223
|
-
}) : /* @__PURE__ */
|
|
237
|
+
}) : /* @__PURE__ */ j("ul", {
|
|
224
238
|
className: "space-y-2",
|
|
225
|
-
children:
|
|
239
|
+
children: X.map((e) => /* @__PURE__ */ M("li", {
|
|
226
240
|
className: "rounded-lg border border-border-subtle p-2.5",
|
|
227
241
|
children: [
|
|
228
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ M("div", {
|
|
229
243
|
className: "flex items-center justify-between gap-2",
|
|
230
|
-
children: [/* @__PURE__ */
|
|
244
|
+
children: [/* @__PURE__ */ M("span", {
|
|
231
245
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
232
246
|
children: [
|
|
233
|
-
/* @__PURE__ */
|
|
247
|
+
/* @__PURE__ */ j("span", { className: `h-2.5 w-2.5 rounded-full ${e.severity === "HIGH" ? "bg-destructive" : e.severity === "MEDIUM" ? "bg-warning" : "bg-warning/60"}` }),
|
|
234
248
|
e.label,
|
|
235
249
|
" — ",
|
|
236
|
-
|
|
250
|
+
y(e.reason)
|
|
237
251
|
]
|
|
238
|
-
}), /* @__PURE__ */
|
|
252
|
+
}), /* @__PURE__ */ j(n, {
|
|
239
253
|
label: e.status,
|
|
240
|
-
variant: e.status === "ESCALATED" ? "info" :
|
|
254
|
+
variant: e.status === "ESCALATED" ? "info" : b(e.severity)
|
|
241
255
|
})]
|
|
242
256
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ M("p", {
|
|
244
258
|
className: "mt-1 text-xs text-text-secondary",
|
|
245
259
|
children: [
|
|
246
260
|
e.reasonDetail,
|
|
247
261
|
" · NDVI ",
|
|
248
|
-
|
|
262
|
+
g(e.zoneNdvi),
|
|
249
263
|
" (",
|
|
250
264
|
e.deltaPct,
|
|
251
265
|
"% vs field avg)"
|
|
252
266
|
]
|
|
253
267
|
}),
|
|
254
|
-
e.status !== "ESCALATED" && /* @__PURE__ */
|
|
268
|
+
e.status !== "ESCALATED" && /* @__PURE__ */ j("div", {
|
|
255
269
|
className: "mt-2 flex gap-2",
|
|
256
|
-
children: /* @__PURE__ */ N
|
|
270
|
+
children: /* @__PURE__ */ M(N, {
|
|
257
271
|
variant: "outline",
|
|
258
272
|
size: "sm",
|
|
259
|
-
onClick: () =>
|
|
260
|
-
children: [/* @__PURE__ */
|
|
273
|
+
onClick: () => H(e),
|
|
274
|
+
children: [/* @__PURE__ */ j(k, { className: "me-1 h-3.5 w-3.5" }), " Escalate"]
|
|
261
275
|
})
|
|
262
276
|
})
|
|
263
277
|
]
|
|
264
278
|
}, e.id))
|
|
265
279
|
})
|
|
266
280
|
}),
|
|
267
|
-
|
|
281
|
+
Q && /* @__PURE__ */ j(r, {
|
|
268
282
|
title: "Yield Forecast",
|
|
269
|
-
children: /* @__PURE__ */
|
|
283
|
+
children: /* @__PURE__ */ j(I, { forecast: Q })
|
|
270
284
|
})
|
|
271
285
|
]
|
|
272
286
|
})]
|
|
273
287
|
}),
|
|
274
|
-
|
|
288
|
+
z === "simulation" && /* @__PURE__ */ j(S, {
|
|
275
289
|
fieldId: s,
|
|
276
|
-
field:
|
|
277
|
-
baseForecast:
|
|
290
|
+
field: q,
|
|
291
|
+
baseForecast: Q
|
|
278
292
|
}),
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
293
|
+
z === "compare" && /* @__PURE__ */ j(C, { fieldId: s }),
|
|
294
|
+
z === "report" && /* @__PURE__ */ j(w, { data: f }),
|
|
295
|
+
V && /* @__PURE__ */ M(a, {
|
|
282
296
|
open: !0,
|
|
283
|
-
onClose: () =>
|
|
284
|
-
title: `Escalate ${
|
|
297
|
+
onClose: () => H(null),
|
|
298
|
+
title: `Escalate ${V.label}`,
|
|
285
299
|
children: [
|
|
286
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ j("p", {
|
|
287
301
|
className: "text-sm text-text-secondary",
|
|
288
|
-
children:
|
|
302
|
+
children: V.reasonDetail ?? y(V.reason)
|
|
289
303
|
}),
|
|
290
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ M("p", {
|
|
291
305
|
className: "mt-1 text-xs text-text-secondary",
|
|
292
306
|
children: [
|
|
293
307
|
"NDVI ",
|
|
294
|
-
|
|
308
|
+
g(V.zoneNdvi),
|
|
295
309
|
" (",
|
|
296
|
-
|
|
310
|
+
V.deltaPct,
|
|
297
311
|
"% vs field average)."
|
|
298
312
|
]
|
|
299
313
|
}),
|
|
300
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ M("div", {
|
|
301
315
|
className: "mt-4 flex flex-col gap-2 sm:flex-row",
|
|
302
|
-
children: [/* @__PURE__ */ N
|
|
316
|
+
children: [/* @__PURE__ */ M(N, {
|
|
303
317
|
className: "flex-1",
|
|
304
|
-
onClick: () => void
|
|
305
|
-
disabled:
|
|
306
|
-
children: [/* @__PURE__ */
|
|
307
|
-
}), /* @__PURE__ */ N
|
|
318
|
+
onClick: () => void K("PEST"),
|
|
319
|
+
disabled: U,
|
|
320
|
+
children: [/* @__PURE__ */ j(k, { className: "me-1.5 h-4 w-4" }), " Create Pest Issue"]
|
|
321
|
+
}), /* @__PURE__ */ M(N, {
|
|
308
322
|
variant: "outline",
|
|
309
323
|
className: "flex-1",
|
|
310
|
-
onClick: () => void
|
|
311
|
-
disabled:
|
|
312
|
-
children: [/* @__PURE__ */
|
|
324
|
+
onClick: () => void K("TASK"),
|
|
325
|
+
disabled: U,
|
|
326
|
+
children: [/* @__PURE__ */ j(ae, { className: "me-1.5 h-4 w-4" }), " Create Task"]
|
|
313
327
|
})]
|
|
314
328
|
})
|
|
315
329
|
]
|
|
316
330
|
})
|
|
317
331
|
]
|
|
318
332
|
});
|
|
319
|
-
},
|
|
333
|
+
}, F = ({ band: e, ndvi: t }) => {
|
|
320
334
|
let n = e === "STRESSED" ? "#d73027" : e === "BELOW_AVERAGE" ? "#fee08b" : e === "EXCELLENT" ? "#1a9850" : "#66bd63";
|
|
321
|
-
return /* @__PURE__ */
|
|
335
|
+
return /* @__PURE__ */ j("div", {
|
|
322
336
|
className: "h-14 w-full rounded-md ring-1 ring-border-subtle",
|
|
323
337
|
style: {
|
|
324
338
|
background: `linear-gradient(135deg, ${n}, ${n}cc)`,
|
|
@@ -326,17 +340,17 @@ var F = () => {
|
|
|
326
340
|
},
|
|
327
341
|
"aria-hidden": !0
|
|
328
342
|
});
|
|
329
|
-
},
|
|
330
|
-
let t =
|
|
343
|
+
}, I = ({ forecast: e }) => {
|
|
344
|
+
let t = D(() => (e?.trajectory ?? []).map((e) => ({
|
|
331
345
|
label: e.label,
|
|
332
346
|
simulated: e.simulated,
|
|
333
347
|
band: [e.lower, e.upper]
|
|
334
348
|
})), [e]);
|
|
335
|
-
return e ? /* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
349
|
+
return e ? /* @__PURE__ */ M("div", { children: [
|
|
350
|
+
/* @__PURE__ */ j(c, {
|
|
337
351
|
width: "100%",
|
|
338
352
|
height: 130,
|
|
339
|
-
children: /* @__PURE__ */
|
|
353
|
+
children: /* @__PURE__ */ M(m, {
|
|
340
354
|
data: t,
|
|
341
355
|
margin: {
|
|
342
356
|
top: 5,
|
|
@@ -345,37 +359,37 @@ var F = () => {
|
|
|
345
359
|
bottom: 0
|
|
346
360
|
},
|
|
347
361
|
children: [
|
|
348
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ j("defs", { children: /* @__PURE__ */ M("linearGradient", {
|
|
349
363
|
id: "yieldBand",
|
|
350
364
|
x1: "0",
|
|
351
365
|
y1: "0",
|
|
352
366
|
x2: "0",
|
|
353
367
|
y2: "1",
|
|
354
|
-
children: [/* @__PURE__ */
|
|
368
|
+
children: [/* @__PURE__ */ j("stop", {
|
|
355
369
|
offset: "5%",
|
|
356
370
|
stopColor: "var(--color-success)",
|
|
357
371
|
stopOpacity: .28
|
|
358
|
-
}), /* @__PURE__ */
|
|
372
|
+
}), /* @__PURE__ */ j("stop", {
|
|
359
373
|
offset: "95%",
|
|
360
374
|
stopColor: "var(--color-success)",
|
|
361
375
|
stopOpacity: .04
|
|
362
376
|
})]
|
|
363
377
|
}) }),
|
|
364
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ j(l, {
|
|
365
379
|
strokeDasharray: "3 3",
|
|
366
380
|
className: "stroke-border"
|
|
367
381
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ j(f, {
|
|
369
383
|
dataKey: "label",
|
|
370
384
|
className: "text-[10px]",
|
|
371
385
|
tick: { fill: "currentColor" }
|
|
372
386
|
}),
|
|
373
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ j(p, {
|
|
374
388
|
className: "text-[10px]",
|
|
375
389
|
tick: { fill: "currentColor" },
|
|
376
390
|
width: 28
|
|
377
391
|
}),
|
|
378
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ j(s, {
|
|
379
393
|
contentStyle: {
|
|
380
394
|
backgroundColor: "var(--color-card)",
|
|
381
395
|
border: "1px solid var(--color-border)",
|
|
@@ -383,13 +397,13 @@ var F = () => {
|
|
|
383
397
|
},
|
|
384
398
|
labelStyle: { color: "var(--color-foreground)" }
|
|
385
399
|
}),
|
|
386
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ j(d, {
|
|
387
401
|
dataKey: "band",
|
|
388
402
|
stroke: "none",
|
|
389
403
|
fill: "url(#yieldBand)",
|
|
390
404
|
isAnimationActive: !1
|
|
391
405
|
}),
|
|
392
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ j(u, {
|
|
393
407
|
dataKey: "simulated",
|
|
394
408
|
stroke: "var(--color-success)",
|
|
395
409
|
strokeWidth: 2,
|
|
@@ -399,39 +413,39 @@ var F = () => {
|
|
|
399
413
|
]
|
|
400
414
|
})
|
|
401
415
|
}),
|
|
402
|
-
/* @__PURE__ */
|
|
416
|
+
/* @__PURE__ */ M("div", {
|
|
403
417
|
className: "mt-2 flex items-end justify-between",
|
|
404
|
-
children: [/* @__PURE__ */
|
|
418
|
+
children: [/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ M("div", {
|
|
405
419
|
className: "text-3xl font-bold tabular-nums text-text-primary",
|
|
406
420
|
children: [
|
|
407
|
-
|
|
421
|
+
_(e.estimatedTonnes),
|
|
408
422
|
" ",
|
|
409
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ j("span", {
|
|
410
424
|
className: "text-base font-medium text-text-secondary",
|
|
411
425
|
children: "t"
|
|
412
426
|
})
|
|
413
427
|
]
|
|
414
|
-
}), /* @__PURE__ */
|
|
428
|
+
}), /* @__PURE__ */ M("div", {
|
|
415
429
|
className: "text-xs text-text-secondary",
|
|
416
430
|
children: [
|
|
417
431
|
"± ",
|
|
418
|
-
|
|
432
|
+
_(e.confidenceBand),
|
|
419
433
|
" t · ",
|
|
420
434
|
e.confidenceLabel.toLowerCase(),
|
|
421
435
|
" confidence"
|
|
422
436
|
]
|
|
423
|
-
})] }), e.harvestWindowLabel && /* @__PURE__ */
|
|
437
|
+
})] }), e.harvestWindowLabel && /* @__PURE__ */ M("div", {
|
|
424
438
|
className: "text-end",
|
|
425
|
-
children: [/* @__PURE__ */
|
|
439
|
+
children: [/* @__PURE__ */ j("div", {
|
|
426
440
|
className: "text-xs text-text-secondary",
|
|
427
441
|
children: "Harvest window"
|
|
428
|
-
}), /* @__PURE__ */
|
|
442
|
+
}), /* @__PURE__ */ j("div", {
|
|
429
443
|
className: "text-sm font-medium text-text-primary",
|
|
430
444
|
children: e.harvestWindowLabel
|
|
431
445
|
})]
|
|
432
446
|
})]
|
|
433
447
|
}),
|
|
434
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ M("p", {
|
|
435
449
|
className: "mt-2 text-[11px] leading-snug text-text-secondary",
|
|
436
450
|
children: [
|
|
437
451
|
"Estimate only — not a guarantee. ",
|
|
@@ -442,6 +456,6 @@ var F = () => {
|
|
|
442
456
|
] }) : null;
|
|
443
457
|
};
|
|
444
458
|
//#endregion
|
|
445
|
-
export {
|
|
459
|
+
export { P as SatelliteFieldDetailPage };
|
|
446
460
|
|
|
447
461
|
//# sourceMappingURL=SatelliteFieldDetailPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SatelliteFieldDetailPage.js","names":[],"sources":["../../../../src/healthybowl/pages/satellite/SatelliteFieldDetailPage.tsx"],"sourcesContent":["/**\n * Satellite Crop Health & Yield Forecast — per-field detail (BOFF-2886).\n *\n * The hub for one field: NDVI heatmap clipped to the field polygon with stressed-\n * zone pins + legend, a Field Health Score card with trend, a Stressed Zones card\n * (escalatable to a Pest issue or a Task), a transparent Yield Forecast card, and an\n * NDVI-over-time timeline. Tabs switch to Yield Simulation, NDVI Comparison and the\n * printable Season Yield Report. Live gateway data — no mocks.\n */\nimport { type FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { useParams, useNavigate } from 'react-router';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { RefreshCw, ArrowLeft, Bug, ClipboardList, TrendingUp, TrendingDown, Minus } from 'lucide-react';\nimport { ResponsiveContainer, ComposedChart, Area, Line, XAxis, YAxis, CartesianGrid, Tooltip } from 'recharts';\nimport { PageLayout, ChartCard, StatusBadge, ErrorState, PageLoader, Modal } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { useSatelliteApi } from './useSatelliteApi';\nimport { NdviHeatmapMap } from './NdviHeatmapMap';\nimport { YieldSimulationPanel } from './YieldSimulationPanel';\nimport { NdviComparePanel } from './NdviComparePanel';\nimport { YieldReportPanel } from './YieldReportPanel';\nimport type { FieldCropHealth, StressedZone } from './satelliteApi';\nimport {\n formatDate,\n formatNdvi,\n formatTonnes,\n healthBandVariant,\n reasonLabel,\n severityVariant,\n trendArrow,\n} from './ndviColors';\n\ntype Tab = 'overview' | 'simulation' | 'compare' | 'report';\n\nexport const SatelliteFieldDetailPage: FC = () => {\n const { fieldId = '' } = useParams();\n const { api } = useSatelliteApi();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { toast } = useToast();\n\n const [data, setData] = useState<FieldCropHealth | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [refreshing, setRefreshing] = useState(false);\n const [tab, setTab] = useState<Tab>('overview');\n const [escalateZone, setEscalateZone] = useState<StressedZone | null>(null);\n const [escalating, setEscalating] = useState(false);\n\n const load = useCallback(async () => {\n setError(null);\n try {\n setData(await api.getFieldCropHealth(fieldId));\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Failed to load field crop health.');\n } finally {\n setLoading(false);\n }\n }, [api, fieldId]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n const handleRefresh = useCallback(async () => {\n setRefreshing(true);\n try {\n const hasData = (data?.timeline.length ?? 0) > 0;\n const res = await api.refreshNdvi(fieldId, hasData ? 0 : 5);\n toast({\n title: 'NDVI refreshed',\n description: `${res.readingsCreated} reading(s), ${res.stressedZonesDetected} stressed zone(s) detected.`,\n variant: 'success',\n });\n await load();\n } catch (e) {\n toast({\n title: 'Refresh failed',\n description: e instanceof Error ? e.message : 'Unknown error',\n variant: 'error',\n });\n } finally {\n setRefreshing(false);\n }\n }, [api, fieldId, data, toast, load]);\n\n const doEscalate = useCallback(\n async (target: 'PEST' | 'TASK') => {\n if (!escalateZone) return;\n setEscalating(true);\n try {\n const res = await api.escalateZone(escalateZone.id, target);\n toast({\n title: target === 'PEST' ? 'Pest issue created' : 'Scouting task created',\n description: `${escalateZone.label} escalated. ${target === 'PEST' ? 'Track it under Pest Management.' : 'Track it under the field activity log.'}`,\n variant: 'success',\n });\n void res;\n setEscalateZone(null);\n await load();\n } catch (e) {\n toast({\n title: 'Escalation failed',\n description: e instanceof Error ? e.message : 'Unknown error',\n variant: 'error',\n });\n } finally {\n setEscalating(false);\n }\n },\n [api, escalateZone, toast, load]\n );\n\n if (loading) return <PageLoader />;\n if (error)\n return <ErrorState title=\"Couldn't load field crop health\" description={error} onRetry={() => void load()} />;\n if (!data) return null;\n\n const { field, healthScore, latestReading, stressedZones, timeline, yieldForecast } = data;\n const TrendIcon =\n healthScore.trendDirection === 'UP' ? TrendingUp : healthScore.trendDirection === 'DOWN' ? TrendingDown : Minus;\n\n return (\n <PageLayout\n title=\"Satellite Crop Health & Yield Forecast\"\n description={`Field: ${field.name} · ${field.areaAcres.toFixed(1)} ${field.unit}${field.cropName ? ` · ${field.cropName}${field.variety ? ` (${field.variety})` : ''}` : ''}${field.farmName ? ` · ${field.farmName}` : ''}`}\n helpPrompt=\"Explain this field's NDVI heatmap, stressed zones, health score and yield forecast.\"\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate(buildPath('satellite'))}>\n <ArrowLeft className=\"me-1.5 h-4 w-4\" /> All fields\n </Button>\n <Button size=\"sm\" onClick={() => void handleRefresh()} disabled={refreshing}>\n <RefreshCw className={`me-1.5 h-4 w-4 ${refreshing ? 'animate-spin' : ''}`} /> Refresh NDVI\n </Button>\n </div>\n }\n >\n {/* Tabs */}\n <div className=\"mb-4 flex flex-wrap gap-1 border-b border-border-subtle\">\n {(\n [\n ['overview', 'Overview'],\n ['simulation', 'Yield Simulation'],\n ['compare', 'NDVI Comparison'],\n ['report', 'Season Report'],\n ] as [Tab, string][]\n ).map(([k, label]) => (\n <button\n key={k}\n onClick={() => setTab(k)}\n className={`-mb-px border-b-2 px-3 py-2 text-sm font-medium transition-colors ${\n tab === k\n ? 'border-accent-teal text-text-primary'\n : 'border-transparent text-text-secondary hover:text-text-primary'\n }`}\n >\n {label}\n </button>\n ))}\n </div>\n\n {!field.hasBoundary && (\n <div className=\"mb-4 rounded-lg border border-warning/40 bg-warning/10 p-3 text-sm text-text-primary\">\n This field has no saved boundary yet, so no NDVI heatmap can be clipped to it. Draw the field boundary on the{' '}\n <button className=\"underline\" onClick={() => navigate(buildPath('field-map'))}>\n Field Map\n </button>{' '}\n first.\n </div>\n )}\n\n {tab === 'overview' && (\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n {/* Map */}\n <div className=\"lg:col-span-2\">\n <NdviHeatmapMap\n boundary={field.boundary}\n grid={latestReading?.grid ?? null}\n zones={stressedZones}\n onZoneClick={(id) => {\n const z = stressedZones.find((zz) => zz.id === id);\n if (z) setEscalateZone(z);\n }}\n />\n {/* NDVI over time */}\n <ChartCard title=\"NDVI over time\" className=\"mt-4\">\n {timeline.length === 0 ? (\n <p className=\"py-6 text-center text-sm text-text-secondary\">No readings yet — refresh NDVI.</p>\n ) : (\n <div className=\"flex gap-3 overflow-x-auto pb-1\">\n {timeline.map((t) => (\n <div key={t.readingId} className=\"flex min-w-[92px] flex-col items-center\">\n <MiniSwatch band={t.healthBand} ndvi={t.meanNdvi} />\n <span className=\"mt-1 text-xs font-medium text-text-primary\">{formatNdvi(t.meanNdvi)}</span>\n <span className=\"text-[11px] text-text-secondary\">{formatDate(t.capturedDate)}</span>\n </div>\n ))}\n </div>\n )}\n </ChartCard>\n </div>\n\n {/* Right column: health score, stressed zones, yield */}\n <div className=\"flex flex-col gap-4\">\n <ChartCard title=\"Field Health Score\">\n <div className=\"flex items-start justify-between\">\n <div>\n <div className=\"text-4xl font-bold tabular-nums text-text-primary\">\n {formatNdvi(healthScore.meanNdvi)}{' '}\n <span className=\"text-lg font-medium text-text-secondary\">NDVI</span>\n </div>\n <div className=\"mt-1\">\n <StatusBadge label={healthScore.healthLabel} variant={healthBandVariant(healthScore.healthBand)} />\n </div>\n </div>\n <div\n className={`flex items-center gap-1 rounded-md px-2 py-1 text-sm ${\n healthScore.trendDirection === 'DOWN'\n ? 'text-destructive'\n : healthScore.trendDirection === 'UP'\n ? 'text-success'\n : 'text-text-secondary'\n }`}\n >\n <TrendIcon className=\"h-4 w-4\" />\n {healthScore.readingsCount >= 2 ? `${Math.abs(healthScore.trendPct).toFixed(1)}%` : '—'}\n </div>\n </div>\n <p className=\"mt-2 text-xs text-text-secondary\">\n {healthScore.readingsCount >= 2\n ? `${trendArrow(healthScore.trendDirection)} ${healthScore.trendDelta >= 0 ? '+' : ''}${healthScore.trendDelta.toFixed(2)} NDVI vs previous reading (${formatNdvi(healthScore.previousNdvi)})`\n : `From ${healthScore.readingsCount} reading(s) — refresh again for a trend.`}\n </p>\n </ChartCard>\n\n <ChartCard title={`Stressed Zones Detected: ${stressedZones.length}`}>\n {stressedZones.length === 0 ? (\n <p className=\"py-2 text-sm text-text-secondary\">No stressed zones on the latest reading. 🎉</p>\n ) : (\n <ul className=\"space-y-2\">\n {stressedZones.map((z) => (\n <li key={z.id} className=\"rounded-lg border border-border-subtle p-2.5\">\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <span\n className={`h-2.5 w-2.5 rounded-full ${z.severity === 'HIGH' ? 'bg-destructive' : z.severity === 'MEDIUM' ? 'bg-warning' : 'bg-warning/60'}`}\n />\n {z.label} — {reasonLabel(z.reason)}\n </span>\n <StatusBadge\n label={z.status}\n variant={z.status === 'ESCALATED' ? 'info' : severityVariant(z.severity)}\n />\n </div>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {z.reasonDetail} · NDVI {formatNdvi(z.zoneNdvi)} ({z.deltaPct}% vs field avg)\n </p>\n {z.status !== 'ESCALATED' && (\n <div className=\"mt-2 flex gap-2\">\n <Button variant=\"outline\" size=\"sm\" onClick={() => setEscalateZone(z)}>\n <Bug className=\"me-1 h-3.5 w-3.5\" /> Escalate\n </Button>\n </div>\n )}\n </li>\n ))}\n </ul>\n )}\n </ChartCard>\n\n {yieldForecast && (\n <ChartCard title=\"Yield Forecast\">\n <YieldForecastMini forecast={yieldForecast} />\n </ChartCard>\n )}\n </div>\n </div>\n )}\n\n {tab === 'simulation' && <YieldSimulationPanel fieldId={fieldId} field={field} baseForecast={yieldForecast} />}\n {tab === 'compare' && <NdviComparePanel fieldId={fieldId} />}\n {tab === 'report' && <YieldReportPanel data={data} />}\n\n {/* Escalate modal */}\n {escalateZone && (\n <Modal open onClose={() => setEscalateZone(null)} title={`Escalate ${escalateZone.label}`}>\n <p className=\"text-sm text-text-secondary\">{escalateZone.reasonDetail ?? reasonLabel(escalateZone.reason)}</p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n NDVI {formatNdvi(escalateZone.zoneNdvi)} ({escalateZone.deltaPct}% vs field average).\n </p>\n <div className=\"mt-4 flex flex-col gap-2 sm:flex-row\">\n <Button className=\"flex-1\" onClick={() => void doEscalate('PEST')} disabled={escalating}>\n <Bug className=\"me-1.5 h-4 w-4\" /> Create Pest Issue\n </Button>\n <Button variant=\"outline\" className=\"flex-1\" onClick={() => void doEscalate('TASK')} disabled={escalating}>\n <ClipboardList className=\"me-1.5 h-4 w-4\" /> Create Task\n </Button>\n </div>\n </Modal>\n )}\n </PageLayout>\n );\n};\n\nconst MiniSwatch: FC<{ band: string; ndvi: number }> = ({ band, ndvi }) => {\n const bg =\n band === 'STRESSED'\n ? '#d73027'\n : band === 'BELOW_AVERAGE'\n ? '#fee08b'\n : band === 'EXCELLENT'\n ? '#1a9850'\n : '#66bd63';\n return (\n <div\n className=\"h-14 w-full rounded-md ring-1 ring-border-subtle\"\n style={{ background: `linear-gradient(135deg, ${bg}, ${bg}cc)`, opacity: 0.35 + ndvi * 0.6 }}\n aria-hidden\n />\n );\n};\n\nexport const YieldForecastMini: FC<{ forecast: FieldCropHealth['yieldForecast'] }> = ({ forecast }) => {\n const chartData = useMemo(\n () =>\n (forecast?.trajectory ?? []).map((p) => ({\n label: p.label,\n simulated: p.simulated,\n band: [p.lower, p.upper] as [number, number],\n })),\n [forecast]\n );\n if (!forecast) return null;\n return (\n <div>\n <ResponsiveContainer width=\"100%\" height={130}>\n <ComposedChart data={chartData} margin={{ top: 5, right: 8, left: -18, bottom: 0 }}>\n <defs>\n <linearGradient id=\"yieldBand\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"5%\" stopColor=\"var(--color-success)\" stopOpacity={0.28} />\n <stop offset=\"95%\" stopColor=\"var(--color-success)\" stopOpacity={0.04} />\n </linearGradient>\n </defs>\n <CartesianGrid strokeDasharray=\"3 3\" className=\"stroke-border\" />\n <XAxis dataKey=\"label\" className=\"text-[10px]\" tick={{ fill: 'currentColor' }} />\n <YAxis className=\"text-[10px]\" tick={{ fill: 'currentColor' }} width={28} />\n <Tooltip\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: 8,\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n />\n <Area dataKey=\"band\" stroke=\"none\" fill=\"url(#yieldBand)\" isAnimationActive={false} />\n <Line\n dataKey=\"simulated\"\n stroke=\"var(--color-success)\"\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n </ComposedChart>\n </ResponsiveContainer>\n <div className=\"mt-2 flex items-end justify-between\">\n <div>\n <div className=\"text-3xl font-bold tabular-nums text-text-primary\">\n {formatTonnes(forecast.estimatedTonnes)}{' '}\n <span className=\"text-base font-medium text-text-secondary\">t</span>\n </div>\n <div className=\"text-xs text-text-secondary\">\n ± {formatTonnes(forecast.confidenceBand)} t · {forecast.confidenceLabel.toLowerCase()} confidence\n </div>\n </div>\n {forecast.harvestWindowLabel && (\n <div className=\"text-end\">\n <div className=\"text-xs text-text-secondary\">Harvest window</div>\n <div className=\"text-sm font-medium text-text-primary\">{forecast.harvestWindowLabel}</div>\n </div>\n )}\n </div>\n <p className=\"mt-2 text-[11px] leading-snug text-text-secondary\">\n Estimate only — not a guarantee. {forecast.readingsUsed} reading(s) used.\n </p>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,UAAqC;CAChD,IAAM,EAAE,aAAU,OAAO,GAAW,EAC9B,EAAE,WAAQ,IAAiB,EAC3B,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,EAC7B,EAAE,aAAU,GAAU,EAEtB,CAAC,GAAM,KAAW,EAAiC,KAAK,EACxD,CAAC,GAAS,KAAc,EAAS,GAAK,EACtC,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAY,KAAiB,EAAS,GAAM,EAC7C,CAAC,GAAK,KAAU,EAAc,WAAW,EACzC,CAAC,GA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Aa;MACb,KAAK;MACL,mBAAmB;MACnB,CAAA;KACY;;GACI,CAAA;EACtB,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,EAAa,EAAS,gBAAgB;KAAE;KACzC,kBAAC,QAAD;MAAM,WAAU;gBAA4C;MAAQ,CAAA;KAChE;OACN,kBAAC,OAAD;IAAK,WAAU;cAAf;KAA6C;KACxC,EAAa,EAAS,eAAe;KAAC;KAAM,EAAS,gBAAgB,aAAa;KAAC;KAClF;MACF,EAAA,CAAA,EACL,EAAS,sBACR,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAA8B;KAAoB,CAAA,EACjE,kBAAC,OAAD;KAAK,WAAU;eAAyC,EAAS;KAAyB,CAAA,CACtF;MAEJ;;EACN,kBAAC,KAAD;GAAG,WAAU;aAAb;IAAiE;IAC7B,EAAS;IAAa;IACtD;;EACA,EAAA,CAAA,GApDc"}
|
|
1
|
+
{"version":3,"file":"SatelliteFieldDetailPage.js","names":[],"sources":["../../../../src/healthybowl/pages/satellite/SatelliteFieldDetailPage.tsx"],"sourcesContent":["/**\n * Satellite Crop Health & Yield Forecast — per-field detail (BOFF-2886).\n *\n * The hub for one field: NDVI heatmap clipped to the field polygon with stressed-\n * zone pins + legend, a Field Health Score card with trend, a Stressed Zones card\n * (escalatable to a Pest issue or a Task), a transparent Yield Forecast card, and an\n * NDVI-over-time timeline. Tabs switch to Yield Simulation, NDVI Comparison and the\n * printable Season Yield Report. Live gateway data — no mocks.\n */\nimport { type FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { useParams, useNavigate } from 'react-router';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { RefreshCw, ArrowLeft, Bug, ClipboardList, TrendingUp, TrendingDown, Minus } from 'lucide-react';\nimport { ResponsiveContainer, ComposedChart, Area, Line, XAxis, YAxis, CartesianGrid, Tooltip } from 'recharts';\nimport { PageLayout, ChartCard, StatusBadge, ErrorState, PageLoader, Modal } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { useSatelliteApi } from './useSatelliteApi';\nimport { NdviHeatmapMap } from './NdviHeatmapMap';\nimport { YieldSimulationPanel } from './YieldSimulationPanel';\nimport { NdviComparePanel } from './NdviComparePanel';\nimport { YieldReportPanel } from './YieldReportPanel';\nimport type { FieldCropHealth, StressedZone } from './satelliteApi';\nimport {\n formatDate,\n formatNdvi,\n formatTonnes,\n healthBandVariant,\n ndviSourceBadge,\n reasonLabel,\n severityVariant,\n trendArrow,\n} from './ndviColors';\n\ntype Tab = 'overview' | 'simulation' | 'compare' | 'report';\n\nexport const SatelliteFieldDetailPage: FC = () => {\n const { fieldId = '' } = useParams();\n const { api } = useSatelliteApi();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { toast } = useToast();\n\n const [data, setData] = useState<FieldCropHealth | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [refreshing, setRefreshing] = useState(false);\n const [tab, setTab] = useState<Tab>('overview');\n const [escalateZone, setEscalateZone] = useState<StressedZone | null>(null);\n const [escalating, setEscalating] = useState(false);\n\n const load = useCallback(async () => {\n setError(null);\n try {\n setData(await api.getFieldCropHealth(fieldId));\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Failed to load field crop health.');\n } finally {\n setLoading(false);\n }\n }, [api, fieldId]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n const handleRefresh = useCallback(async () => {\n setRefreshing(true);\n try {\n const hasData = (data?.timeline.length ?? 0) > 0;\n const res = await api.refreshNdvi(fieldId, hasData ? 0 : 5);\n toast({\n title: 'NDVI refreshed',\n description: `${res.readingsCreated} reading(s), ${res.stressedZonesDetected} stressed zone(s) detected.`,\n variant: 'success',\n });\n await load();\n } catch (e) {\n toast({\n title: 'Refresh failed',\n description: e instanceof Error ? e.message : 'Unknown error',\n variant: 'error',\n });\n } finally {\n setRefreshing(false);\n }\n }, [api, fieldId, data, toast, load]);\n\n const doEscalate = useCallback(\n async (target: 'PEST' | 'TASK') => {\n if (!escalateZone) return;\n setEscalating(true);\n try {\n const res = await api.escalateZone(escalateZone.id, target);\n toast({\n title: target === 'PEST' ? 'Pest issue created' : 'Scouting task created',\n description: `${escalateZone.label} escalated. ${target === 'PEST' ? 'Track it under Pest Management.' : 'Track it under the field activity log.'}`,\n variant: 'success',\n });\n void res;\n setEscalateZone(null);\n await load();\n } catch (e) {\n toast({\n title: 'Escalation failed',\n description: e instanceof Error ? e.message : 'Unknown error',\n variant: 'error',\n });\n } finally {\n setEscalating(false);\n }\n },\n [api, escalateZone, toast, load]\n );\n\n if (loading) return <PageLoader />;\n if (error)\n return <ErrorState title=\"Couldn't load field crop health\" description={error} onRetry={() => void load()} />;\n if (!data) return null;\n\n const { field, healthScore, latestReading, stressedZones, timeline, yieldForecast } = data;\n const latestSourceBadge = latestReading ? ndviSourceBadge(latestReading.source, latestReading.cloudCoverPct) : null;\n const TrendIcon =\n healthScore.trendDirection === 'UP' ? TrendingUp : healthScore.trendDirection === 'DOWN' ? TrendingDown : Minus;\n\n return (\n <PageLayout\n title=\"Satellite Crop Health & Yield Forecast\"\n description={`Field: ${field.name} · ${field.areaAcres.toFixed(1)} ${field.unit}${field.cropName ? ` · ${field.cropName}${field.variety ? ` (${field.variety})` : ''}` : ''}${field.farmName ? ` · ${field.farmName}` : ''}`}\n helpPrompt=\"Explain this field's NDVI heatmap, stressed zones, health score and yield forecast.\"\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate(buildPath('satellite'))}>\n <ArrowLeft className=\"me-1.5 h-4 w-4\" /> All fields\n </Button>\n <Button size=\"sm\" onClick={() => void handleRefresh()} disabled={refreshing}>\n <RefreshCw className={`me-1.5 h-4 w-4 ${refreshing ? 'animate-spin' : ''}`} /> Refresh NDVI\n </Button>\n </div>\n }\n >\n {/* Tabs */}\n <div className=\"mb-4 flex flex-wrap gap-1 border-b border-border-subtle\">\n {(\n [\n ['overview', 'Overview'],\n ['simulation', 'Yield Simulation'],\n ['compare', 'NDVI Comparison'],\n ['report', 'Season Report'],\n ] as [Tab, string][]\n ).map(([k, label]) => (\n <button\n key={k}\n onClick={() => setTab(k)}\n className={`-mb-px border-b-2 px-3 py-2 text-sm font-medium transition-colors ${\n tab === k\n ? 'border-accent-teal text-text-primary'\n : 'border-transparent text-text-secondary hover:text-text-primary'\n }`}\n >\n {label}\n </button>\n ))}\n </div>\n\n {!field.hasBoundary && (\n <div className=\"mb-4 rounded-lg border border-warning/40 bg-warning/10 p-3 text-sm text-text-primary\">\n This field has no saved boundary yet, so no NDVI heatmap can be clipped to it. Draw the field boundary on the{' '}\n <button className=\"underline\" onClick={() => navigate(buildPath('field-map'))}>\n Field Map\n </button>{' '}\n first.\n </div>\n )}\n\n {tab === 'overview' && (\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n {/* Map */}\n <div className=\"lg:col-span-2\">\n {latestReading && latestSourceBadge && (\n <div className=\"mb-2 flex items-center justify-between gap-2\">\n <span className=\"text-xs text-text-secondary\">\n Latest reading · {formatDate(latestReading.capturedDate)}\n </span>\n <StatusBadge\n label={latestSourceBadge.label}\n variant={latestSourceBadge.variant}\n dot={latestSourceBadge.variant === 'info'}\n />\n </div>\n )}\n <NdviHeatmapMap\n boundary={field.boundary}\n grid={latestReading?.grid ?? null}\n zones={stressedZones}\n onZoneClick={(id) => {\n const z = stressedZones.find((zz) => zz.id === id);\n if (z) setEscalateZone(z);\n }}\n />\n {/* NDVI over time */}\n <ChartCard title=\"NDVI over time\" className=\"mt-4\">\n {timeline.length === 0 ? (\n <p className=\"py-6 text-center text-sm text-text-secondary\">No readings yet — refresh NDVI.</p>\n ) : (\n <div className=\"flex gap-3 overflow-x-auto pb-1\">\n {timeline.map((t) => (\n <div key={t.readingId} className=\"flex min-w-[92px] flex-col items-center\">\n <MiniSwatch band={t.healthBand} ndvi={t.meanNdvi} />\n <span className=\"mt-1 text-xs font-medium text-text-primary\">{formatNdvi(t.meanNdvi)}</span>\n <span className=\"text-[11px] text-text-secondary\">{formatDate(t.capturedDate)}</span>\n </div>\n ))}\n </div>\n )}\n </ChartCard>\n </div>\n\n {/* Right column: health score, stressed zones, yield */}\n <div className=\"flex flex-col gap-4\">\n <ChartCard title=\"Field Health Score\">\n <div className=\"flex items-start justify-between\">\n <div>\n <div className=\"text-4xl font-bold tabular-nums text-text-primary\">\n {formatNdvi(healthScore.meanNdvi)}{' '}\n <span className=\"text-lg font-medium text-text-secondary\">NDVI</span>\n </div>\n <div className=\"mt-1\">\n <StatusBadge label={healthScore.healthLabel} variant={healthBandVariant(healthScore.healthBand)} />\n </div>\n </div>\n <div\n className={`flex items-center gap-1 rounded-md px-2 py-1 text-sm ${\n healthScore.trendDirection === 'DOWN'\n ? 'text-destructive'\n : healthScore.trendDirection === 'UP'\n ? 'text-success'\n : 'text-text-secondary'\n }`}\n >\n <TrendIcon className=\"h-4 w-4\" />\n {healthScore.readingsCount >= 2 ? `${Math.abs(healthScore.trendPct).toFixed(1)}%` : '—'}\n </div>\n </div>\n <p className=\"mt-2 text-xs text-text-secondary\">\n {healthScore.readingsCount >= 2\n ? `${trendArrow(healthScore.trendDirection)} ${healthScore.trendDelta >= 0 ? '+' : ''}${healthScore.trendDelta.toFixed(2)} NDVI vs previous reading (${formatNdvi(healthScore.previousNdvi)})`\n : `From ${healthScore.readingsCount} reading(s) — refresh again for a trend.`}\n </p>\n </ChartCard>\n\n <ChartCard title={`Stressed Zones Detected: ${stressedZones.length}`}>\n {stressedZones.length === 0 ? (\n <p className=\"py-2 text-sm text-text-secondary\">No stressed zones on the latest reading. 🎉</p>\n ) : (\n <ul className=\"space-y-2\">\n {stressedZones.map((z) => (\n <li key={z.id} className=\"rounded-lg border border-border-subtle p-2.5\">\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <span\n className={`h-2.5 w-2.5 rounded-full ${z.severity === 'HIGH' ? 'bg-destructive' : z.severity === 'MEDIUM' ? 'bg-warning' : 'bg-warning/60'}`}\n />\n {z.label} — {reasonLabel(z.reason)}\n </span>\n <StatusBadge\n label={z.status}\n variant={z.status === 'ESCALATED' ? 'info' : severityVariant(z.severity)}\n />\n </div>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {z.reasonDetail} · NDVI {formatNdvi(z.zoneNdvi)} ({z.deltaPct}% vs field avg)\n </p>\n {z.status !== 'ESCALATED' && (\n <div className=\"mt-2 flex gap-2\">\n <Button variant=\"outline\" size=\"sm\" onClick={() => setEscalateZone(z)}>\n <Bug className=\"me-1 h-3.5 w-3.5\" /> Escalate\n </Button>\n </div>\n )}\n </li>\n ))}\n </ul>\n )}\n </ChartCard>\n\n {yieldForecast && (\n <ChartCard title=\"Yield Forecast\">\n <YieldForecastMini forecast={yieldForecast} />\n </ChartCard>\n )}\n </div>\n </div>\n )}\n\n {tab === 'simulation' && <YieldSimulationPanel fieldId={fieldId} field={field} baseForecast={yieldForecast} />}\n {tab === 'compare' && <NdviComparePanel fieldId={fieldId} />}\n {tab === 'report' && <YieldReportPanel data={data} />}\n\n {/* Escalate modal */}\n {escalateZone && (\n <Modal open onClose={() => setEscalateZone(null)} title={`Escalate ${escalateZone.label}`}>\n <p className=\"text-sm text-text-secondary\">{escalateZone.reasonDetail ?? reasonLabel(escalateZone.reason)}</p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n NDVI {formatNdvi(escalateZone.zoneNdvi)} ({escalateZone.deltaPct}% vs field average).\n </p>\n <div className=\"mt-4 flex flex-col gap-2 sm:flex-row\">\n <Button className=\"flex-1\" onClick={() => void doEscalate('PEST')} disabled={escalating}>\n <Bug className=\"me-1.5 h-4 w-4\" /> Create Pest Issue\n </Button>\n <Button variant=\"outline\" className=\"flex-1\" onClick={() => void doEscalate('TASK')} disabled={escalating}>\n <ClipboardList className=\"me-1.5 h-4 w-4\" /> Create Task\n </Button>\n </div>\n </Modal>\n )}\n </PageLayout>\n );\n};\n\nconst MiniSwatch: FC<{ band: string; ndvi: number }> = ({ band, ndvi }) => {\n const bg =\n band === 'STRESSED'\n ? '#d73027'\n : band === 'BELOW_AVERAGE'\n ? '#fee08b'\n : band === 'EXCELLENT'\n ? '#1a9850'\n : '#66bd63';\n return (\n <div\n className=\"h-14 w-full rounded-md ring-1 ring-border-subtle\"\n style={{ background: `linear-gradient(135deg, ${bg}, ${bg}cc)`, opacity: 0.35 + ndvi * 0.6 }}\n aria-hidden\n />\n );\n};\n\nexport const YieldForecastMini: FC<{ forecast: FieldCropHealth['yieldForecast'] }> = ({ forecast }) => {\n const chartData = useMemo(\n () =>\n (forecast?.trajectory ?? []).map((p) => ({\n label: p.label,\n simulated: p.simulated,\n band: [p.lower, p.upper] as [number, number],\n })),\n [forecast]\n );\n if (!forecast) return null;\n return (\n <div>\n <ResponsiveContainer width=\"100%\" height={130}>\n <ComposedChart data={chartData} margin={{ top: 5, right: 8, left: -18, bottom: 0 }}>\n <defs>\n <linearGradient id=\"yieldBand\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"5%\" stopColor=\"var(--color-success)\" stopOpacity={0.28} />\n <stop offset=\"95%\" stopColor=\"var(--color-success)\" stopOpacity={0.04} />\n </linearGradient>\n </defs>\n <CartesianGrid strokeDasharray=\"3 3\" className=\"stroke-border\" />\n <XAxis dataKey=\"label\" className=\"text-[10px]\" tick={{ fill: 'currentColor' }} />\n <YAxis className=\"text-[10px]\" tick={{ fill: 'currentColor' }} width={28} />\n <Tooltip\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: 8,\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n />\n <Area dataKey=\"band\" stroke=\"none\" fill=\"url(#yieldBand)\" isAnimationActive={false} />\n <Line\n dataKey=\"simulated\"\n stroke=\"var(--color-success)\"\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n </ComposedChart>\n </ResponsiveContainer>\n <div className=\"mt-2 flex items-end justify-between\">\n <div>\n <div className=\"text-3xl font-bold tabular-nums text-text-primary\">\n {formatTonnes(forecast.estimatedTonnes)}{' '}\n <span className=\"text-base font-medium text-text-secondary\">t</span>\n </div>\n <div className=\"text-xs text-text-secondary\">\n ± {formatTonnes(forecast.confidenceBand)} t · {forecast.confidenceLabel.toLowerCase()} confidence\n </div>\n </div>\n {forecast.harvestWindowLabel && (\n <div className=\"text-end\">\n <div className=\"text-xs text-text-secondary\">Harvest window</div>\n <div className=\"text-sm font-medium text-text-primary\">{forecast.harvestWindowLabel}</div>\n </div>\n )}\n </div>\n <p className=\"mt-2 text-[11px] leading-snug text-text-secondary\">\n Estimate only — not a guarantee. {forecast.readingsUsed} reading(s) used.\n </p>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAa,UAAqC;CAChD,IAAM,EAAE,aAAU,OAAO,IAAW,EAC9B,EAAE,WAAQ,IAAiB,EAC3B,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,EAC7B,EAAE,aAAU,GAAU,EAEtB,CAAC,GAAM,KAAW,EAAiC,KAAK,EACxD,CAAC,GAAS,KAAc,EAAS,GAAK,EACtC,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAY,KAAiB,EAAS,GAAM,EAC7C,CAAC,GAAK,KAAU,EAAc,WAAW,EACzC,CAAC,GAAc,KAAmB,EAA8B,KAAK,EACrE,CAAC,GAAY,KAAiB,EAAS,GAAM,EAE7C,IAAO,EAAY,YAAY;AACnC,IAAS,KAAK;AACd,MAAI;AACF,KAAQ,MAAM,EAAI,mBAAmB,EAAQ,CAAC;WACvC,GAAG;AACV,KAAS,aAAa,QAAQ,EAAE,UAAU,oCAAoC;YACtE;AACR,KAAW,GAAM;;IAElB,CAAC,GAAK,EAAQ,CAAC;AAElB,S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MACP,aAAa;MACb,KAAK;MACL,mBAAmB;MACnB,CAAA;KACY;;GACI,CAAA;EACtB,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,EAAa,EAAS,gBAAgB;KAAE;KACzC,kBAAC,QAAD;MAAM,WAAU;gBAA4C;MAAQ,CAAA;KAChE;OACN,kBAAC,OAAD;IAAK,WAAU;cAAf;KAA6C;KACxC,EAAa,EAAS,eAAe;KAAC;KAAM,EAAS,gBAAgB,aAAa;KAAC;KAClF;MACF,EAAA,CAAA,EACL,EAAS,sBACR,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAA8B;KAAoB,CAAA,EACjE,kBAAC,OAAD;KAAK,WAAU;eAAyC,EAAS;KAAyB,CAAA,CACtF;MAEJ;;EACN,kBAAC,KAAD;GAAG,WAAU;aAAb;IAAiE;IAC7B,EAAS;IAAa;IACtD;;EACA,EAAA,CAAA,GApDc"}
|
|
@@ -7,14 +7,14 @@ import { PageLoader as a } from "../../components/PageLoader.js";
|
|
|
7
7
|
import { useToast as o } from "../../hooks/useToast.js";
|
|
8
8
|
import "../../components/index.js";
|
|
9
9
|
import { useSatelliteApi as s } from "./useSatelliteApi.js";
|
|
10
|
-
import { formatDate as c } from "./ndviColors.js";
|
|
11
|
-
import { useCallback as
|
|
12
|
-
import { ArrowLeft as
|
|
13
|
-
import { useNavigate as
|
|
14
|
-
import { jsx as
|
|
15
|
-
import { Button as
|
|
10
|
+
import { formatDate as c, pullSourceLabel as l } from "./ndviColors.js";
|
|
11
|
+
import { useCallback as u, useEffect as d, useState as f } from "react";
|
|
12
|
+
import { ArrowLeft as p, CheckCircle2 as m, Save as h } from "lucide-react";
|
|
13
|
+
import { useNavigate as g } from "react-router";
|
|
14
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
15
|
+
import { Button as y, Switch as b } from "@burdenoff/fe-libs/ui";
|
|
16
16
|
//#region src/healthybowl/pages/satellite/SatelliteSettingsPage.tsx
|
|
17
|
-
var
|
|
17
|
+
var x = [
|
|
18
18
|
{
|
|
19
19
|
key: "DAILY",
|
|
20
20
|
label: "Daily"
|
|
@@ -27,7 +27,7 @@ var b = [
|
|
|
27
27
|
key: "WEEKLY",
|
|
28
28
|
label: "Weekly"
|
|
29
29
|
}
|
|
30
|
-
],
|
|
30
|
+
], S = [
|
|
31
31
|
{
|
|
32
32
|
key: "LOW",
|
|
33
33
|
label: "Low"
|
|
@@ -40,157 +40,157 @@ var b = [
|
|
|
40
40
|
key: "HIGH",
|
|
41
41
|
label: "High"
|
|
42
42
|
}
|
|
43
|
-
],
|
|
43
|
+
], C = [
|
|
44
44
|
12,
|
|
45
45
|
24,
|
|
46
46
|
36
|
|
47
|
-
],
|
|
48
|
-
let { api:
|
|
49
|
-
|
|
47
|
+
], w = () => {
|
|
48
|
+
let { api: b } = s(), w = g(), { buildPath: D } = e(), { toast: O } = o(), [k, A] = f(null), [j, M] = f(!0), [N, P] = f(null), [F, I] = f(!1), L = u(async () => {
|
|
49
|
+
P(null);
|
|
50
50
|
try {
|
|
51
|
-
|
|
51
|
+
A(await b.getSettings());
|
|
52
52
|
} catch (e) {
|
|
53
|
-
|
|
53
|
+
P(e instanceof Error ? e.message : "Failed to load settings.");
|
|
54
54
|
} finally {
|
|
55
|
-
|
|
55
|
+
M(!1);
|
|
56
56
|
}
|
|
57
|
-
}, [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, [
|
|
61
|
-
let
|
|
57
|
+
}, [b]);
|
|
58
|
+
d(() => {
|
|
59
|
+
L();
|
|
60
|
+
}, [L]);
|
|
61
|
+
let R = (e) => A((t) => t && {
|
|
62
62
|
...t,
|
|
63
63
|
...e
|
|
64
|
-
}),
|
|
65
|
-
if (
|
|
66
|
-
|
|
64
|
+
}), z = u(async () => {
|
|
65
|
+
if (k) {
|
|
66
|
+
I(!0);
|
|
67
67
|
try {
|
|
68
|
-
|
|
69
|
-
provider:
|
|
70
|
-
refreshSchedule:
|
|
71
|
-
fetchNdvi:
|
|
72
|
-
fetchEvi:
|
|
73
|
-
fetchNdmi:
|
|
74
|
-
stressSensitivity:
|
|
75
|
-
dataRetentionMonths:
|
|
76
|
-
})),
|
|
68
|
+
A(await b.updateSettings({
|
|
69
|
+
provider: k.provider,
|
|
70
|
+
refreshSchedule: k.refreshSchedule,
|
|
71
|
+
fetchNdvi: k.fetchNdvi,
|
|
72
|
+
fetchEvi: k.fetchEvi,
|
|
73
|
+
fetchNdmi: k.fetchNdmi,
|
|
74
|
+
stressSensitivity: k.stressSensitivity,
|
|
75
|
+
dataRetentionMonths: k.dataRetentionMonths
|
|
76
|
+
})), O({
|
|
77
77
|
title: "Settings saved",
|
|
78
78
|
variant: "success"
|
|
79
79
|
});
|
|
80
80
|
} catch (e) {
|
|
81
|
-
|
|
81
|
+
O({
|
|
82
82
|
title: "Save failed",
|
|
83
83
|
description: e instanceof Error ? e.message : "Unknown error",
|
|
84
84
|
variant: "error"
|
|
85
85
|
});
|
|
86
86
|
} finally {
|
|
87
|
-
|
|
87
|
+
I(!1);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}, [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
b,
|
|
92
|
+
k,
|
|
93
|
+
O
|
|
94
94
|
]);
|
|
95
|
-
return
|
|
95
|
+
return j ? /* @__PURE__ */ _(a, {}) : N ? /* @__PURE__ */ _(r, {
|
|
96
96
|
title: "Couldn't load settings",
|
|
97
|
-
description:
|
|
98
|
-
onRetry: () => void
|
|
99
|
-
}) :
|
|
97
|
+
description: N,
|
|
98
|
+
onRetry: () => void L()
|
|
99
|
+
}) : k ? /* @__PURE__ */ _(t, {
|
|
100
100
|
title: "Satellite Data Settings",
|
|
101
101
|
description: "Configure how HealthyBowl pulls and interprets satellite imagery for your fields.",
|
|
102
|
-
actions: /* @__PURE__ */
|
|
102
|
+
actions: /* @__PURE__ */ v("div", {
|
|
103
103
|
className: "flex items-center gap-2",
|
|
104
|
-
children: [/* @__PURE__ */
|
|
104
|
+
children: [/* @__PURE__ */ v(y, {
|
|
105
105
|
variant: "ghost",
|
|
106
106
|
size: "sm",
|
|
107
|
-
onClick: () =>
|
|
108
|
-
children: [/* @__PURE__ */
|
|
109
|
-
}), /* @__PURE__ */
|
|
107
|
+
onClick: () => w(D("satellite")),
|
|
108
|
+
children: [/* @__PURE__ */ _(p, { className: "me-1.5 h-4 w-4" }), " Back"]
|
|
109
|
+
}), /* @__PURE__ */ v(y, {
|
|
110
110
|
size: "sm",
|
|
111
|
-
onClick: () => void
|
|
112
|
-
disabled:
|
|
113
|
-
children: [/* @__PURE__ */
|
|
111
|
+
onClick: () => void z(),
|
|
112
|
+
disabled: F,
|
|
113
|
+
children: [/* @__PURE__ */ _(h, { className: "me-1.5 h-4 w-4" }), " Save changes"]
|
|
114
114
|
})]
|
|
115
115
|
}),
|
|
116
|
-
children: /* @__PURE__ */
|
|
116
|
+
children: /* @__PURE__ */ v("div", {
|
|
117
117
|
className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ _("div", {
|
|
119
119
|
className: "space-y-4 lg:col-span-2",
|
|
120
|
-
children: /* @__PURE__ */
|
|
120
|
+
children: /* @__PURE__ */ _(i, {
|
|
121
121
|
title: "Ingestion",
|
|
122
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ v("div", {
|
|
123
123
|
className: "space-y-5",
|
|
124
124
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ _(T, {
|
|
126
126
|
label: "Satellite provider",
|
|
127
|
-
children: /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ v("div", {
|
|
128
128
|
className: "flex items-center gap-2",
|
|
129
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ _("span", {
|
|
130
130
|
className: "text-sm font-medium text-text-primary",
|
|
131
131
|
children: "Sentinel-2 (via partner API)"
|
|
132
|
-
}), /* @__PURE__ */
|
|
132
|
+
}), /* @__PURE__ */ _(n, {
|
|
133
133
|
label: "Connected",
|
|
134
134
|
variant: "success",
|
|
135
135
|
dot: !0
|
|
136
136
|
})]
|
|
137
137
|
})
|
|
138
138
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ _(T, {
|
|
140
140
|
label: "Refresh schedule",
|
|
141
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ _("div", {
|
|
142
142
|
className: "flex flex-wrap gap-2",
|
|
143
|
-
children:
|
|
143
|
+
children: x.map((e) => /* @__PURE__ */ _(y, {
|
|
144
144
|
size: "sm",
|
|
145
|
-
variant:
|
|
146
|
-
onClick: () =>
|
|
145
|
+
variant: k.refreshSchedule === e.key ? "default" : "outline",
|
|
146
|
+
onClick: () => R({ refreshSchedule: e.key }),
|
|
147
147
|
children: e.label
|
|
148
148
|
}, e.key))
|
|
149
149
|
})
|
|
150
150
|
}),
|
|
151
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ _(T, {
|
|
152
152
|
label: "Indices to fetch",
|
|
153
|
-
children: /* @__PURE__ */
|
|
153
|
+
children: /* @__PURE__ */ v("div", {
|
|
154
154
|
className: "flex flex-wrap items-center gap-6",
|
|
155
155
|
children: [
|
|
156
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ _(E, {
|
|
157
157
|
label: "NDVI",
|
|
158
|
-
checked:
|
|
159
|
-
onChange: (e) =>
|
|
158
|
+
checked: k.fetchNdvi,
|
|
159
|
+
onChange: (e) => R({ fetchNdvi: e })
|
|
160
160
|
}),
|
|
161
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ _(E, {
|
|
162
162
|
label: "EVI",
|
|
163
|
-
checked:
|
|
164
|
-
onChange: (e) =>
|
|
163
|
+
checked: k.fetchEvi,
|
|
164
|
+
onChange: (e) => R({ fetchEvi: e })
|
|
165
165
|
}),
|
|
166
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ _(E, {
|
|
167
167
|
label: "NDMI",
|
|
168
|
-
checked:
|
|
169
|
-
onChange: (e) =>
|
|
168
|
+
checked: k.fetchNdmi,
|
|
169
|
+
onChange: (e) => R({ fetchNdmi: e })
|
|
170
170
|
})
|
|
171
171
|
]
|
|
172
172
|
})
|
|
173
173
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ _(T, {
|
|
175
175
|
label: "Stressed-zone sensitivity",
|
|
176
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ _("div", {
|
|
177
177
|
className: "flex flex-wrap gap-2",
|
|
178
|
-
children:
|
|
178
|
+
children: S.map((e) => /* @__PURE__ */ _(y, {
|
|
179
179
|
size: "sm",
|
|
180
|
-
variant:
|
|
181
|
-
onClick: () =>
|
|
180
|
+
variant: k.stressSensitivity === e.key ? "default" : "outline",
|
|
181
|
+
onClick: () => R({ stressSensitivity: e.key }),
|
|
182
182
|
children: e.label
|
|
183
183
|
}, e.key))
|
|
184
184
|
})
|
|
185
185
|
}),
|
|
186
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ _(T, {
|
|
187
187
|
label: "Data retention",
|
|
188
|
-
children: /* @__PURE__ */
|
|
188
|
+
children: /* @__PURE__ */ _("div", {
|
|
189
189
|
className: "flex flex-wrap gap-2",
|
|
190
|
-
children:
|
|
190
|
+
children: C.map((e) => /* @__PURE__ */ v(y, {
|
|
191
191
|
size: "sm",
|
|
192
|
-
variant:
|
|
193
|
-
onClick: () =>
|
|
192
|
+
variant: k.dataRetentionMonths === e ? "default" : "outline",
|
|
193
|
+
onClick: () => R({ dataRetentionMonths: e }),
|
|
194
194
|
children: [
|
|
195
195
|
"Keep ",
|
|
196
196
|
e,
|
|
@@ -202,51 +202,51 @@ var b = [
|
|
|
202
202
|
]
|
|
203
203
|
})
|
|
204
204
|
})
|
|
205
|
-
}), /* @__PURE__ */
|
|
205
|
+
}), /* @__PURE__ */ _(i, {
|
|
206
206
|
title: "Last successful pull",
|
|
207
|
-
children:
|
|
207
|
+
children: k.lastPullAt ? /* @__PURE__ */ v("ul", {
|
|
208
208
|
className: "space-y-2 text-sm text-text-secondary",
|
|
209
209
|
children: [
|
|
210
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ v("li", {
|
|
211
211
|
className: "flex items-center gap-2",
|
|
212
212
|
children: [
|
|
213
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ _(m, { className: "h-4 w-4 text-success" }),
|
|
214
214
|
" ",
|
|
215
|
-
c(
|
|
215
|
+
c(k.lastPullAt)
|
|
216
216
|
]
|
|
217
217
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ v("li", { children: [
|
|
219
219
|
"· ",
|
|
220
|
-
|
|
220
|
+
k.lastPullFieldCount ?? 0,
|
|
221
221
|
" field(s) updated"
|
|
222
222
|
] }),
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
|
|
223
|
+
/* @__PURE__ */ v("li", { children: ["· via ", l(k.lastPullSource)] }),
|
|
224
|
+
k.nextPullAt && /* @__PURE__ */ v("li", { children: ["· Next pull: ", c(k.nextPullAt)] })
|
|
225
225
|
]
|
|
226
|
-
}) : /* @__PURE__ */
|
|
226
|
+
}) : /* @__PURE__ */ _("p", {
|
|
227
227
|
className: "text-sm text-text-secondary",
|
|
228
228
|
children: "No pull yet. Use “Refresh NDVI” on the Satellite Crop Health page."
|
|
229
229
|
})
|
|
230
230
|
})]
|
|
231
231
|
})
|
|
232
232
|
}) : null;
|
|
233
|
-
},
|
|
233
|
+
}, T = ({ label: e, children: t }) => /* @__PURE__ */ v("div", {
|
|
234
234
|
className: "grid grid-cols-1 gap-2 sm:grid-cols-[200px_1fr] sm:items-center",
|
|
235
|
-
children: [/* @__PURE__ */
|
|
235
|
+
children: [/* @__PURE__ */ _("label", {
|
|
236
236
|
className: "text-sm font-medium text-text-primary",
|
|
237
237
|
children: e
|
|
238
|
-
}), /* @__PURE__ */
|
|
239
|
-
}),
|
|
238
|
+
}), /* @__PURE__ */ _("div", { children: t })]
|
|
239
|
+
}), E = ({ label: e, checked: t, onChange: n }) => /* @__PURE__ */ v("label", {
|
|
240
240
|
className: "flex items-center gap-2",
|
|
241
|
-
children: [/* @__PURE__ */
|
|
241
|
+
children: [/* @__PURE__ */ _(b, {
|
|
242
242
|
checked: t,
|
|
243
243
|
onCheckedChange: n
|
|
244
|
-
}), /* @__PURE__ */
|
|
244
|
+
}), /* @__PURE__ */ _("span", {
|
|
245
245
|
className: "text-sm text-text-primary",
|
|
246
246
|
children: e
|
|
247
247
|
})]
|
|
248
248
|
});
|
|
249
249
|
//#endregion
|
|
250
|
-
export {
|
|
250
|
+
export { w as SatelliteSettingsPage };
|
|
251
251
|
|
|
252
252
|
//# sourceMappingURL=SatelliteSettingsPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SatelliteSettingsPage.js","names":[],"sources":["../../../../src/healthybowl/pages/satellite/SatelliteSettingsPage.tsx"],"sourcesContent":["/**\n * Satellite Data Settings (BOFF-2886).\n *\n * Per-workspace ingestion settings: provider, refresh cadence, indices to fetch,\n * stressed-zone sensitivity and data retention — plus a \"last successful pull\"\n * summary. The scheduled pull runs as a FluidGrids cron → the\n * `refreshHealthyBowlFieldNdvi` mutation (M2M). Live gateway — no mocks.\n */\nimport { type FC, type ReactNode, useCallback, useEffect, useState } from 'react';\nimport { useNavigate } from 'react-router';\nimport { Button, Switch } from '@burdenoff/fe-libs/ui';\nimport { ArrowLeft, CheckCircle2, Save } from 'lucide-react';\nimport { PageLayout, ChartCard, StatusBadge, ErrorState, PageLoader } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { useSatelliteApi } from './useSatelliteApi';\nimport type { SatelliteSettings } from './satelliteApi';\nimport { formatDate } from './ndviColors';\n\nconst SCHEDULES: Array<{ key: string; label: string }> = [\n { key: 'DAILY', label: 'Daily' },\n { key: 'EVERY_3_DAYS', label: 'Every 3 days' },\n { key: 'WEEKLY', label: 'Weekly' },\n];\nconst SENSITIVITIES: Array<{ key: string; label: string }> = [\n { key: 'LOW', label: 'Low' },\n { key: 'MEDIUM', label: 'Medium' },\n { key: 'HIGH', label: 'High' },\n];\nconst RETENTIONS = [12, 24, 36];\n\nexport const SatelliteSettingsPage: FC = () => {\n const { api } = useSatelliteApi();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { toast } = useToast();\n\n const [settings, setSettings] = useState<SatelliteSettings | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [saving, setSaving] = useState(false);\n\n const load = useCallback(async () => {\n setError(null);\n try {\n setSettings(await api.getSettings());\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Failed to load settings.');\n } finally {\n setLoading(false);\n }\n }, [api]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n const patch = (p: Partial<SatelliteSettings>) => setSettings((s) => (s ? { ...s, ...p } : s));\n\n const save = useCallback(async () => {\n if (!settings) return;\n setSaving(true);\n try {\n const updated = await api.updateSettings({\n provider: settings.provider,\n refreshSchedule: settings.refreshSchedule,\n fetchNdvi: settings.fetchNdvi,\n fetchEvi: settings.fetchEvi,\n fetchNdmi: settings.fetchNdmi,\n stressSensitivity: settings.stressSensitivity,\n dataRetentionMonths: settings.dataRetentionMonths,\n });\n setSettings(updated);\n toast({ title: 'Settings saved', variant: 'success' });\n } catch (e) {\n toast({ title: 'Save failed', description: e instanceof Error ? e.message : 'Unknown error', variant: 'error' });\n } finally {\n setSaving(false);\n }\n }, [api, settings, toast]);\n\n if (loading) return <PageLoader />;\n if (error) return <ErrorState title=\"Couldn't load settings\" description={error} onRetry={() => void load()} />;\n if (!settings) return null;\n\n return (\n <PageLayout\n title=\"Satellite Data Settings\"\n description=\"Configure how HealthyBowl pulls and interprets satellite imagery for your fields.\"\n actions={\n <div className=\"flex items-center gap-2\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate(buildPath('satellite'))}>\n <ArrowLeft className=\"me-1.5 h-4 w-4\" /> Back\n </Button>\n <Button size=\"sm\" onClick={() => void save()} disabled={saving}>\n <Save className=\"me-1.5 h-4 w-4\" /> Save changes\n </Button>\n </div>\n }\n >\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <div className=\"space-y-4 lg:col-span-2\">\n <ChartCard title=\"Ingestion\">\n <div className=\"space-y-5\">\n <Row label=\"Satellite provider\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium text-text-primary\">Sentinel-2 (via partner API)</span>\n <StatusBadge label=\"Connected\" variant=\"success\" dot />\n </div>\n </Row>\n\n <Row label=\"Refresh schedule\">\n <div className=\"flex flex-wrap gap-2\">\n {SCHEDULES.map((s) => (\n <Button\n key={s.key}\n size=\"sm\"\n variant={settings.refreshSchedule === s.key ? 'default' : 'outline'}\n onClick={() => patch({ refreshSchedule: s.key })}\n >\n {s.label}\n </Button>\n ))}\n </div>\n </Row>\n\n <Row label=\"Indices to fetch\">\n <div className=\"flex flex-wrap items-center gap-6\">\n <Toggle label=\"NDVI\" checked={settings.fetchNdvi} onChange={(v) => patch({ fetchNdvi: v })} />\n <Toggle label=\"EVI\" checked={settings.fetchEvi} onChange={(v) => patch({ fetchEvi: v })} />\n <Toggle label=\"NDMI\" checked={settings.fetchNdmi} onChange={(v) => patch({ fetchNdmi: v })} />\n </div>\n </Row>\n\n <Row label=\"Stressed-zone sensitivity\">\n <div className=\"flex flex-wrap gap-2\">\n {SENSITIVITIES.map((s) => (\n <Button\n key={s.key}\n size=\"sm\"\n variant={settings.stressSensitivity === s.key ? 'default' : 'outline'}\n onClick={() => patch({ stressSensitivity: s.key })}\n >\n {s.label}\n </Button>\n ))}\n </div>\n </Row>\n\n <Row label=\"Data retention\">\n <div className=\"flex flex-wrap gap-2\">\n {RETENTIONS.map((m) => (\n <Button\n key={m}\n size=\"sm\"\n variant={settings.dataRetentionMonths === m ? 'default' : 'outline'}\n onClick={() => patch({ dataRetentionMonths: m })}\n >\n Keep {m} months\n </Button>\n ))}\n </div>\n </Row>\n </div>\n </ChartCard>\n </div>\n\n <ChartCard title=\"Last successful pull\">\n {settings.lastPullAt ? (\n <ul className=\"space-y-2 text-sm text-text-secondary\">\n <li className=\"flex items-center gap-2\">\n <CheckCircle2 className=\"h-4 w-4 text-success\" /> {formatDate(settings.lastPullAt)}\n </li>\n <li>· {settings.lastPullFieldCount ?? 0} field(s) updated</li>\n <li>\n · via {settings.lastPullSource === 'SENTINEL2_STUB' ? 'FluidGrids cron' : settings.lastPullSource}\n </li>\n {settings.nextPullAt && <li>· Next pull: {formatDate(settings.nextPullAt)}</li>}\n </ul>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n No pull yet. Use “Refresh NDVI” on the Satellite Crop Health page.\n </p>\n )}\n </ChartCard>\n </div>\n </PageLayout>\n );\n};\n\nconst Row: FC<{ label: string; children: ReactNode }> = ({ label, children }) => (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-[200px_1fr] sm:items-center\">\n <label className=\"text-sm font-medium text-text-primary\">{label}</label>\n <div>{children}</div>\n </div>\n);\n\nconst Toggle: FC<{ label: string; checked: boolean; onChange: (v: boolean) => void }> = ({\n label,\n checked,\n onChange,\n}) => (\n <label className=\"flex items-center gap-2\">\n <Switch checked={checked} onCheckedChange={onChange} />\n <span className=\"text-sm text-text-primary\">{label}</span>\n </label>\n);\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,IAAM,IAAmD;CACvD;EAAE,KAAK;EAAS,OAAO;EAAS;CAChC;EAAE,KAAK;EAAgB,OAAO;EAAgB;CAC9C;EAAE,KAAK;EAAU,OAAO;EAAU;CACnC,EACK,IAAuD;CAC3D;EAAE,KAAK;EAAO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A,CAAI,iBAAc,EAAW,EAAS,WAAW,CAAM,EAAA,CAAA;MAC5E;SAEL,kBAAC,KAAD;KAAG,WAAU;eAA8B;KAEvC,CAAA;IAEI,CAAA,CACR;;EACK,CAAA,GAvGO;GA2GlB,KAAmD,EAAE,UAAO,kBAChE,kBAAC,OAAD;CAAK,WAAU;WAAf,CACE,kBAAC,SAAD;EAAO,WAAU;YAAyC;EAAc,CAAA,EACxE,kBAAC,OAAD,EAAM,aAAe,CAAA,CACjB;IAGF,KAAmF,EACvF,UACA,YACA,kBAEA,kBAAC,SAAD;CAAO,WAAU;WAAjB,CACE,kBAAC,GAAD;EAAiB;EAAS,iBAAiB;EAAY,CAAA,EACvD,kBAAC,QAAD;EAAM,WAAU;YAA6B;EAAa,CAAA,CACpD"}
|
|
1
|
+
{"version":3,"file":"SatelliteSettingsPage.js","names":[],"sources":["../../../../src/healthybowl/pages/satellite/SatelliteSettingsPage.tsx"],"sourcesContent":["/**\n * Satellite Data Settings (BOFF-2886).\n *\n * Per-workspace ingestion settings: provider, refresh cadence, indices to fetch,\n * stressed-zone sensitivity and data retention — plus a \"last successful pull\"\n * summary. The scheduled pull runs as a FluidGrids cron → the\n * `refreshHealthyBowlFieldNdvi` mutation (M2M). Live gateway — no mocks.\n */\nimport { type FC, type ReactNode, useCallback, useEffect, useState } from 'react';\nimport { useNavigate } from 'react-router';\nimport { Button, Switch } from '@burdenoff/fe-libs/ui';\nimport { ArrowLeft, CheckCircle2, Save } from 'lucide-react';\nimport { PageLayout, ChartCard, StatusBadge, ErrorState, PageLoader } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { useSatelliteApi } from './useSatelliteApi';\nimport type { SatelliteSettings } from './satelliteApi';\nimport { formatDate, pullSourceLabel } from './ndviColors';\n\nconst SCHEDULES: Array<{ key: string; label: string }> = [\n { key: 'DAILY', label: 'Daily' },\n { key: 'EVERY_3_DAYS', label: 'Every 3 days' },\n { key: 'WEEKLY', label: 'Weekly' },\n];\nconst SENSITIVITIES: Array<{ key: string; label: string }> = [\n { key: 'LOW', label: 'Low' },\n { key: 'MEDIUM', label: 'Medium' },\n { key: 'HIGH', label: 'High' },\n];\nconst RETENTIONS = [12, 24, 36];\n\nexport const SatelliteSettingsPage: FC = () => {\n const { api } = useSatelliteApi();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { toast } = useToast();\n\n const [settings, setSettings] = useState<SatelliteSettings | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [saving, setSaving] = useState(false);\n\n const load = useCallback(async () => {\n setError(null);\n try {\n setSettings(await api.getSettings());\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Failed to load settings.');\n } finally {\n setLoading(false);\n }\n }, [api]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n const patch = (p: Partial<SatelliteSettings>) => setSettings((s) => (s ? { ...s, ...p } : s));\n\n const save = useCallback(async () => {\n if (!settings) return;\n setSaving(true);\n try {\n const updated = await api.updateSettings({\n provider: settings.provider,\n refreshSchedule: settings.refreshSchedule,\n fetchNdvi: settings.fetchNdvi,\n fetchEvi: settings.fetchEvi,\n fetchNdmi: settings.fetchNdmi,\n stressSensitivity: settings.stressSensitivity,\n dataRetentionMonths: settings.dataRetentionMonths,\n });\n setSettings(updated);\n toast({ title: 'Settings saved', variant: 'success' });\n } catch (e) {\n toast({ title: 'Save failed', description: e instanceof Error ? e.message : 'Unknown error', variant: 'error' });\n } finally {\n setSaving(false);\n }\n }, [api, settings, toast]);\n\n if (loading) return <PageLoader />;\n if (error) return <ErrorState title=\"Couldn't load settings\" description={error} onRetry={() => void load()} />;\n if (!settings) return null;\n\n return (\n <PageLayout\n title=\"Satellite Data Settings\"\n description=\"Configure how HealthyBowl pulls and interprets satellite imagery for your fields.\"\n actions={\n <div className=\"flex items-center gap-2\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate(buildPath('satellite'))}>\n <ArrowLeft className=\"me-1.5 h-4 w-4\" /> Back\n </Button>\n <Button size=\"sm\" onClick={() => void save()} disabled={saving}>\n <Save className=\"me-1.5 h-4 w-4\" /> Save changes\n </Button>\n </div>\n }\n >\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <div className=\"space-y-4 lg:col-span-2\">\n <ChartCard title=\"Ingestion\">\n <div className=\"space-y-5\">\n <Row label=\"Satellite provider\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium text-text-primary\">Sentinel-2 (via partner API)</span>\n <StatusBadge label=\"Connected\" variant=\"success\" dot />\n </div>\n </Row>\n\n <Row label=\"Refresh schedule\">\n <div className=\"flex flex-wrap gap-2\">\n {SCHEDULES.map((s) => (\n <Button\n key={s.key}\n size=\"sm\"\n variant={settings.refreshSchedule === s.key ? 'default' : 'outline'}\n onClick={() => patch({ refreshSchedule: s.key })}\n >\n {s.label}\n </Button>\n ))}\n </div>\n </Row>\n\n <Row label=\"Indices to fetch\">\n <div className=\"flex flex-wrap items-center gap-6\">\n <Toggle label=\"NDVI\" checked={settings.fetchNdvi} onChange={(v) => patch({ fetchNdvi: v })} />\n <Toggle label=\"EVI\" checked={settings.fetchEvi} onChange={(v) => patch({ fetchEvi: v })} />\n <Toggle label=\"NDMI\" checked={settings.fetchNdmi} onChange={(v) => patch({ fetchNdmi: v })} />\n </div>\n </Row>\n\n <Row label=\"Stressed-zone sensitivity\">\n <div className=\"flex flex-wrap gap-2\">\n {SENSITIVITIES.map((s) => (\n <Button\n key={s.key}\n size=\"sm\"\n variant={settings.stressSensitivity === s.key ? 'default' : 'outline'}\n onClick={() => patch({ stressSensitivity: s.key })}\n >\n {s.label}\n </Button>\n ))}\n </div>\n </Row>\n\n <Row label=\"Data retention\">\n <div className=\"flex flex-wrap gap-2\">\n {RETENTIONS.map((m) => (\n <Button\n key={m}\n size=\"sm\"\n variant={settings.dataRetentionMonths === m ? 'default' : 'outline'}\n onClick={() => patch({ dataRetentionMonths: m })}\n >\n Keep {m} months\n </Button>\n ))}\n </div>\n </Row>\n </div>\n </ChartCard>\n </div>\n\n <ChartCard title=\"Last successful pull\">\n {settings.lastPullAt ? (\n <ul className=\"space-y-2 text-sm text-text-secondary\">\n <li className=\"flex items-center gap-2\">\n <CheckCircle2 className=\"h-4 w-4 text-success\" /> {formatDate(settings.lastPullAt)}\n </li>\n <li>· {settings.lastPullFieldCount ?? 0} field(s) updated</li>\n <li>· via {pullSourceLabel(settings.lastPullSource)}</li>\n {settings.nextPullAt && <li>· Next pull: {formatDate(settings.nextPullAt)}</li>}\n </ul>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n No pull yet. Use “Refresh NDVI” on the Satellite Crop Health page.\n </p>\n )}\n </ChartCard>\n </div>\n </PageLayout>\n );\n};\n\nconst Row: FC<{ label: string; children: ReactNode }> = ({ label, children }) => (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-[200px_1fr] sm:items-center\">\n <label className=\"text-sm font-medium text-text-primary\">{label}</label>\n <div>{children}</div>\n </div>\n);\n\nconst Toggle: FC<{ label: string; checked: boolean; onChange: (v: boolean) => void }> = ({\n label,\n checked,\n onChange,\n}) => (\n <label className=\"flex items-center gap-2\">\n <Switch checked={checked} onCheckedChange={onChange} />\n <span className=\"text-sm text-text-primary\">{label}</span>\n </label>\n);\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,IAAM,IAAmD;CACvD;EAAE,KAAK;EAAS,OAAO;EAAS;CAChC;EAAE,KAAK;EAAgB,OAAO;EAAgB;CAC9C;EAAE,KAAK;EAAU,OAAO;EAAU;CACnC,EACK,IAAuD;CAC3D;EAAE,KAAK;EAAO,OAAO;EAAO;CAC5B;EAAE,KAAK;EAAU,OAAO;EAAU;CAClC;EAAE,KAAK;EAAQ,OAAO;EAAQ;CAC/B,EACK,IAAa;CAAC;CAAI;CAAI;CAAG,EAElB,UAAkC;CAC7C,IAAM,EAAE,WAAQ,GAAiB,EAC3B,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,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U;YAAyC;EAAc,CAAA,EACxE,kBAAC,OAAD,EAAM,aAAe,CAAA,CACjB;IAGF,KAAmF,EACvF,UACA,YACA,kBAEA,kBAAC,SAAD;CAAO,WAAU;WAAjB,CACE,kBAAC,GAAD;EAAiB;EAAS,iBAAiB;EAAY,CAAA,EACvD,kBAAC,QAAD;EAAM,WAAU;YAA6B;EAAa,CAAA,CACpD"}
|
|
@@ -110,7 +110,35 @@ function d(e) {
|
|
|
110
110
|
function f(e) {
|
|
111
111
|
return e.split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
112
112
|
}
|
|
113
|
+
function p(e, t) {
|
|
114
|
+
switch (e) {
|
|
115
|
+
case "SENTINEL2_PARTNER": return {
|
|
116
|
+
label: t == null ? "Sentinel-2" : `Sentinel-2 · ${Math.round(t)}% cloud`,
|
|
117
|
+
variant: "info"
|
|
118
|
+
};
|
|
119
|
+
case "SENTINEL2_STUB": return {
|
|
120
|
+
label: "Simulated pattern",
|
|
121
|
+
variant: "muted"
|
|
122
|
+
};
|
|
123
|
+
case "MANUAL": return {
|
|
124
|
+
label: "Manual reading",
|
|
125
|
+
variant: "default"
|
|
126
|
+
};
|
|
127
|
+
default: return {
|
|
128
|
+
label: e ?? "Unknown source",
|
|
129
|
+
variant: "muted"
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function m(e) {
|
|
134
|
+
switch (e) {
|
|
135
|
+
case "SENTINEL2_PARTNER": return "Sentinel-2 (SENTINEL2_PARTNER)";
|
|
136
|
+
case "SENTINEL2_STUB": return "Simulated (SENTINEL2_STUB)";
|
|
137
|
+
case "MANUAL": return "Manual entry";
|
|
138
|
+
default: return e ?? "—";
|
|
139
|
+
}
|
|
140
|
+
}
|
|
113
141
|
//#endregion
|
|
114
|
-
export { i as NDVI_LEGEND_GRADIENT, u as formatDate, l as formatNdvi, d as formatTonnes, a as healthBandVariant, n as ndviColor, f as reasonLabel, s as severityPinColor, o as severityVariant, c as trendArrow };
|
|
142
|
+
export { i as NDVI_LEGEND_GRADIENT, u as formatDate, l as formatNdvi, d as formatTonnes, a as healthBandVariant, n as ndviColor, p as ndviSourceBadge, m as pullSourceLabel, f as reasonLabel, s as severityPinColor, o as severityVariant, c as trendArrow };
|
|
115
143
|
|
|
116
144
|
//# sourceMappingURL=ndviColors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndviColors.js","names":[],"sources":["../../../../src/healthybowl/pages/satellite/ndviColors.ts"],"sourcesContent":["/**\n * NDVI presentation helpers (BOFF-2886).\n *\n * The red→yellow→green ramp is applied to Leaflet `L.PathOptions` (imperative\n * map paint), which cannot read CSS classes — so hex literals here are the\n * accepted exception for map geometry, mirroring the existing FieldMap paint.\n * Everything rendered as React DOM uses semantic tokens (success/warning/\n * destructive), never these hexes.\n */\n\n// NDVI legend anchors: 0.2 (bare/stressed, red) → 0.5 (mid, amber) → 0.8+ (dense canopy, green).\nconst RAMP: Array<{ stop: number; rgb: [number, number, number] }> = [\n { stop: 0.2, rgb: [215, 48, 39] }, // red\n { stop: 0.35, rgb: [244, 109, 67] }, // orange\n { stop: 0.5, rgb: [254, 224, 139] }, // yellow\n { stop: 0.65, rgb: [166, 217, 106] }, // light green\n { stop: 0.8, rgb: [26, 152, 80] }, // green\n];\n\nfunction lerp(a: number, b: number, t: number): number {\n return Math.round(a + (b - a) * t);\n}\n\n/** Map an NDVI value in [0,1] to a red→yellow→green hex colour. */\nexport function ndviColor(value: number): string {\n const v = Math.max(0.1, Math.min(0.9, value));\n if (v <= RAMP[0]!.stop) return toHex(RAMP[0]!.rgb);\n if (v >= RAMP[RAMP.length - 1]!.stop) return toHex(RAMP[RAMP.length - 1]!.rgb);\n for (let i = 0; i < RAMP.length - 1; i++) {\n const lo = RAMP[i]!;\n const hi = RAMP[i + 1]!;\n if (v >= lo.stop && v <= hi.stop) {\n const t = (v - lo.stop) / (hi.stop - lo.stop);\n return toHex([lerp(lo.rgb[0], hi.rgb[0], t), lerp(lo.rgb[1], hi.rgb[1], t), lerp(lo.rgb[2], hi.rgb[2], t)]);\n }\n }\n return toHex(RAMP[RAMP.length - 1]!.rgb);\n}\n\nfunction toHex([r, g, b]: [number, number, number]): string {\n const h = (n: number) => n.toString(16).padStart(2, '0');\n return `#${h(r)}${h(g)}${h(b)}`;\n}\n\n/** CSS gradient string for the legend bar. */\nexport const NDVI_LEGEND_GRADIENT = `linear-gradient(to right, ${RAMP.map(\n (r) => `${toHex(r.rgb)} ${Math.round(((r.stop - 0.2) / 0.6) * 100)}%`\n).join(', ')})`;\n\n/** Health-band → semantic StatusBadge variant (React DOM, not the map). */\nexport function healthBandVariant(band: string): 'success' | 'warning' | 'error' | 'muted' {\n switch (band) {\n case 'EXCELLENT':\n case 'HEALTHY':\n return 'success';\n case 'BELOW_AVERAGE':\n return 'warning';\n case 'STRESSED':\n return 'error';\n default:\n return 'muted';\n }\n}\n\n/** Severity → semantic StatusBadge variant + a dot colour class. */\nexport function severityVariant(severity: string): 'error' | 'warning' | 'muted' {\n switch (severity) {\n case 'HIGH':\n return 'error';\n case 'MEDIUM':\n return 'warning';\n default:\n return 'muted';\n }\n}\n\n/** Severity → the imperative map pin colour (hex, map-only). */\nexport function severityPinColor(severity: string): string {\n switch (severity) {\n case 'HIGH':\n return '#d73027';\n case 'MEDIUM':\n return '#f39c12';\n default:\n return '#eab308';\n }\n}\n\nexport function trendArrow(direction: string): string {\n return direction === 'UP' ? '↑' : direction === 'DOWN' ? '↓' : '→';\n}\n\nexport function formatNdvi(value: number | null | undefined): string {\n return value === null || value === undefined ? '—' : value.toFixed(2);\n}\n\nexport function formatDate(iso: string | null | undefined): string {\n if (!iso) return '—';\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return '—';\n return d.toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' });\n}\n\nexport function formatTonnes(value: number | null | undefined): string {\n return value === null || value === undefined ? '—' : value.toFixed(1);\n}\n\nexport function reasonLabel(re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,aAAa,GAAG,EAAE,MAAM,EAAE,CAAC,CAClD,KAAK,IAAI"}
|
|
1
|
+
{"version":3,"file":"ndviColors.js","names":[],"sources":["../../../../src/healthybowl/pages/satellite/ndviColors.ts"],"sourcesContent":["/**\n * NDVI presentation helpers (BOFF-2886).\n *\n * The red→yellow→green ramp is applied to Leaflet `L.PathOptions` (imperative\n * map paint), which cannot read CSS classes — so hex literals here are the\n * accepted exception for map geometry, mirroring the existing FieldMap paint.\n * Everything rendered as React DOM uses semantic tokens (success/warning/\n * destructive), never these hexes.\n */\n\n// NDVI legend anchors: 0.2 (bare/stressed, red) → 0.5 (mid, amber) → 0.8+ (dense canopy, green).\nconst RAMP: Array<{ stop: number; rgb: [number, number, number] }> = [\n { stop: 0.2, rgb: [215, 48, 39] }, // red\n { stop: 0.35, rgb: [244, 109, 67] }, // orange\n { stop: 0.5, rgb: [254, 224, 139] }, // yellow\n { stop: 0.65, rgb: [166, 217, 106] }, // light green\n { stop: 0.8, rgb: [26, 152, 80] }, // green\n];\n\nfunction lerp(a: number, b: number, t: number): number {\n return Math.round(a + (b - a) * t);\n}\n\n/** Map an NDVI value in [0,1] to a red→yellow→green hex colour. */\nexport function ndviColor(value: number): string {\n const v = Math.max(0.1, Math.min(0.9, value));\n if (v <= RAMP[0]!.stop) return toHex(RAMP[0]!.rgb);\n if (v >= RAMP[RAMP.length - 1]!.stop) return toHex(RAMP[RAMP.length - 1]!.rgb);\n for (let i = 0; i < RAMP.length - 1; i++) {\n const lo = RAMP[i]!;\n const hi = RAMP[i + 1]!;\n if (v >= lo.stop && v <= hi.stop) {\n const t = (v - lo.stop) / (hi.stop - lo.stop);\n return toHex([lerp(lo.rgb[0], hi.rgb[0], t), lerp(lo.rgb[1], hi.rgb[1], t), lerp(lo.rgb[2], hi.rgb[2], t)]);\n }\n }\n return toHex(RAMP[RAMP.length - 1]!.rgb);\n}\n\nfunction toHex([r, g, b]: [number, number, number]): string {\n const h = (n: number) => n.toString(16).padStart(2, '0');\n return `#${h(r)}${h(g)}${h(b)}`;\n}\n\n/** CSS gradient string for the legend bar. */\nexport const NDVI_LEGEND_GRADIENT = `linear-gradient(to right, ${RAMP.map(\n (r) => `${toHex(r.rgb)} ${Math.round(((r.stop - 0.2) / 0.6) * 100)}%`\n).join(', ')})`;\n\n/** Health-band → semantic StatusBadge variant (React DOM, not the map). */\nexport function healthBandVariant(band: string): 'success' | 'warning' | 'error' | 'muted' {\n switch (band) {\n case 'EXCELLENT':\n case 'HEALTHY':\n return 'success';\n case 'BELOW_AVERAGE':\n return 'warning';\n case 'STRESSED':\n return 'error';\n default:\n return 'muted';\n }\n}\n\n/** Severity → semantic StatusBadge variant + a dot colour class. */\nexport function severityVariant(severity: string): 'error' | 'warning' | 'muted' {\n switch (severity) {\n case 'HIGH':\n return 'error';\n case 'MEDIUM':\n return 'warning';\n default:\n return 'muted';\n }\n}\n\n/** Severity → the imperative map pin colour (hex, map-only). */\nexport function severityPinColor(severity: string): string {\n switch (severity) {\n case 'HIGH':\n return '#d73027';\n case 'MEDIUM':\n return '#f39c12';\n default:\n return '#eab308';\n }\n}\n\nexport function trendArrow(direction: string): string {\n return direction === 'UP' ? '↑' : direction === 'DOWN' ? '↓' : '→';\n}\n\nexport function formatNdvi(value: number | null | undefined): string {\n return value === null || value === undefined ? '—' : value.toFixed(2);\n}\n\nexport function formatDate(iso: string | null | undefined): string {\n if (!iso) return '—';\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return '—';\n return d.toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' });\n}\n\nexport function formatTonnes(value: number | null | undefined): string {\n return value === null || value === undefined ? '—' : value.toFixed(1);\n}\n\nexport function reasonLabel(reason: string): string {\n return reason\n .split('_')\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(' ');\n}\n\n/**\n * BOFF-6189: per-reading NDVI source badge. Distinguishes a real Sentinel-2 pull\n * (with its scene cloud %) from the deterministic simulated grid, so a farmer can\n * tell live imagery apart from the honest stub at a glance.\n */\nexport function ndviSourceBadge(\n source: string | null | undefined,\n cloudCoverPct: number | null | undefined\n): { label: string; variant: 'info' | 'muted' | 'default' } {\n switch (source) {\n case 'SENTINEL2_PARTNER':\n return {\n label:\n cloudCoverPct === null || cloudCoverPct === undefined\n ? 'Sentinel-2'\n : `Sentinel-2 · ${Math.round(cloudCoverPct)}% cloud`,\n variant: 'info',\n };\n case 'SENTINEL2_STUB':\n return { label: 'Simulated pattern', variant: 'muted' };\n case 'MANUAL':\n return { label: 'Manual reading', variant: 'default' };\n default:\n return { label: source ?? 'Unknown source', variant: 'muted' };\n }\n}\n\n/**\n * BOFF-6189: honest label for the settings \"Last successful pull · via …\" line.\n * A stub pull is simulated in-service, not \"FluidGrids cron\" (that copy was lifted\n * from mockup 8 and never reflected reality).\n */\nexport function pullSourceLabel(source: string | null | undefined): string {\n switch (source) {\n case 'SENTINEL2_PARTNER':\n return 'Sentinel-2 (SENTINEL2_PARTNER)';\n case 'SENTINEL2_STUB':\n return 'Simulated (SENTINEL2_STUB)';\n case 'MANUAL':\n return 'Manual entry';\n default:\n return source ?? '—';\n }\n}\n"],"mappings":";AAWA,IAAM,IAA+D;CACnE;EAAE,MAAM;EAAK,KAAK;GAAC;GAAK;GAAI;GAAG;EAAE;CACjC;EAAE,MAAM;EAAM,KAAK;GAAC;GAAK;GAAK;GAAG;EAAE;CACnC;EAAE,MAAM;EAAK,KAAK;GAAC;GAAK;GAAK;GAAI;EAAE;CACnC;EAAE,MAAM;EAAM,KAAK;GAAC;GAAK;GAAK;GAAI;EAAE;CACpC;EAAE,MAAM;EAAK,KAAK;GAAC;GAAI;GAAK;GAAG;EAAE;CAClC;AAED,SAAS,EAAK,GAAW,GAAW,GAAmB;AACrD,QAAO,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;;AAIpC,SAAgB,EAAU,GAAuB;CAC/C,IAAM,IAAI,KAAK,IAAI,IAAK,KAAK,IAAI,IAAK,EAAM,CAAC;AAC7C,KAAI,KAAK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