@burdenoff/microfe-healthybowl 2026.710.10 → 2026.710.12
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/fields/FieldMapPage.js +510 -419
- package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
- package/dist/healthybowl/utils/elevation.js +58 -0
- package/dist/healthybowl/utils/elevation.js.map +1 -0
- package/dist/healthybowl/utils/index.js +1 -0
- package/package.json +1 -1
|
@@ -5,24 +5,25 @@ import { PageLayout as r } from "../../components/PageLayout.js";
|
|
|
5
5
|
import { ErrorState as i } from "../../components/ErrorState.js";
|
|
6
6
|
import { ToastContainer as a } from "../../components/Toast.js";
|
|
7
7
|
import { useConfirm as o } from "../../components/ConfirmDialog.js";
|
|
8
|
-
import { Modal as
|
|
9
|
-
import { require_leaflet_src as
|
|
10
|
-
import { useToast as
|
|
11
|
-
import { ensureLeafletCss as
|
|
12
|
-
import { extractPolygon as
|
|
13
|
-
import { SOIL_PALETTE as
|
|
8
|
+
import { Modal as ee } from "../../components/Modal.js";
|
|
9
|
+
import { require_leaflet_src as s } from "../../../node_modules/leaflet/dist/leaflet-src.js";
|
|
10
|
+
import { useToast as te } from "../../hooks/useToast.js";
|
|
11
|
+
import { ensureLeafletCss as ne } from "../../utils/leaflet.js";
|
|
12
|
+
import { extractPolygon as re, isValidPolygon as c, polygonAreaInUnit as l, polygonAreaSqMeters as ie, polygonCentroid as ae, ringToPolygon as u } from "../../utils/geo.js";
|
|
13
|
+
import { SOIL_PALETTE as oe, soilColor as se, soilLegendFor as ce } from "../../utils/soil.js";
|
|
14
|
+
import { elevationColor as le, fetchElevations as ue } from "../../utils/elevation.js";
|
|
14
15
|
import "../../utils/index.js";
|
|
15
16
|
import "../../components/index.js";
|
|
16
|
-
import { useHealthyBowlData as
|
|
17
|
-
import { useCallback as
|
|
18
|
-
import { useI18n as
|
|
19
|
-
import { Check as
|
|
20
|
-
import { Fragment as
|
|
21
|
-
import { Button as
|
|
22
|
-
import { gql as
|
|
23
|
-
import { useMutation as
|
|
17
|
+
import { useHealthyBowlData as de } from "../../hooks/useHealthyBowlData.js";
|
|
18
|
+
import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
19
|
+
import { useI18n as fe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
20
|
+
import { Check as pe, Layers as me, LocateFixed as he, MapPinned as ge, Pencil as _e, Plus as ve, Ruler as ye, Save as be, Search as xe, Spline as Se, Trash2 as Ce, X as we } from "lucide-react";
|
|
21
|
+
import { Fragment as Te, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
22
|
+
import { Button as v, Select as Ee, SelectContent as De, SelectItem as y, SelectTrigger as Oe, SelectValue as ke } from "@burdenoff/fe-libs/ui";
|
|
23
|
+
import { gql as Ae } from "@apollo/client";
|
|
24
|
+
import { useMutation as je } from "@apollo/client/react";
|
|
24
25
|
//#region src/healthybowl/pages/fields/FieldMapPage.tsx
|
|
25
|
-
var
|
|
26
|
+
var b = /* @__PURE__ */ e(s(), 1), Me = Ae`
|
|
26
27
|
mutation UpdateHealthyBowlFieldBoundaryOnMapPage($input: UpdateHealthyBowlFieldInput!) {
|
|
27
28
|
updateHealthyBowlField(input: $input) {
|
|
28
29
|
id
|
|
@@ -31,48 +32,93 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
31
32
|
location
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
`,
|
|
35
|
+
`, Ne = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", Pe = "Esri, Maxar, Earthstar Geographics", Fe = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", Ie = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", Le = 21, Re = 16, ze = 2.47105, Be = "#16a34a", Ve = {
|
|
35
36
|
color: "#f59e0b",
|
|
36
37
|
weight: 2,
|
|
37
38
|
dashArray: "6 4",
|
|
38
39
|
fillColor: "#f59e0b",
|
|
39
40
|
fillOpacity: .15
|
|
40
|
-
},
|
|
41
|
+
}, He = {
|
|
41
42
|
color: "#ffffff",
|
|
42
43
|
weight: 2,
|
|
43
44
|
dashArray: "6 4",
|
|
44
45
|
fillColor: "#22c55e",
|
|
45
46
|
fillOpacity: .2
|
|
46
|
-
},
|
|
47
|
+
}, Ue = {
|
|
47
48
|
color: "#38bdf8",
|
|
48
49
|
weight: 3,
|
|
49
50
|
dashArray: "6 6"
|
|
50
|
-
},
|
|
51
|
-
let t =
|
|
52
|
-
return t &&
|
|
53
|
-
},
|
|
51
|
+
}, We = (e) => !!(e && Number.isFinite(e.lat) && Number.isFinite(e.lng) && e.lat >= -90 && e.lat <= 90 && e.lng >= -180 && e.lng <= 180 && (e.lat !== 0 || e.lng !== 0)), Ge = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), Ke = (e) => Ge(e.unit) ? e.area * ze : e.area, qe = (e) => `${e.area.toFixed(1)} ${Ge(e.unit) ? "ha" : "ac"}`, x = (e) => {
|
|
52
|
+
let t = re(e.boundary);
|
|
53
|
+
return t && c(t) ? t : null;
|
|
54
|
+
}, Je = b.default.divIcon({
|
|
54
55
|
className: "",
|
|
55
56
|
html: "<span style=\"display:block;width:12px;height:12px;background:#22c55e;border:2px solid #fff;border-radius:2px;box-shadow:0 0 3px rgba(0,0,0,.6)\"></span>",
|
|
56
57
|
iconSize: [16, 16],
|
|
57
58
|
iconAnchor: [8, 8]
|
|
58
|
-
}),
|
|
59
|
-
let { t: e } =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, [
|
|
63
|
-
let
|
|
64
|
-
let e =
|
|
65
|
-
return e ?
|
|
66
|
-
}, [
|
|
59
|
+
}), S = () => {
|
|
60
|
+
let { t: e } = fe(), { workspaceId: s } = n(), re = o(), { fields: c, crops: Ae, loadings: ze, errors: Ge, refetch: S, createField: Ye } = de(), { toasts: Xe, toast: C, dismiss: Ze } = te(), [w] = je(Me), [T, Qe] = h("loading"), [E, D] = h("view"), [O, k] = h(null), [A, $e] = h(!1), [j, et] = h(!0), [M, tt] = h(!1), [N, nt] = h({}), [rt, it] = h(""), [at, ot] = h(""), [st, ct] = h(!1), [lt, ut] = h(0), [dt, ft] = h(null), [pt, mt] = h(!1), [ht, gt] = h(!1), [P, _t] = h(null), [F, I] = h(null), [vt, yt] = h(!1), [L, bt] = h(""), [xt, St] = h("Clay loam"), [Ct, wt] = h("Drip"), [Tt, Et] = h("active"), Dt = m(null), R = m(null), Ot = m(null), kt = m(null), At = m(null), z = m(null), B = m(null), V = m(null), H = m([]), U = m(null), W = m([]), G = m(null), jt = m([]), K = m("view"), Mt = m(!1);
|
|
61
|
+
f(() => {
|
|
62
|
+
K.current = E;
|
|
63
|
+
}, [E]);
|
|
64
|
+
let Nt = p(() => c.filter((e) => x(e) !== null).length, [c]), Pt = p(() => c.reduce((e, t) => e + Ke(t), 0), [c]), Ft = p(() => ce(c.map((e) => e.soilType)), [c]), q = p(() => c.find((e) => e.id === O) ?? null, [c, O]), It = p(() => {
|
|
65
|
+
let e = rt.trim().toLowerCase();
|
|
66
|
+
return e ? c.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : c;
|
|
67
|
+
}, [c, rt]), J = p(() => {
|
|
68
|
+
let e = [];
|
|
69
|
+
for (let t of c) {
|
|
70
|
+
let n = x(t);
|
|
71
|
+
if (n) {
|
|
72
|
+
let r = ae(n);
|
|
73
|
+
if (r) {
|
|
74
|
+
e.push({
|
|
75
|
+
id: t.id,
|
|
76
|
+
lat: r[0],
|
|
77
|
+
lng: r[1]
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
We(t.location) && e.push({
|
|
83
|
+
id: t.id,
|
|
84
|
+
lat: t.location.lat,
|
|
85
|
+
lng: t.location.lng
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return e;
|
|
89
|
+
}, [c]);
|
|
90
|
+
f(() => {
|
|
91
|
+
if (J.length === 0) {
|
|
92
|
+
nt({});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let e = new AbortController(), t = !1;
|
|
96
|
+
return ue(J.map((e) => ({
|
|
97
|
+
lat: e.lat,
|
|
98
|
+
lng: e.lng
|
|
99
|
+
})), e.signal).then((e) => {
|
|
100
|
+
if (t) return;
|
|
101
|
+
let n = {};
|
|
102
|
+
J.forEach((t, r) => {
|
|
103
|
+
n[t.id] = e[r] ?? null;
|
|
104
|
+
}), nt(n);
|
|
105
|
+
}), () => {
|
|
106
|
+
t = !0, e.abort();
|
|
107
|
+
};
|
|
108
|
+
}, [p(() => J.map((e) => `${e.id}:${e.lat.toFixed(5)},${e.lng.toFixed(5)}`).join("|"), [J])]);
|
|
109
|
+
let [Lt, Rt] = p(() => {
|
|
110
|
+
let e = Object.values(N).filter((e) => e != null && Number.isFinite(e));
|
|
111
|
+
return e.length === 0 ? [0, 0] : [Math.min(...e), Math.max(...e)];
|
|
112
|
+
}, [N]), zt = p(() => Object.values(N).some((e) => e != null && Number.isFinite(e)), [N]), Bt = d((e) => {
|
|
67
113
|
if (!e) return "";
|
|
68
|
-
let t =
|
|
114
|
+
let t = Ae.find((t) => t.field === e.id || t.fieldName === e.name);
|
|
69
115
|
return t ? t.name : (e.crops ?? []).join(", ");
|
|
70
|
-
}, [
|
|
71
|
-
let t =
|
|
116
|
+
}, [Ae]), Vt = d((e) => {
|
|
117
|
+
let t = R.current;
|
|
72
118
|
if (!t) return;
|
|
73
|
-
let n =
|
|
119
|
+
let n = x(e);
|
|
74
120
|
if (n) try {
|
|
75
|
-
let e =
|
|
121
|
+
let e = b.default.geoJSON(n).getBounds();
|
|
76
122
|
if (e.isValid()) {
|
|
77
123
|
t.fitBounds(e, {
|
|
78
124
|
padding: [40, 40],
|
|
@@ -81,25 +127,29 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
81
127
|
return;
|
|
82
128
|
}
|
|
83
129
|
} catch {}
|
|
84
|
-
|
|
85
|
-
}, []),
|
|
86
|
-
|
|
87
|
-
}, [
|
|
88
|
-
|
|
130
|
+
We(e.location) && t.flyTo([e.location.lat, e.location.lng], Re, { duration: .6 });
|
|
131
|
+
}, []), Ht = d((e) => {
|
|
132
|
+
K.current === "draw" || K.current === "measure" || (k(e.id), Vt(e));
|
|
133
|
+
}, [Vt]);
|
|
134
|
+
f(() => {
|
|
135
|
+
O && document.querySelector(`[data-field-id="${O}"]`)?.scrollIntoView({ block: "nearest" });
|
|
136
|
+
}, [O]);
|
|
137
|
+
let Y = d(() => {
|
|
138
|
+
let t = R.current, n = At.current;
|
|
89
139
|
if (!t || !n) return;
|
|
90
140
|
n.clearLayers();
|
|
91
141
|
let r = [];
|
|
92
|
-
for (let t of
|
|
93
|
-
if (
|
|
94
|
-
let i = t.id ===
|
|
142
|
+
for (let t of c) {
|
|
143
|
+
if (E === "edit" && t.id === O) continue;
|
|
144
|
+
let i = t.id === O, a = N[t.id], o = M && a != null ? le(a, Lt, Rt) : j ? se(t.soilType) : Be, ee = `${t.name} — ${qe(t)}`, s = x(t);
|
|
95
145
|
if (s) {
|
|
96
|
-
let e =
|
|
97
|
-
color: i ? "#ffffff" :
|
|
146
|
+
let e = b.default.geoJSON(s, { style: () => ({
|
|
147
|
+
color: i ? "#ffffff" : o,
|
|
98
148
|
weight: i ? 4 : 2,
|
|
99
|
-
fillColor:
|
|
149
|
+
fillColor: o,
|
|
100
150
|
fillOpacity: i ? .5 : .3
|
|
101
151
|
}) });
|
|
102
|
-
e.on("click", () =>
|
|
152
|
+
e.on("click", () => k(t.id)), e.bindTooltip(ee, {
|
|
103
153
|
permanent: !0,
|
|
104
154
|
direction: "center",
|
|
105
155
|
className: "hb-field-label"
|
|
@@ -108,90 +158,94 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
108
158
|
let t = e.getBounds();
|
|
109
159
|
t.isValid() && r.push(t);
|
|
110
160
|
} catch {}
|
|
111
|
-
} else if (
|
|
112
|
-
let
|
|
161
|
+
} else if (We(t.location)) {
|
|
162
|
+
let a = b.default.circleMarker([t.location.lat, t.location.lng], {
|
|
113
163
|
radius: i ? 9 : 7,
|
|
114
164
|
color: i ? "#ffffff" : "#fff",
|
|
115
165
|
weight: i ? 3 : 2,
|
|
116
|
-
fillColor:
|
|
166
|
+
fillColor: o,
|
|
117
167
|
fillOpacity: 1
|
|
118
168
|
});
|
|
119
|
-
|
|
169
|
+
a.on("click", () => k(t.id)), a.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
|
|
120
170
|
permanent: !1,
|
|
121
171
|
direction: "top"
|
|
122
|
-
}),
|
|
172
|
+
}), a.addTo(n), r.push(b.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
|
|
123
173
|
}
|
|
124
174
|
}
|
|
125
|
-
if (!
|
|
126
|
-
let e = r.reduce((e, t) => e.extend(t),
|
|
175
|
+
if (!Mt.current && r.length > 0) {
|
|
176
|
+
let e = r.reduce((e, t) => e.extend(t), b.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
|
|
127
177
|
try {
|
|
128
178
|
t.fitBounds(e, {
|
|
129
179
|
padding: [40, 40],
|
|
130
180
|
maxZoom: 17
|
|
131
|
-
}),
|
|
181
|
+
}), Mt.current = !0;
|
|
132
182
|
} catch {}
|
|
133
183
|
}
|
|
134
184
|
}, [
|
|
135
|
-
|
|
136
|
-
|
|
185
|
+
c,
|
|
186
|
+
E,
|
|
187
|
+
O,
|
|
137
188
|
j,
|
|
138
|
-
|
|
189
|
+
M,
|
|
190
|
+
N,
|
|
191
|
+
Lt,
|
|
192
|
+
Rt,
|
|
139
193
|
e
|
|
140
194
|
]);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, [Y,
|
|
144
|
-
let X =
|
|
145
|
-
|
|
146
|
-
}, []),
|
|
147
|
-
let e =
|
|
195
|
+
f(() => {
|
|
196
|
+
T === "ready" && Y();
|
|
197
|
+
}, [Y, T]);
|
|
198
|
+
let X = d(() => {
|
|
199
|
+
z.current?.clearLayers(), U.current = null, H.current = [], ut(0);
|
|
200
|
+
}, []), Ut = d(() => {
|
|
201
|
+
let e = z.current;
|
|
148
202
|
if (!e) return;
|
|
149
|
-
|
|
150
|
-
let t =
|
|
151
|
-
t.length >= 2 && (
|
|
152
|
-
}, []),
|
|
153
|
-
let t =
|
|
203
|
+
U.current &&= (e.removeLayer(U.current), null);
|
|
204
|
+
let t = H.current;
|
|
205
|
+
t.length >= 2 && (U.current = b.default.polygon(t, Ve).addTo(e));
|
|
206
|
+
}, []), Wt = d(() => {
|
|
207
|
+
let t = H.current;
|
|
154
208
|
if (t.length < 3) {
|
|
155
|
-
|
|
209
|
+
C({
|
|
156
210
|
title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
|
|
157
211
|
description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
|
|
158
212
|
variant: "warning"
|
|
159
213
|
});
|
|
160
214
|
return;
|
|
161
215
|
}
|
|
162
|
-
let n =
|
|
216
|
+
let n = u(t.map((e) => ({
|
|
163
217
|
lat: e.lat,
|
|
164
218
|
lng: e.lng
|
|
165
219
|
})));
|
|
166
|
-
X(),
|
|
220
|
+
X(), K.current = "view", D("view"), n && (I({
|
|
167
221
|
boundary: n,
|
|
168
|
-
area:
|
|
169
|
-
centroid:
|
|
170
|
-
}),
|
|
222
|
+
area: l(n, "acres"),
|
|
223
|
+
centroid: ae(n) ?? [0, 0]
|
|
224
|
+
}), bt(""), St("Clay loam"), wt("Drip"), Et("active"));
|
|
171
225
|
}, [
|
|
172
226
|
X,
|
|
173
227
|
e,
|
|
174
|
-
|
|
175
|
-
]),
|
|
176
|
-
|
|
177
|
-
}, [X]),
|
|
178
|
-
X(),
|
|
179
|
-
}, [X]), Z =
|
|
180
|
-
|
|
181
|
-
}, []),
|
|
182
|
-
if (!
|
|
183
|
-
|
|
184
|
-
let e =
|
|
228
|
+
C
|
|
229
|
+
]), Gt = d(() => {
|
|
230
|
+
k(null), X(), K.current = "draw", D("draw");
|
|
231
|
+
}, [X]), Kt = d(() => {
|
|
232
|
+
X(), K.current = "view", D("view");
|
|
233
|
+
}, [X]), Z = d(() => {
|
|
234
|
+
B.current?.clearLayers(), G.current = null, W.current = [], ft(null), mt(!1);
|
|
235
|
+
}, []), qt = d(() => {
|
|
236
|
+
if (!B.current || !G.current) return;
|
|
237
|
+
G.current.setLatLngs(W.current);
|
|
238
|
+
let e = u(W.current.map((e) => ({
|
|
185
239
|
lat: e.lat,
|
|
186
240
|
lng: e.lng
|
|
187
241
|
})));
|
|
188
|
-
e &&
|
|
189
|
-
}, [
|
|
190
|
-
let t =
|
|
191
|
-
if (!t || !n || !
|
|
192
|
-
let r =
|
|
242
|
+
e && ft(l(e, q?.unit ?? "acres"));
|
|
243
|
+
}, [q]), Jt = d(() => {
|
|
244
|
+
let t = R.current, n = B.current;
|
|
245
|
+
if (!t || !n || !q) return;
|
|
246
|
+
let r = x(q);
|
|
193
247
|
if (!r) {
|
|
194
|
-
|
|
248
|
+
C({
|
|
195
249
|
title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
|
|
196
250
|
description: e("healthybowl.fieldMapPage.toast.noBoundary.description", "Draw a boundary for this field first."),
|
|
197
251
|
variant: "warning"
|
|
@@ -199,89 +253,89 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
199
253
|
return;
|
|
200
254
|
}
|
|
201
255
|
n.clearLayers();
|
|
202
|
-
let i = r.coordinates[0].slice(0, -1).map(([e, t]) =>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
icon:
|
|
256
|
+
let i = r.coordinates[0].slice(0, -1).map(([e, t]) => b.default.latLng(t, e));
|
|
257
|
+
W.current = i, G.current = b.default.polygon(i, He).addTo(n), i.forEach((e, t) => {
|
|
258
|
+
b.default.marker(i[t], {
|
|
259
|
+
icon: Je,
|
|
206
260
|
draggable: !0
|
|
207
261
|
}).addTo(n).on("drag", (e) => {
|
|
208
|
-
|
|
262
|
+
W.current[t] = e.target.getLatLng(), qt(), mt(!0);
|
|
209
263
|
});
|
|
210
|
-
}),
|
|
264
|
+
}), K.current = "edit", D("edit"), mt(!1), ft(l(r, q.unit));
|
|
211
265
|
}, [
|
|
212
|
-
|
|
213
|
-
|
|
266
|
+
qt,
|
|
267
|
+
q,
|
|
214
268
|
e,
|
|
215
|
-
|
|
216
|
-
]),
|
|
217
|
-
Z(),
|
|
218
|
-
}, [Z, Y]),
|
|
219
|
-
if (!
|
|
220
|
-
let t =
|
|
269
|
+
C
|
|
270
|
+
]), Yt = d(() => {
|
|
271
|
+
Z(), K.current = "view", D("view"), Y();
|
|
272
|
+
}, [Z, Y]), Xt = d(async () => {
|
|
273
|
+
if (!q) return;
|
|
274
|
+
let t = u(W.current.map((e) => ({
|
|
221
275
|
lat: e.lat,
|
|
222
276
|
lng: e.lng
|
|
223
277
|
})));
|
|
224
278
|
if (t) {
|
|
225
|
-
|
|
279
|
+
gt(!0);
|
|
226
280
|
try {
|
|
227
|
-
let n =
|
|
228
|
-
await
|
|
229
|
-
id:
|
|
281
|
+
let n = l(t, q.unit);
|
|
282
|
+
await w({ variables: { input: {
|
|
283
|
+
id: q.id,
|
|
230
284
|
boundary: t,
|
|
231
285
|
area: n,
|
|
232
|
-
context: { workspaceId:
|
|
233
|
-
} } }), await
|
|
286
|
+
context: { workspaceId: s }
|
|
287
|
+
} } }), await S(), Z(), K.current = "view", D("view"), C({
|
|
234
288
|
title: e("healthybowl.fieldMapPage.toast.saved.title", "Boundary saved"),
|
|
235
289
|
description: e("healthybowl.fieldMapPage.toast.saved.description", "Area updated to {{area}} {{unit}}.", {
|
|
236
290
|
area: String(n),
|
|
237
|
-
unit:
|
|
291
|
+
unit: q.unit
|
|
238
292
|
}),
|
|
239
293
|
variant: "success"
|
|
240
294
|
});
|
|
241
295
|
} catch (t) {
|
|
242
|
-
|
|
296
|
+
C({
|
|
243
297
|
title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
|
|
244
298
|
description: String(t),
|
|
245
299
|
variant: "error"
|
|
246
300
|
});
|
|
247
301
|
} finally {
|
|
248
|
-
|
|
302
|
+
gt(!1);
|
|
249
303
|
}
|
|
250
304
|
}
|
|
251
305
|
}, [
|
|
252
306
|
Z,
|
|
253
|
-
|
|
254
|
-
|
|
307
|
+
S,
|
|
308
|
+
q,
|
|
255
309
|
e,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
]),
|
|
260
|
-
if (
|
|
261
|
-
if (!
|
|
262
|
-
|
|
310
|
+
C,
|
|
311
|
+
w,
|
|
312
|
+
s
|
|
313
|
+
]), Zt = d(async () => {
|
|
314
|
+
if (q) {
|
|
315
|
+
if (!x(q)) {
|
|
316
|
+
C({
|
|
263
317
|
title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
|
|
264
318
|
description: e("healthybowl.fieldMapPage.toast.deleteNone.description", "This field has no boundary to delete."),
|
|
265
319
|
variant: "warning"
|
|
266
320
|
});
|
|
267
321
|
return;
|
|
268
322
|
}
|
|
269
|
-
if (await
|
|
323
|
+
if (await re({
|
|
270
324
|
title: e("healthybowl.fieldMapPage.confirmDelete.title", "Delete boundary?"),
|
|
271
|
-
message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name:
|
|
325
|
+
message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: q.name }),
|
|
272
326
|
okButtonTitle: e("healthybowl.common.delete", "Delete")
|
|
273
327
|
})) try {
|
|
274
|
-
await
|
|
275
|
-
id:
|
|
328
|
+
await w({ variables: { input: {
|
|
329
|
+
id: q.id,
|
|
276
330
|
boundary: null,
|
|
277
|
-
context: { workspaceId:
|
|
278
|
-
} } }), await
|
|
331
|
+
context: { workspaceId: s }
|
|
332
|
+
} } }), await S(), C({
|
|
279
333
|
title: e("healthybowl.fieldMapPage.toast.boundaryDeleted.title", "Boundary removed"),
|
|
280
334
|
description: e("healthybowl.fieldMapPage.toast.boundaryDeleted.description", "The drawn shape was cleared."),
|
|
281
335
|
variant: "success"
|
|
282
336
|
});
|
|
283
337
|
} catch (t) {
|
|
284
|
-
|
|
338
|
+
C({
|
|
285
339
|
title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
|
|
286
340
|
description: String(t),
|
|
287
341
|
variant: "error"
|
|
@@ -289,415 +343,440 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
289
343
|
}
|
|
290
344
|
}
|
|
291
345
|
}, [
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
346
|
+
re,
|
|
347
|
+
S,
|
|
348
|
+
q,
|
|
295
349
|
e,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
]), Q =
|
|
300
|
-
|
|
301
|
-
}, []),
|
|
302
|
-
let e =
|
|
350
|
+
C,
|
|
351
|
+
w,
|
|
352
|
+
s
|
|
353
|
+
]), Q = d(() => {
|
|
354
|
+
V.current?.clearLayers(), jt.current = [], _t(null);
|
|
355
|
+
}, []), Qt = d(() => {
|
|
356
|
+
let e = V.current;
|
|
303
357
|
if (!e) return;
|
|
304
358
|
e.clearLayers();
|
|
305
|
-
let t =
|
|
359
|
+
let t = jt.current;
|
|
306
360
|
t.forEach((t) => {
|
|
307
|
-
|
|
361
|
+
b.default.circleMarker(t, {
|
|
308
362
|
radius: 4,
|
|
309
363
|
color: "#38bdf8",
|
|
310
364
|
weight: 2,
|
|
311
365
|
fillColor: "#fff",
|
|
312
366
|
fillOpacity: 1
|
|
313
367
|
}).addTo(e);
|
|
314
|
-
}), t.length >= 2 &&
|
|
368
|
+
}), t.length >= 2 && b.default.polyline(t, Ue).addTo(e);
|
|
315
369
|
let n = 0;
|
|
316
370
|
for (let e = 1; e < t.length; e++) n += t[e - 1].distanceTo(t[e]);
|
|
317
371
|
let r = null;
|
|
318
372
|
if (t.length >= 3) {
|
|
319
|
-
let e =
|
|
373
|
+
let e = u(t.map((e) => ({
|
|
320
374
|
lat: e.lat,
|
|
321
375
|
lng: e.lng
|
|
322
376
|
})));
|
|
323
|
-
e && (r =
|
|
377
|
+
e && (r = ie(e));
|
|
324
378
|
}
|
|
325
|
-
|
|
379
|
+
_t({
|
|
326
380
|
distance: n,
|
|
327
381
|
area: r
|
|
328
382
|
});
|
|
329
|
-
}, []),
|
|
330
|
-
|
|
383
|
+
}, []), $t = d(() => {
|
|
384
|
+
k(null), Q(), K.current = "measure", D("measure"), _t({
|
|
331
385
|
distance: 0,
|
|
332
386
|
area: null
|
|
333
387
|
});
|
|
334
|
-
}, [Q]),
|
|
335
|
-
Q(),
|
|
336
|
-
}, [Q]),
|
|
337
|
-
if (
|
|
338
|
-
|
|
339
|
-
let t =
|
|
388
|
+
}, [Q]), en = d(() => {
|
|
389
|
+
Q(), K.current = "view", D("view");
|
|
390
|
+
}, [Q]), tn = d((e) => {
|
|
391
|
+
if (R.current) if (K.current === "draw") {
|
|
392
|
+
H.current.push(e.latlng);
|
|
393
|
+
let t = H.current.length === 1, n = b.default.circleMarker(e.latlng, {
|
|
340
394
|
radius: t ? 7 : 5,
|
|
341
395
|
color: "#fff",
|
|
342
396
|
weight: 2,
|
|
343
397
|
fillColor: t ? "#16a34a" : "#f59e0b",
|
|
344
398
|
fillOpacity: 1
|
|
345
|
-
}).addTo(
|
|
399
|
+
}).addTo(z.current);
|
|
346
400
|
t && n.on("click", (e) => {
|
|
347
|
-
|
|
348
|
-
}),
|
|
349
|
-
} else
|
|
401
|
+
b.default.DomEvent.stopPropagation(e), Wt();
|
|
402
|
+
}), ut(H.current.length), Ut();
|
|
403
|
+
} else K.current === "measure" && (jt.current.push(e.latlng), Qt());
|
|
350
404
|
}, [
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
]),
|
|
405
|
+
Wt,
|
|
406
|
+
Qt,
|
|
407
|
+
Ut
|
|
408
|
+
]), nn = d(async (n) => {
|
|
355
409
|
n.preventDefault();
|
|
356
|
-
let r =
|
|
410
|
+
let r = R.current, i = at.trim();
|
|
357
411
|
if (!r || !i) return;
|
|
358
412
|
let a = i.match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
|
|
359
413
|
if (a) {
|
|
360
|
-
r.flyTo([Number(a[1]), Number(a[2])],
|
|
414
|
+
r.flyTo([Number(a[1]), Number(a[2])], Re, { duration: .6 });
|
|
361
415
|
return;
|
|
362
416
|
}
|
|
363
|
-
|
|
417
|
+
ct(!0);
|
|
364
418
|
try {
|
|
365
419
|
let n = await t(i);
|
|
366
420
|
if (!n) {
|
|
367
|
-
|
|
421
|
+
C({
|
|
368
422
|
title: e("healthybowl.fieldMapPage.toast.placeNotFound.title", "Place not found"),
|
|
369
423
|
description: e("healthybowl.fieldMapPage.toast.placeNotFound.description", "Try a more specific place name."),
|
|
370
424
|
variant: "warning"
|
|
371
425
|
});
|
|
372
426
|
return;
|
|
373
427
|
}
|
|
374
|
-
r.flyTo([n.latitude, n.longitude],
|
|
428
|
+
r.flyTo([n.latitude, n.longitude], Re, { duration: .6 });
|
|
375
429
|
} catch (t) {
|
|
376
|
-
|
|
430
|
+
C({
|
|
377
431
|
title: e("healthybowl.fieldMapPage.toast.searchFailed.title", "Search failed"),
|
|
378
432
|
description: t instanceof Error ? t.message : String(t),
|
|
379
433
|
variant: "error"
|
|
380
434
|
});
|
|
381
435
|
} finally {
|
|
382
|
-
|
|
436
|
+
ct(!1);
|
|
383
437
|
}
|
|
384
438
|
}, [
|
|
385
|
-
|
|
439
|
+
at,
|
|
386
440
|
e,
|
|
387
|
-
|
|
388
|
-
]),
|
|
389
|
-
if (
|
|
390
|
-
if (!
|
|
391
|
-
|
|
441
|
+
C
|
|
442
|
+
]), rn = d(async () => {
|
|
443
|
+
if (F) {
|
|
444
|
+
if (!L.trim()) {
|
|
445
|
+
C({
|
|
392
446
|
title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
|
|
393
447
|
description: e("healthybowl.fieldMapPage.toast.nameRequired.description", "Give the new field a name."),
|
|
394
448
|
variant: "warning"
|
|
395
449
|
});
|
|
396
450
|
return;
|
|
397
451
|
}
|
|
398
|
-
|
|
452
|
+
yt(!0);
|
|
399
453
|
try {
|
|
400
|
-
let [t, n] =
|
|
401
|
-
name:
|
|
402
|
-
area:
|
|
454
|
+
let [t, n] = F.centroid, r = await Ye({
|
|
455
|
+
name: L.trim(),
|
|
456
|
+
area: F.area,
|
|
403
457
|
unit: "acres",
|
|
404
|
-
soilType:
|
|
405
|
-
irrigationType:
|
|
458
|
+
soilType: xt,
|
|
459
|
+
irrigationType: Ct,
|
|
406
460
|
organicCertified: !1,
|
|
407
|
-
status:
|
|
461
|
+
status: Tt,
|
|
408
462
|
crops: [],
|
|
409
463
|
location: {
|
|
410
464
|
lat: t,
|
|
411
465
|
lng: n
|
|
412
466
|
}
|
|
413
467
|
});
|
|
414
|
-
r?.id && await
|
|
468
|
+
r?.id && await w({ variables: { input: {
|
|
415
469
|
id: r.id,
|
|
416
|
-
boundary:
|
|
417
|
-
area:
|
|
418
|
-
context: { workspaceId:
|
|
419
|
-
} } }), await
|
|
470
|
+
boundary: F.boundary,
|
|
471
|
+
area: F.area,
|
|
472
|
+
context: { workspaceId: s }
|
|
473
|
+
} } }), await S(), I(null), r?.id && k(r.id), C({
|
|
420
474
|
title: e("healthybowl.fieldMapPage.toast.fieldCreated.title", "Field created"),
|
|
421
475
|
description: e("healthybowl.fieldMapPage.toast.fieldCreated.description", "{{name}} saved at {{area}} acres.", {
|
|
422
|
-
name:
|
|
423
|
-
area: String(
|
|
476
|
+
name: L.trim(),
|
|
477
|
+
area: String(F.area)
|
|
424
478
|
}),
|
|
425
479
|
variant: "success"
|
|
426
480
|
});
|
|
427
481
|
} catch (t) {
|
|
428
|
-
|
|
482
|
+
C({
|
|
429
483
|
title: e("healthybowl.fieldMapPage.toast.createFailed.title", "Create failed"),
|
|
430
484
|
description: String(t),
|
|
431
485
|
variant: "error"
|
|
432
486
|
});
|
|
433
487
|
} finally {
|
|
434
|
-
|
|
488
|
+
yt(!1);
|
|
435
489
|
}
|
|
436
490
|
}
|
|
437
491
|
}, [
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
492
|
+
Ye,
|
|
493
|
+
Ct,
|
|
494
|
+
L,
|
|
495
|
+
xt,
|
|
496
|
+
Tt,
|
|
497
|
+
F,
|
|
498
|
+
S,
|
|
445
499
|
e,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
500
|
+
C,
|
|
501
|
+
w,
|
|
502
|
+
s
|
|
449
503
|
]);
|
|
450
|
-
|
|
451
|
-
let e =
|
|
504
|
+
f(() => {
|
|
505
|
+
let e = Dt.current;
|
|
452
506
|
if (!e) return;
|
|
453
|
-
|
|
454
|
-
let t =
|
|
455
|
-
attribution:
|
|
456
|
-
maxZoom:
|
|
507
|
+
ne();
|
|
508
|
+
let t = b.default.tileLayer(Ne, {
|
|
509
|
+
attribution: Pe,
|
|
510
|
+
maxZoom: Le,
|
|
457
511
|
maxNativeZoom: 18
|
|
458
|
-
}), n =
|
|
459
|
-
attribution:
|
|
460
|
-
maxZoom:
|
|
512
|
+
}), n = b.default.tileLayer(Fe, {
|
|
513
|
+
attribution: Ie,
|
|
514
|
+
maxZoom: Le,
|
|
461
515
|
maxNativeZoom: 17,
|
|
462
516
|
opacity: .65
|
|
463
517
|
});
|
|
464
|
-
|
|
465
|
-
let r =
|
|
518
|
+
Ot.current = t, kt.current = n;
|
|
519
|
+
let r = b.default.map(e, {
|
|
466
520
|
center: [20, 78],
|
|
467
521
|
zoom: 4,
|
|
468
522
|
scrollWheelZoom: !0,
|
|
469
|
-
maxZoom:
|
|
523
|
+
maxZoom: Le,
|
|
470
524
|
layers: [t]
|
|
471
525
|
});
|
|
472
|
-
return
|
|
473
|
-
r.off("click",
|
|
526
|
+
return R.current = r, At.current = b.default.layerGroup().addTo(r), z.current = b.default.layerGroup().addTo(r), B.current = b.default.layerGroup().addTo(r), V.current = b.default.layerGroup().addTo(r), r.on("click", tn), Qe("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
|
|
527
|
+
r.off("click", tn), r.remove(), R.current = null, Ot.current = null, kt.current = null, At.current = null, z.current = null, B.current = null, V.current = null;
|
|
474
528
|
};
|
|
475
|
-
}, []),
|
|
476
|
-
let e =
|
|
477
|
-
!e || !t || (
|
|
478
|
-
}, [
|
|
479
|
-
let
|
|
480
|
-
if (
|
|
529
|
+
}, []), f(() => {
|
|
530
|
+
let e = R.current, t = kt.current;
|
|
531
|
+
!e || !t || (A ? t.addTo(e) : e.removeLayer(t));
|
|
532
|
+
}, [A]);
|
|
533
|
+
let an = !ze.crops && c.length === 0, on = P ? P.distance >= 1e3 ? `${(P.distance / 1e3).toFixed(2)} km` : `${P.distance.toFixed(0)} m` : "";
|
|
534
|
+
if (Ge.crops && c.length === 0) return /* @__PURE__ */ g(r, {
|
|
481
535
|
title: e("healthybowl.fieldMapPage.title", "Field Map"),
|
|
482
536
|
titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
|
|
483
537
|
description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
|
|
484
|
-
children: /* @__PURE__ */
|
|
538
|
+
children: /* @__PURE__ */ g(i, { onRetry: S })
|
|
485
539
|
});
|
|
486
|
-
let $ = (e, t, n, r) => /* @__PURE__ */
|
|
540
|
+
let $ = (e, t, n, r) => /* @__PURE__ */ _("button", {
|
|
487
541
|
type: "button",
|
|
488
542
|
onClick: t,
|
|
489
543
|
"aria-pressed": e,
|
|
490
544
|
className: `flex flex-col items-center gap-1 rounded-md px-3 py-1.5 text-[11px] font-medium transition-colors ${e ? "bg-success text-white" : "text-text-primary hover:bg-bg-sunken"}`,
|
|
491
545
|
children: [n, r]
|
|
492
546
|
});
|
|
493
|
-
return /* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */ _(r, {
|
|
494
548
|
title: e("healthybowl.fieldMapPage.title", "Field Map"),
|
|
495
549
|
titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
|
|
496
550
|
hero: !0,
|
|
497
551
|
description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
|
|
498
552
|
purpose: "Trace each plot on the aerial view to auto-calculate its acreage, shade fields by soil type, overlay terrain, and see your whole holding at a glance. Click any field in the list to fly straight to it.",
|
|
499
553
|
children: [
|
|
500
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ _("div", {
|
|
501
555
|
className: "flex flex-col gap-4 lg:flex-row",
|
|
502
|
-
children: [/* @__PURE__ */
|
|
556
|
+
children: [/* @__PURE__ */ _("div", {
|
|
503
557
|
className: "min-w-0 flex-1 space-y-3",
|
|
504
558
|
children: [
|
|
505
|
-
/* @__PURE__ */
|
|
559
|
+
/* @__PURE__ */ _("form", {
|
|
506
560
|
className: "flex gap-2",
|
|
507
|
-
onSubmit:
|
|
508
|
-
children: [/* @__PURE__ */
|
|
561
|
+
onSubmit: nn,
|
|
562
|
+
children: [/* @__PURE__ */ _("div", {
|
|
509
563
|
className: "relative min-w-0 flex-1",
|
|
510
|
-
children: [/* @__PURE__ */
|
|
564
|
+
children: [/* @__PURE__ */ g(xe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ g("input", {
|
|
511
565
|
type: "search",
|
|
512
|
-
value:
|
|
513
|
-
onChange: (e) =>
|
|
566
|
+
value: at,
|
|
567
|
+
onChange: (e) => ot(e.target.value),
|
|
514
568
|
placeholder: e("healthybowl.fieldMapPage.placeSearch.placeholder", "Find your farm — village, city, or lat,lng…"),
|
|
515
569
|
"aria-label": e("healthybowl.fieldMapPage.placeSearch.label", "Locate a place on the map"),
|
|
516
570
|
className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
517
571
|
})]
|
|
518
|
-
}), /* @__PURE__ */
|
|
572
|
+
}), /* @__PURE__ */ _(v, {
|
|
519
573
|
type: "submit",
|
|
520
574
|
variant: "outline",
|
|
521
575
|
size: "sm",
|
|
522
|
-
disabled:
|
|
576
|
+
disabled: T !== "ready" || st,
|
|
523
577
|
children: [
|
|
524
|
-
/* @__PURE__ */
|
|
578
|
+
/* @__PURE__ */ g(he, { className: "h-4 w-4" }),
|
|
525
579
|
" ",
|
|
526
|
-
|
|
580
|
+
st ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
|
|
527
581
|
]
|
|
528
582
|
})]
|
|
529
583
|
}),
|
|
530
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ _("div", {
|
|
531
585
|
className: "relative",
|
|
532
586
|
children: [
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
ref:
|
|
587
|
+
/* @__PURE__ */ g("div", {
|
|
588
|
+
ref: Dt,
|
|
535
589
|
className: "h-[70vh] max-h-[640px] w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken"
|
|
536
590
|
}),
|
|
537
|
-
|
|
591
|
+
T === "ready" && /* @__PURE__ */ _("div", {
|
|
538
592
|
className: "absolute right-3 top-3 z-[1000] flex items-center gap-1 rounded-lg border border-border-subtle bg-bg-surface/95 p-1 shadow-md",
|
|
539
593
|
children: [
|
|
540
|
-
$(
|
|
541
|
-
$(
|
|
542
|
-
$(!1,
|
|
543
|
-
$(
|
|
594
|
+
$(E === "draw", () => E === "draw" ? Kt() : Gt(), /* @__PURE__ */ g(_e, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
|
|
595
|
+
$(E === "edit", () => E === "edit" ? Yt() : Jt(), /* @__PURE__ */ g(Se, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
|
|
596
|
+
$(!1, Zt, /* @__PURE__ */ g(Ce, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
|
|
597
|
+
$(E === "measure", () => E === "measure" ? en() : $t(), /* @__PURE__ */ g(ye, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure"))
|
|
544
598
|
]
|
|
545
599
|
}),
|
|
546
|
-
|
|
600
|
+
E === "draw" && /* @__PURE__ */ _("div", {
|
|
547
601
|
className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
|
|
548
602
|
children: [
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(lt) }) }),
|
|
604
|
+
/* @__PURE__ */ _(v, {
|
|
551
605
|
size: "sm",
|
|
552
606
|
variant: "default",
|
|
553
|
-
onClick:
|
|
607
|
+
onClick: Wt,
|
|
554
608
|
children: [
|
|
555
|
-
/* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ g(pe, { className: "h-3.5 w-3.5" }),
|
|
556
610
|
" ",
|
|
557
611
|
e("healthybowl.fieldMapPage.finish", "Finish")
|
|
558
612
|
]
|
|
559
613
|
}),
|
|
560
|
-
/* @__PURE__ */ v
|
|
614
|
+
/* @__PURE__ */ g(v, {
|
|
561
615
|
size: "sm",
|
|
562
616
|
variant: "outline",
|
|
563
|
-
onClick:
|
|
564
|
-
children: /* @__PURE__ */
|
|
617
|
+
onClick: Kt,
|
|
618
|
+
children: /* @__PURE__ */ g(we, { className: "h-3.5 w-3.5" })
|
|
565
619
|
})
|
|
566
620
|
]
|
|
567
621
|
}),
|
|
568
|
-
|
|
622
|
+
E === "edit" && /* @__PURE__ */ _("div", {
|
|
569
623
|
className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
|
|
570
624
|
children: [
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
-
area: String(
|
|
573
|
-
unit:
|
|
625
|
+
/* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
|
|
626
|
+
area: String(dt ?? ""),
|
|
627
|
+
unit: q?.unit ?? "acres"
|
|
574
628
|
}) }),
|
|
575
|
-
/* @__PURE__ */
|
|
629
|
+
/* @__PURE__ */ _(v, {
|
|
576
630
|
size: "sm",
|
|
577
631
|
variant: "default",
|
|
578
|
-
onClick:
|
|
579
|
-
disabled: !
|
|
632
|
+
onClick: Xt,
|
|
633
|
+
disabled: !pt || ht,
|
|
580
634
|
children: [
|
|
581
|
-
/* @__PURE__ */
|
|
635
|
+
/* @__PURE__ */ g(be, { className: "h-3.5 w-3.5" }),
|
|
582
636
|
" ",
|
|
583
|
-
|
|
637
|
+
ht ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
|
|
584
638
|
]
|
|
585
639
|
}),
|
|
586
|
-
/* @__PURE__ */ v
|
|
640
|
+
/* @__PURE__ */ g(v, {
|
|
587
641
|
size: "sm",
|
|
588
642
|
variant: "outline",
|
|
589
|
-
onClick:
|
|
590
|
-
children: /* @__PURE__ */
|
|
643
|
+
onClick: Yt,
|
|
644
|
+
children: /* @__PURE__ */ g(we, { className: "h-3.5 w-3.5" })
|
|
591
645
|
})
|
|
592
646
|
]
|
|
593
647
|
}),
|
|
594
|
-
|
|
648
|
+
E === "measure" && P && /* @__PURE__ */ _("div", {
|
|
595
649
|
className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-3 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
|
|
596
650
|
children: [
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
/* @__PURE__ */ v
|
|
651
|
+
/* @__PURE__ */ _("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: on }), P.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (P.area / 4046.8564224).toFixed(2) })}`] }),
|
|
652
|
+
/* @__PURE__ */ g(v, {
|
|
599
653
|
size: "sm",
|
|
600
654
|
variant: "outline",
|
|
601
655
|
onClick: Q,
|
|
602
656
|
children: e("healthybowl.fieldMapPage.measure.reset", "Reset")
|
|
603
657
|
}),
|
|
604
|
-
/* @__PURE__ */ v
|
|
658
|
+
/* @__PURE__ */ g(v, {
|
|
605
659
|
size: "sm",
|
|
606
660
|
variant: "outline",
|
|
607
|
-
onClick:
|
|
608
|
-
children: /* @__PURE__ */
|
|
661
|
+
onClick: en,
|
|
662
|
+
children: /* @__PURE__ */ g(we, { className: "h-3.5 w-3.5" })
|
|
609
663
|
})
|
|
610
664
|
]
|
|
611
665
|
}),
|
|
612
|
-
|
|
666
|
+
T === "ready" && /* @__PURE__ */ _("div", {
|
|
613
667
|
className: "absolute bottom-3 left-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
|
|
614
668
|
children: [
|
|
615
|
-
/* @__PURE__ */
|
|
669
|
+
/* @__PURE__ */ _("div", {
|
|
616
670
|
className: "mb-1.5 flex items-center gap-1.5 font-semibold text-text-primary",
|
|
617
671
|
children: [
|
|
618
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ g(me, { className: "h-3.5 w-3.5" }),
|
|
619
673
|
" ",
|
|
620
674
|
e("healthybowl.fieldMapPage.layers.title", "Layers")
|
|
621
675
|
]
|
|
622
676
|
}),
|
|
623
|
-
/* @__PURE__ */
|
|
677
|
+
/* @__PURE__ */ _("label", {
|
|
624
678
|
className: "flex items-center gap-2 py-0.5 text-text-secondary",
|
|
625
|
-
children: [/* @__PURE__ */
|
|
679
|
+
children: [/* @__PURE__ */ g("input", {
|
|
626
680
|
type: "checkbox",
|
|
627
681
|
checked: !0,
|
|
628
682
|
readOnly: !0,
|
|
629
683
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
630
684
|
}), e("healthybowl.fieldMapPage.layers.satellite", "Satellite")]
|
|
631
685
|
}),
|
|
632
|
-
/* @__PURE__ */
|
|
686
|
+
/* @__PURE__ */ _("label", {
|
|
633
687
|
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
634
|
-
children: [/* @__PURE__ */
|
|
688
|
+
children: [/* @__PURE__ */ g("input", {
|
|
635
689
|
type: "checkbox",
|
|
636
|
-
checked:
|
|
637
|
-
onChange: (e) =>
|
|
690
|
+
checked: A,
|
|
691
|
+
onChange: (e) => $e(e.target.checked),
|
|
638
692
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
639
693
|
}), e("healthybowl.fieldMapPage.layers.terrain", "Terrain")]
|
|
640
694
|
}),
|
|
641
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ _("label", {
|
|
642
696
|
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
643
|
-
children: [/* @__PURE__ */
|
|
697
|
+
children: [/* @__PURE__ */ g("input", {
|
|
644
698
|
type: "checkbox",
|
|
645
|
-
checked:
|
|
646
|
-
onChange: (e) =>
|
|
699
|
+
checked: j,
|
|
700
|
+
onChange: (e) => et(e.target.checked),
|
|
647
701
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
648
702
|
}), e("healthybowl.fieldMapPage.layers.soil", "Soil type")]
|
|
703
|
+
}),
|
|
704
|
+
/* @__PURE__ */ _("label", {
|
|
705
|
+
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
706
|
+
children: [/* @__PURE__ */ g("input", {
|
|
707
|
+
type: "checkbox",
|
|
708
|
+
checked: M,
|
|
709
|
+
onChange: (e) => tt(e.target.checked),
|
|
710
|
+
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
711
|
+
}), e("healthybowl.fieldMapPage.layers.elevation", "Elevation")]
|
|
649
712
|
})
|
|
650
713
|
]
|
|
651
714
|
}),
|
|
652
|
-
|
|
715
|
+
T === "ready" && M && /* @__PURE__ */ _("div", {
|
|
716
|
+
className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
|
|
717
|
+
children: [/* @__PURE__ */ g("div", {
|
|
718
|
+
className: "mb-1.5 font-semibold text-text-primary",
|
|
719
|
+
children: e("healthybowl.fieldMapPage.elevationLegend.title", "Elevation")
|
|
720
|
+
}), zt ? /* @__PURE__ */ _(Te, { children: [/* @__PURE__ */ g("span", {
|
|
721
|
+
className: "block h-2 w-40 rounded-full",
|
|
722
|
+
style: { background: "linear-gradient(to right, #16a34a, #f59e0b, #dc2626)" }
|
|
723
|
+
}), /* @__PURE__ */ _("div", {
|
|
724
|
+
className: "mt-1 flex justify-between gap-3 text-text-secondary",
|
|
725
|
+
children: [/* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.elevationLegend.low", "{{value}} m Low", { value: String(Math.round(Lt)) }) }), /* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.elevationLegend.high", "{{value}} m High", { value: String(Math.round(Rt)) }) })]
|
|
726
|
+
})] }) : /* @__PURE__ */ g("span", {
|
|
727
|
+
className: "text-text-secondary",
|
|
728
|
+
children: e("healthybowl.fieldMapPage.elevationLegend.loading", "Loading elevation…")
|
|
729
|
+
})]
|
|
730
|
+
}),
|
|
731
|
+
T === "ready" && j && !M && Ft.length > 0 && /* @__PURE__ */ _("div", {
|
|
653
732
|
className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
|
|
654
|
-
children: [/* @__PURE__ */
|
|
733
|
+
children: [/* @__PURE__ */ g("div", {
|
|
655
734
|
className: "mb-1.5 font-semibold text-text-primary",
|
|
656
735
|
children: e("healthybowl.fieldMapPage.soilLegend.title", "Soil Legend")
|
|
657
|
-
}),
|
|
736
|
+
}), Ft.map((t) => /* @__PURE__ */ _("div", {
|
|
658
737
|
className: "flex items-center gap-2 py-0.5 text-text-secondary",
|
|
659
|
-
children: [/* @__PURE__ */
|
|
738
|
+
children: [/* @__PURE__ */ g("span", {
|
|
660
739
|
className: "inline-block h-3 w-3 rounded-sm",
|
|
661
740
|
style: { backgroundColor: t.color }
|
|
662
741
|
}), e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)]
|
|
663
742
|
}, t.key))]
|
|
664
743
|
}),
|
|
665
|
-
|
|
744
|
+
T === "ready" && A && /* @__PURE__ */ _("div", {
|
|
666
745
|
className: "absolute left-3 top-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 px-3 py-2 text-[11px] text-text-secondary shadow-md",
|
|
667
|
-
children: [/* @__PURE__ */
|
|
746
|
+
children: [/* @__PURE__ */ g("div", {
|
|
668
747
|
className: "font-semibold text-text-primary",
|
|
669
748
|
children: e("healthybowl.fieldMapPage.terrainLegend.title", "Terrain / Elevation")
|
|
670
|
-
}), /* @__PURE__ */
|
|
749
|
+
}), /* @__PURE__ */ _("div", {
|
|
671
750
|
className: "mt-1 flex items-center gap-2",
|
|
672
|
-
children: [/* @__PURE__ */
|
|
751
|
+
children: [/* @__PURE__ */ g("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
|
|
673
752
|
})]
|
|
674
753
|
}),
|
|
675
|
-
(
|
|
754
|
+
(T === "loading" || ze.crops && c.length === 0) && /* @__PURE__ */ g("div", {
|
|
676
755
|
className: "pointer-events-none absolute inset-0 z-[900] flex items-center justify-center rounded-lg bg-bg-surface/60 text-sm text-text-secondary",
|
|
677
756
|
children: e("healthybowl.fieldMapPage.loading", "Loading map…")
|
|
678
757
|
}),
|
|
679
|
-
|
|
758
|
+
an && T === "ready" && E === "view" && /* @__PURE__ */ g("div", {
|
|
680
759
|
className: "absolute inset-0 z-[950] flex items-center justify-center p-6",
|
|
681
|
-
children: /* @__PURE__ */
|
|
760
|
+
children: /* @__PURE__ */ _("div", {
|
|
682
761
|
className: "max-w-sm rounded-xl border border-border-subtle bg-bg-surface/95 p-6 text-center shadow-lg",
|
|
683
762
|
children: [
|
|
684
|
-
/* @__PURE__ */
|
|
763
|
+
/* @__PURE__ */ g("div", {
|
|
685
764
|
className: "mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-success/15",
|
|
686
|
-
children: /* @__PURE__ */
|
|
765
|
+
children: /* @__PURE__ */ g(ge, { className: "h-6 w-6 text-success" })
|
|
687
766
|
}),
|
|
688
|
-
/* @__PURE__ */
|
|
767
|
+
/* @__PURE__ */ g("h3", {
|
|
689
768
|
className: "text-lg font-semibold text-text-primary",
|
|
690
769
|
children: e("healthybowl.fieldMapPage.empty.title", "No field boundaries yet")
|
|
691
770
|
}),
|
|
692
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ g("p", {
|
|
693
772
|
className: "mt-1 text-sm text-text-secondary",
|
|
694
773
|
children: e("healthybowl.fieldMapPage.empty.description", "Draw the shape of each field on the satellite view to auto-calculate its area and unlock soil & terrain overlays.")
|
|
695
774
|
}),
|
|
696
|
-
/* @__PURE__ */
|
|
775
|
+
/* @__PURE__ */ _(v, {
|
|
697
776
|
className: "mt-4",
|
|
698
|
-
onClick:
|
|
777
|
+
onClick: Gt,
|
|
699
778
|
children: [
|
|
700
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ g(ve, { className: "h-4 w-4" }),
|
|
701
780
|
" ",
|
|
702
781
|
e("healthybowl.fieldMapPage.empty.action", "Draw Your First Field")
|
|
703
782
|
]
|
|
@@ -707,174 +786,186 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
707
786
|
})
|
|
708
787
|
]
|
|
709
788
|
}),
|
|
710
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ g("p", {
|
|
711
790
|
className: "text-xs text-text-secondary",
|
|
712
791
|
children: e("healthybowl.fieldMapPage.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · terrain © OpenTopoMap / OpenStreetMap")
|
|
713
792
|
})
|
|
714
793
|
]
|
|
715
|
-
}), /* @__PURE__ */
|
|
794
|
+
}), /* @__PURE__ */ _("aside", {
|
|
716
795
|
className: "shrink-0 space-y-4 lg:w-80",
|
|
717
|
-
children: [/* @__PURE__ */
|
|
796
|
+
children: [/* @__PURE__ */ _("div", {
|
|
718
797
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
719
798
|
children: [
|
|
720
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ g("h2", {
|
|
721
800
|
className: "text-base font-semibold text-text-primary",
|
|
722
801
|
children: e("healthybowl.fieldMapPage.panel.title", "Fields")
|
|
723
802
|
}),
|
|
724
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ g("p", {
|
|
725
804
|
className: "mt-0.5 text-xs text-text-secondary",
|
|
726
805
|
children: e("healthybowl.fieldMapPage.panel.summary", "{{acres}} acres · {{count}} fields · {{mapped}} mapped", {
|
|
727
|
-
acres:
|
|
728
|
-
count: String(
|
|
729
|
-
mapped: String(
|
|
806
|
+
acres: Pt.toFixed(1),
|
|
807
|
+
count: String(c.length),
|
|
808
|
+
mapped: String(Nt)
|
|
730
809
|
})
|
|
731
810
|
}),
|
|
732
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ _("div", {
|
|
733
812
|
className: "relative mt-3",
|
|
734
|
-
children: [/* @__PURE__ */
|
|
813
|
+
children: [/* @__PURE__ */ g(xe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ g("input", {
|
|
735
814
|
type: "search",
|
|
736
|
-
value:
|
|
737
|
-
onChange: (e) =>
|
|
815
|
+
value: rt,
|
|
816
|
+
onChange: (e) => it(e.target.value),
|
|
738
817
|
placeholder: e("healthybowl.fieldMapPage.panel.search", "Search fields…"),
|
|
739
818
|
className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
740
819
|
})]
|
|
741
820
|
}),
|
|
742
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ _("div", {
|
|
743
822
|
className: "mt-3 max-h-[38vh] space-y-1 overflow-y-auto",
|
|
744
|
-
children: [
|
|
745
|
-
let n =
|
|
746
|
-
return /* @__PURE__ */
|
|
823
|
+
children: [It.map((t) => {
|
|
824
|
+
let n = x(t) !== null;
|
|
825
|
+
return /* @__PURE__ */ _("button", {
|
|
747
826
|
type: "button",
|
|
748
|
-
|
|
749
|
-
|
|
827
|
+
"data-field-id": t.id,
|
|
828
|
+
onClick: () => Ht(t),
|
|
829
|
+
className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-left transition-colors ${t.id === O ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
|
|
750
830
|
children: [
|
|
751
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ g("span", {
|
|
752
832
|
className: "mt-0.5 inline-block h-4 w-4 shrink-0 rounded",
|
|
753
|
-
style: { backgroundColor:
|
|
833
|
+
style: { backgroundColor: se(t.soilType) }
|
|
754
834
|
}),
|
|
755
|
-
/* @__PURE__ */
|
|
835
|
+
/* @__PURE__ */ _("span", {
|
|
756
836
|
className: "min-w-0 flex-1",
|
|
757
|
-
children: [/* @__PURE__ */
|
|
837
|
+
children: [/* @__PURE__ */ g("span", {
|
|
758
838
|
className: "block truncate text-sm font-medium text-text-primary",
|
|
759
839
|
children: t.name
|
|
760
|
-
}), /* @__PURE__ */
|
|
840
|
+
}), /* @__PURE__ */ _("span", {
|
|
761
841
|
className: "block truncate text-xs text-text-secondary",
|
|
762
842
|
children: [
|
|
763
|
-
|
|
764
|
-
"
|
|
843
|
+
qe(t),
|
|
844
|
+
" ·",
|
|
765
845
|
" ",
|
|
766
|
-
t.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
|
|
846
|
+
t.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil"),
|
|
847
|
+
N[t.id] != null && ` · ${e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[t.id])) })}`
|
|
767
848
|
]
|
|
768
849
|
})]
|
|
769
850
|
}),
|
|
770
|
-
!n && /* @__PURE__ */
|
|
851
|
+
!n && /* @__PURE__ */ g("span", {
|
|
771
852
|
className: "shrink-0 rounded-full bg-warning/20 px-1.5 py-0.5 text-[10px] font-medium text-warning",
|
|
772
853
|
children: e("healthybowl.fieldMapPage.unmapped", "no boundary")
|
|
773
854
|
})
|
|
774
855
|
]
|
|
775
856
|
}, t.id);
|
|
776
|
-
}),
|
|
857
|
+
}), It.length === 0 && /* @__PURE__ */ g("p", {
|
|
777
858
|
className: "px-2 py-4 text-center text-xs text-text-secondary",
|
|
778
859
|
children: e("healthybowl.fieldMapPage.panel.none", "No fields match your search.")
|
|
779
860
|
})]
|
|
780
861
|
}),
|
|
781
|
-
/* @__PURE__ */
|
|
862
|
+
/* @__PURE__ */ _(v, {
|
|
782
863
|
className: "mt-3 w-full",
|
|
783
|
-
onClick:
|
|
784
|
-
disabled:
|
|
864
|
+
onClick: Gt,
|
|
865
|
+
disabled: E === "draw",
|
|
785
866
|
children: [
|
|
786
|
-
/* @__PURE__ */
|
|
867
|
+
/* @__PURE__ */ g(ve, { className: "h-4 w-4" }),
|
|
787
868
|
" ",
|
|
788
869
|
e("healthybowl.fieldMapPage.panel.drawNew", "Draw New Field")
|
|
789
870
|
]
|
|
790
871
|
})
|
|
791
872
|
]
|
|
792
|
-
}),
|
|
873
|
+
}), q && /* @__PURE__ */ _("div", {
|
|
793
874
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
794
875
|
children: [
|
|
795
|
-
/* @__PURE__ */
|
|
876
|
+
/* @__PURE__ */ g("h3", {
|
|
796
877
|
className: "text-sm font-semibold text-text-primary",
|
|
797
|
-
children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name:
|
|
878
|
+
children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: q.name })
|
|
798
879
|
}),
|
|
799
|
-
/* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ _("dl", {
|
|
800
881
|
className: "mt-3 space-y-2 text-sm",
|
|
801
882
|
children: [
|
|
802
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ _("div", {
|
|
803
884
|
className: "flex justify-between gap-3",
|
|
804
|
-
children: [/* @__PURE__ */
|
|
885
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
805
886
|
className: "text-text-secondary",
|
|
806
887
|
children: e("healthybowl.fieldMapPage.detail.area", "Area")
|
|
807
|
-
}), /* @__PURE__ */
|
|
888
|
+
}), /* @__PURE__ */ _("dd", {
|
|
808
889
|
className: "font-medium text-text-primary",
|
|
809
890
|
children: [
|
|
810
|
-
|
|
891
|
+
q.area,
|
|
811
892
|
" ",
|
|
812
|
-
|
|
893
|
+
q.unit
|
|
813
894
|
]
|
|
814
895
|
})]
|
|
815
896
|
}),
|
|
816
|
-
/* @__PURE__ */
|
|
897
|
+
/* @__PURE__ */ _("div", {
|
|
898
|
+
className: "flex justify-between gap-3",
|
|
899
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
900
|
+
className: "text-text-secondary",
|
|
901
|
+
children: e("healthybowl.fieldMapPage.detail.elevation", "Elevation")
|
|
902
|
+
}), /* @__PURE__ */ g("dd", {
|
|
903
|
+
className: "font-medium text-text-primary",
|
|
904
|
+
children: N[q.id] == null ? "—" : e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[q.id])) })
|
|
905
|
+
})]
|
|
906
|
+
}),
|
|
907
|
+
/* @__PURE__ */ _("div", {
|
|
817
908
|
className: "flex justify-between gap-3",
|
|
818
|
-
children: [/* @__PURE__ */
|
|
909
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
819
910
|
className: "text-text-secondary",
|
|
820
911
|
children: e("healthybowl.fieldMapPage.detail.soil", "Soil")
|
|
821
|
-
}), /* @__PURE__ */
|
|
912
|
+
}), /* @__PURE__ */ g("dd", {
|
|
822
913
|
className: "font-medium text-text-primary",
|
|
823
|
-
children:
|
|
914
|
+
children: q.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
|
|
824
915
|
})]
|
|
825
916
|
}),
|
|
826
|
-
/* @__PURE__ */
|
|
917
|
+
/* @__PURE__ */ _("div", {
|
|
827
918
|
className: "flex justify-between gap-3",
|
|
828
|
-
children: [/* @__PURE__ */
|
|
919
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
829
920
|
className: "text-text-secondary",
|
|
830
921
|
children: e("healthybowl.fieldMapPage.detail.irrigation", "Irrigation")
|
|
831
|
-
}), /* @__PURE__ */
|
|
922
|
+
}), /* @__PURE__ */ g("dd", {
|
|
832
923
|
className: "font-medium text-text-primary",
|
|
833
|
-
children:
|
|
924
|
+
children: q.irrigationType || "—"
|
|
834
925
|
})]
|
|
835
926
|
}),
|
|
836
|
-
/* @__PURE__ */
|
|
927
|
+
/* @__PURE__ */ _("div", {
|
|
837
928
|
className: "flex justify-between gap-3",
|
|
838
|
-
children: [/* @__PURE__ */
|
|
929
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
839
930
|
className: "text-text-secondary",
|
|
840
931
|
children: e("healthybowl.fieldMapPage.detail.crop", "Crop")
|
|
841
|
-
}), /* @__PURE__ */
|
|
932
|
+
}), /* @__PURE__ */ g("dd", {
|
|
842
933
|
className: "font-medium text-text-primary",
|
|
843
|
-
children:
|
|
934
|
+
children: Bt(q) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
|
|
844
935
|
})]
|
|
845
936
|
}),
|
|
846
|
-
/* @__PURE__ */
|
|
937
|
+
/* @__PURE__ */ _("div", {
|
|
847
938
|
className: "flex justify-between gap-3",
|
|
848
|
-
children: [/* @__PURE__ */
|
|
939
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
849
940
|
className: "text-text-secondary",
|
|
850
941
|
children: e("healthybowl.fieldMapPage.detail.status", "Status")
|
|
851
|
-
}), /* @__PURE__ */
|
|
942
|
+
}), /* @__PURE__ */ g("dd", {
|
|
852
943
|
className: "font-medium capitalize text-text-primary",
|
|
853
|
-
children:
|
|
944
|
+
children: q.status
|
|
854
945
|
})]
|
|
855
946
|
})
|
|
856
947
|
]
|
|
857
948
|
}),
|
|
858
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ _("div", {
|
|
859
950
|
className: "mt-3 flex gap-2",
|
|
860
|
-
children: [/* @__PURE__ */
|
|
951
|
+
children: [/* @__PURE__ */ _(v, {
|
|
861
952
|
variant: "outline",
|
|
862
953
|
size: "sm",
|
|
863
954
|
className: "flex-1",
|
|
864
|
-
onClick: () =>
|
|
955
|
+
onClick: () => Vt(q),
|
|
865
956
|
children: [
|
|
866
|
-
/* @__PURE__ */
|
|
957
|
+
/* @__PURE__ */ g(ge, { className: "h-4 w-4" }),
|
|
867
958
|
" ",
|
|
868
959
|
e("healthybowl.fieldMapPage.detail.flyTo", "Fly to")
|
|
869
960
|
]
|
|
870
|
-
}),
|
|
961
|
+
}), x(q) && /* @__PURE__ */ _(v, {
|
|
871
962
|
variant: "outline",
|
|
872
963
|
size: "sm",
|
|
873
964
|
className: "flex-1",
|
|
874
|
-
onClick:
|
|
875
|
-
disabled:
|
|
965
|
+
onClick: Jt,
|
|
966
|
+
disabled: E === "edit",
|
|
876
967
|
children: [
|
|
877
|
-
/* @__PURE__ */
|
|
968
|
+
/* @__PURE__ */ g(Se, { className: "h-4 w-4" }),
|
|
878
969
|
" ",
|
|
879
970
|
e("healthybowl.fieldMapPage.detail.edit", "Edit")
|
|
880
971
|
]
|
|
@@ -884,105 +975,105 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
884
975
|
})]
|
|
885
976
|
})]
|
|
886
977
|
}),
|
|
887
|
-
/* @__PURE__ */
|
|
888
|
-
open:
|
|
889
|
-
onClose: () =>
|
|
978
|
+
/* @__PURE__ */ g(ee, {
|
|
979
|
+
open: F !== null,
|
|
980
|
+
onClose: () => I(null),
|
|
890
981
|
title: e("healthybowl.fieldMapPage.create.title", "Save New Field"),
|
|
891
982
|
description: e("healthybowl.fieldMapPage.create.description", "Name the field you just drew. Its area is auto-calculated."),
|
|
892
|
-
footer: /* @__PURE__ */
|
|
983
|
+
footer: /* @__PURE__ */ _(Te, { children: [/* @__PURE__ */ g(v, {
|
|
893
984
|
variant: "outline",
|
|
894
|
-
onClick: () =>
|
|
985
|
+
onClick: () => I(null),
|
|
895
986
|
className: "text-text-secondary",
|
|
896
987
|
children: e("healthybowl.common.cancel", "Cancel")
|
|
897
|
-
}), /* @__PURE__ */ v
|
|
898
|
-
onClick:
|
|
899
|
-
disabled:
|
|
900
|
-
children:
|
|
988
|
+
}), /* @__PURE__ */ g(v, {
|
|
989
|
+
onClick: rn,
|
|
990
|
+
disabled: vt,
|
|
991
|
+
children: vt ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
|
|
901
992
|
})] }),
|
|
902
|
-
children: /* @__PURE__ */
|
|
993
|
+
children: /* @__PURE__ */ _("div", {
|
|
903
994
|
className: "space-y-4",
|
|
904
995
|
children: [
|
|
905
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ g("div", {
|
|
906
997
|
className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
|
|
907
|
-
children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(
|
|
998
|
+
children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(F?.area ?? 0) })
|
|
908
999
|
}),
|
|
909
|
-
/* @__PURE__ */
|
|
1000
|
+
/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
910
1001
|
className: "text-sm font-medium text-text-primary",
|
|
911
1002
|
children: e("healthybowl.fieldMapPage.create.name", "Field name *")
|
|
912
|
-
}), /* @__PURE__ */
|
|
1003
|
+
}), /* @__PURE__ */ g("input", {
|
|
913
1004
|
type: "text",
|
|
914
|
-
value:
|
|
915
|
-
onChange: (e) =>
|
|
1005
|
+
value: L,
|
|
1006
|
+
onChange: (e) => bt(e.target.value),
|
|
916
1007
|
placeholder: e("healthybowl.fieldMapPage.create.namePlaceholder", "e.g., North Paddy"),
|
|
917
1008
|
className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
918
1009
|
})] }),
|
|
919
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ _("div", {
|
|
920
1011
|
className: "grid grid-cols-2 gap-3",
|
|
921
|
-
children: [/* @__PURE__ */
|
|
1012
|
+
children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
922
1013
|
className: "text-sm font-medium text-text-primary",
|
|
923
1014
|
children: e("healthybowl.fieldMapPage.create.soil", "Soil type")
|
|
924
|
-
}), /* @__PURE__ */
|
|
925
|
-
value:
|
|
926
|
-
onValueChange:
|
|
927
|
-
children: [/* @__PURE__ */
|
|
1015
|
+
}), /* @__PURE__ */ _(Ee, {
|
|
1016
|
+
value: xt,
|
|
1017
|
+
onValueChange: St,
|
|
1018
|
+
children: [/* @__PURE__ */ g(Oe, {
|
|
928
1019
|
className: "mt-1 w-full",
|
|
929
|
-
children: /* @__PURE__ */
|
|
930
|
-
}), /* @__PURE__ */
|
|
1020
|
+
children: /* @__PURE__ */ g(ke, {})
|
|
1021
|
+
}), /* @__PURE__ */ g(De, { children: oe.map((t) => /* @__PURE__ */ g(y, {
|
|
931
1022
|
value: t.label,
|
|
932
1023
|
children: e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)
|
|
933
1024
|
}, t.key)) })]
|
|
934
|
-
})] }), /* @__PURE__ */
|
|
1025
|
+
})] }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
935
1026
|
className: "text-sm font-medium text-text-primary",
|
|
936
1027
|
children: e("healthybowl.fieldMapPage.create.irrigation", "Irrigation")
|
|
937
|
-
}), /* @__PURE__ */
|
|
938
|
-
value:
|
|
939
|
-
onValueChange:
|
|
940
|
-
children: [/* @__PURE__ */
|
|
1028
|
+
}), /* @__PURE__ */ _(Ee, {
|
|
1029
|
+
value: Ct,
|
|
1030
|
+
onValueChange: wt,
|
|
1031
|
+
children: [/* @__PURE__ */ g(Oe, {
|
|
941
1032
|
className: "mt-1 w-full",
|
|
942
|
-
children: /* @__PURE__ */
|
|
943
|
-
}), /* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
1033
|
+
children: /* @__PURE__ */ g(ke, {})
|
|
1034
|
+
}), /* @__PURE__ */ _(De, { children: [
|
|
1035
|
+
/* @__PURE__ */ g(y, {
|
|
945
1036
|
value: "Drip",
|
|
946
1037
|
children: e("healthybowl.fieldMapPage.irrigation.drip", "Drip")
|
|
947
1038
|
}),
|
|
948
|
-
/* @__PURE__ */
|
|
1039
|
+
/* @__PURE__ */ g(y, {
|
|
949
1040
|
value: "Sprinkler",
|
|
950
1041
|
children: e("healthybowl.fieldMapPage.irrigation.sprinkler", "Sprinkler")
|
|
951
1042
|
}),
|
|
952
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ g(y, {
|
|
953
1044
|
value: "Flood",
|
|
954
1045
|
children: e("healthybowl.fieldMapPage.irrigation.flood", "Flood")
|
|
955
1046
|
}),
|
|
956
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ g(y, {
|
|
957
1048
|
value: "Rainfed",
|
|
958
1049
|
children: e("healthybowl.fieldMapPage.irrigation.rainfed", "Rainfed")
|
|
959
1050
|
}),
|
|
960
|
-
/* @__PURE__ */
|
|
1051
|
+
/* @__PURE__ */ g(y, {
|
|
961
1052
|
value: "None",
|
|
962
1053
|
children: e("healthybowl.fieldMapPage.irrigation.none", "None")
|
|
963
1054
|
})
|
|
964
1055
|
] })]
|
|
965
1056
|
})] })]
|
|
966
1057
|
}),
|
|
967
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
968
1059
|
className: "text-sm font-medium text-text-primary",
|
|
969
1060
|
children: e("healthybowl.fieldMapPage.create.status", "Status")
|
|
970
|
-
}), /* @__PURE__ */
|
|
971
|
-
value:
|
|
972
|
-
onValueChange:
|
|
973
|
-
children: [/* @__PURE__ */
|
|
1061
|
+
}), /* @__PURE__ */ _(Ee, {
|
|
1062
|
+
value: Tt,
|
|
1063
|
+
onValueChange: Et,
|
|
1064
|
+
children: [/* @__PURE__ */ g(Oe, {
|
|
974
1065
|
className: "mt-1 w-full",
|
|
975
|
-
children: /* @__PURE__ */
|
|
976
|
-
}), /* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
1066
|
+
children: /* @__PURE__ */ g(ke, {})
|
|
1067
|
+
}), /* @__PURE__ */ _(De, { children: [
|
|
1068
|
+
/* @__PURE__ */ g(y, {
|
|
978
1069
|
value: "active",
|
|
979
1070
|
children: e("healthybowl.fieldMapPage.status.active", "Active")
|
|
980
1071
|
}),
|
|
981
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ g(y, {
|
|
982
1073
|
value: "preparation",
|
|
983
1074
|
children: e("healthybowl.fieldMapPage.status.preparation", "Preparation")
|
|
984
1075
|
}),
|
|
985
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ g(y, {
|
|
986
1077
|
value: "fallow",
|
|
987
1078
|
children: e("healthybowl.fieldMapPage.status.fallow", "Fallow")
|
|
988
1079
|
})
|
|
@@ -991,14 +1082,14 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
991
1082
|
]
|
|
992
1083
|
})
|
|
993
1084
|
}),
|
|
994
|
-
/* @__PURE__ */
|
|
995
|
-
toasts:
|
|
996
|
-
onDismiss:
|
|
1085
|
+
/* @__PURE__ */ g(a, {
|
|
1086
|
+
toasts: Xe,
|
|
1087
|
+
onDismiss: Ze
|
|
997
1088
|
})
|
|
998
1089
|
]
|
|
999
1090
|
});
|
|
1000
1091
|
};
|
|
1001
1092
|
//#endregion
|
|
1002
|
-
export {
|
|
1093
|
+
export { S as FieldMapPage };
|
|
1003
1094
|
|
|
1004
1095
|
//# sourceMappingURL=FieldMapPage.js.map
|