@burdenoff/microfe-healthybowl 2026.710.4 → 2026.710.5
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.
|
@@ -16,19 +16,19 @@ function w() {
|
|
|
16
16
|
e.id = "leaflet-css", e.rel = "stylesheet", e.href = v, e.integrity = y, e.crossOrigin = "anonymous", document.head.appendChild(e);
|
|
17
17
|
}
|
|
18
18
|
var T = ({ location: e, center: n }) => {
|
|
19
|
-
let { t: v } = l(), { toasts: y, toast: T, dismiss:
|
|
20
|
-
let e =
|
|
21
|
-
|
|
22
|
-
}, []),
|
|
23
|
-
let e =
|
|
24
|
-
|
|
25
|
-
}, []),
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
let e =
|
|
19
|
+
let { t: v } = l(), { toasts: y, toast: T, dismiss: ee } = i(), E = s(null), D = s(null), O = s(null), k = s(null), A = s(null), j = s(null), [M, N] = c("loading"), [P, F] = c(!1), [I, L] = c(!1), [R, z] = c(""), [B, V] = c(!1), [H, U] = c(null), [W, G] = c(null), K = v("healthybowl.weather.map.layers.streets", "Streets"), q = v("healthybowl.weather.map.layers.terrain", "Terrain"), J = v("healthybowl.weather.map.layers.radar", "Live radar"), Y = C(n) ? n : null, X = Y ? Y.lat : null, Z = Y ? Y.lng : null, Q = a(() => {
|
|
20
|
+
let e = D.current;
|
|
21
|
+
k.current && e && e.removeLayer(k.current), A.current && e && e.removeLayer(A.current), k.current = null, A.current = null;
|
|
22
|
+
}, []), $ = a(() => {
|
|
23
|
+
let e = D.current;
|
|
24
|
+
j.current && e && e.removeLayer(j.current), j.current = null;
|
|
25
|
+
}, []), te = a(() => {
|
|
26
|
+
$(), U(null);
|
|
27
|
+
}, [$]), ne = a(() => {
|
|
28
|
+
let e = D.current, t = O.current;
|
|
29
29
|
!e || !t || e.flyTo(t, b, { duration: .6 });
|
|
30
|
-
}, []),
|
|
31
|
-
let e =
|
|
30
|
+
}, []), re = a(() => {
|
|
31
|
+
let e = D.current;
|
|
32
32
|
if (e) {
|
|
33
33
|
if (typeof navigator > "u" || !navigator.geolocation) {
|
|
34
34
|
T({
|
|
@@ -38,29 +38,29 @@ var T = ({ location: e, center: n }) => {
|
|
|
38
38
|
});
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
L(!0), navigator.geolocation.getCurrentPosition((t) => {
|
|
42
42
|
let n = [t.coords.latitude, t.coords.longitude];
|
|
43
|
-
|
|
43
|
+
Q(), A.current = _.default.circle(n, {
|
|
44
44
|
radius: Math.max(10, t.coords.accuracy || 0),
|
|
45
45
|
color: "#2563eb",
|
|
46
46
|
fillColor: "#3b82f6",
|
|
47
47
|
fillOpacity: .12,
|
|
48
48
|
opacity: .45,
|
|
49
49
|
weight: 1
|
|
50
|
-
}).addTo(e),
|
|
50
|
+
}).addTo(e), k.current = _.default.circleMarker(n, {
|
|
51
51
|
radius: 7,
|
|
52
52
|
color: "#ffffff",
|
|
53
53
|
weight: 2,
|
|
54
54
|
fillColor: "#2563eb",
|
|
55
55
|
fillOpacity: 1
|
|
56
|
-
}).addTo(e), e.flyTo(n, Math.max(e.getZoom(), x), { duration: .75 }),
|
|
56
|
+
}).addTo(e), e.flyTo(n, Math.max(e.getZoom(), x), { duration: .75 }), L(!1);
|
|
57
57
|
}, (e) => {
|
|
58
58
|
let t = e.code === e.PERMISSION_DENIED;
|
|
59
59
|
T({
|
|
60
60
|
title: t ? v("healthybowl.weather.map.toast.locationBlocked.title", "Location blocked") : v("healthybowl.weather.map.toast.locationFailed.title", "Could not get location"),
|
|
61
61
|
description: t ? v("healthybowl.weather.map.toast.locationBlocked.description", "Allow location access in the browser, then try again.") : v("healthybowl.weather.map.toast.locationFailed.description", "Make sure GPS is enabled and the page is open over HTTPS."),
|
|
62
62
|
variant: "warning"
|
|
63
|
-
}),
|
|
63
|
+
}), L(!1);
|
|
64
64
|
}, {
|
|
65
65
|
enableHighAccuracy: !0,
|
|
66
66
|
timeout: 12e3,
|
|
@@ -68,12 +68,12 @@ var T = ({ location: e, center: n }) => {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
}, [
|
|
71
|
-
|
|
71
|
+
Q,
|
|
72
72
|
v,
|
|
73
73
|
T
|
|
74
|
-
]),
|
|
74
|
+
]), ie = a(async (e) => {
|
|
75
75
|
e.preventDefault();
|
|
76
|
-
let t =
|
|
76
|
+
let t = D.current, n = R.trim();
|
|
77
77
|
if (!n) {
|
|
78
78
|
T({
|
|
79
79
|
title: v("healthybowl.weather.map.toast.searchRequired.title", "Place required"),
|
|
@@ -83,7 +83,7 @@ var T = ({ location: e, center: n }) => {
|
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
if (t) {
|
|
86
|
-
|
|
86
|
+
V(!0);
|
|
87
87
|
try {
|
|
88
88
|
let e = await r(n);
|
|
89
89
|
if (!e) {
|
|
@@ -99,15 +99,15 @@ var T = ({ location: e, center: n }) => {
|
|
|
99
99
|
e.admin1,
|
|
100
100
|
e.country
|
|
101
101
|
].filter(Boolean).join(", ") || n, a = [e.latitude, e.longitude];
|
|
102
|
-
|
|
102
|
+
$();
|
|
103
103
|
let o = document.createElement("span");
|
|
104
|
-
o.textContent = i,
|
|
104
|
+
o.textContent = i, j.current = _.default.circleMarker(a, {
|
|
105
105
|
radius: 8,
|
|
106
106
|
color: "#ffffff",
|
|
107
107
|
weight: 2,
|
|
108
108
|
fillColor: "#0ea5e9",
|
|
109
109
|
fillOpacity: 1
|
|
110
|
-
}).addTo(t).bindPopup(o).openPopup(), t.flyTo(a, Math.max(t.getZoom(), S), { duration: .75 }),
|
|
110
|
+
}).addTo(t).bindPopup(o).openPopup(), t.flyTo(a, Math.max(t.getZoom(), S), { duration: .75 }), U(i);
|
|
111
111
|
} catch (e) {
|
|
112
112
|
T({
|
|
113
113
|
title: v("healthybowl.weather.map.toast.searchFailed.title", "Search failed"),
|
|
@@ -115,75 +115,79 @@ var T = ({ location: e, center: n }) => {
|
|
|
115
115
|
variant: "error"
|
|
116
116
|
});
|
|
117
117
|
} finally {
|
|
118
|
-
|
|
118
|
+
V(!1);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}, [
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
$,
|
|
123
|
+
R,
|
|
124
124
|
v,
|
|
125
125
|
T
|
|
126
126
|
]);
|
|
127
127
|
return o(() => {
|
|
128
|
-
let t =
|
|
128
|
+
let t = E.current;
|
|
129
129
|
if (!t) return;
|
|
130
130
|
w();
|
|
131
|
-
let
|
|
132
|
-
return
|
|
133
|
-
let
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
let n = new AbortController(), i, a = !1;
|
|
132
|
+
return N("loading"), F(!1), G(null), U(null), O.current = null, (async () => {
|
|
133
|
+
let o = X !== null && Z !== null ? {
|
|
134
|
+
lat: X,
|
|
135
|
+
lng: Z
|
|
136
|
+
} : null, s = o ? null : await r(e, n.signal), c = o ? [o.lat, o.lng] : s ? [s.latitude, s.longitude] : null;
|
|
137
|
+
if (a || !E.current) return;
|
|
138
|
+
let l = c ?? [20, 0], u = c ? b : 2;
|
|
139
|
+
O.current = c ? _.default.latLng(c[0], c[1]) : null, F(!!c), i = _.default.map(t, {
|
|
140
|
+
center: l,
|
|
141
|
+
zoom: u,
|
|
139
142
|
scrollWheelZoom: !0
|
|
140
|
-
}),
|
|
141
|
-
let
|
|
143
|
+
}), D.current = i;
|
|
144
|
+
let d = _.default.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
142
145
|
attribution: "© OpenStreetMap contributors",
|
|
143
146
|
maxZoom: 18
|
|
144
|
-
}),
|
|
147
|
+
}), f = _.default.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
|
|
145
148
|
attribution: "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors",
|
|
146
149
|
maxZoom: 17
|
|
147
150
|
});
|
|
148
|
-
|
|
149
|
-
let
|
|
150
|
-
[
|
|
151
|
-
[
|
|
152
|
-
}, void 0, { collapsed: !1 }).addTo(
|
|
153
|
-
if (_.default.control.scale({ imperial: !1 }).addTo(
|
|
151
|
+
d.addTo(i);
|
|
152
|
+
let p = _.default.control.layers({
|
|
153
|
+
[K]: d,
|
|
154
|
+
[q]: f
|
|
155
|
+
}, void 0, { collapsed: !1 }).addTo(i);
|
|
156
|
+
if (_.default.control.scale({ imperial: !1 }).addTo(i), c) {
|
|
154
157
|
let t = _.default.divIcon({
|
|
155
158
|
className: "hb-weather-marker",
|
|
156
159
|
html: "<div style=\"width:16px;height:16px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);background:var(--color-action-primary-bg, #16a34a);border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.4)\"></div>",
|
|
157
160
|
iconSize: [16, 16],
|
|
158
161
|
iconAnchor: [8, 16]
|
|
159
162
|
}), n = document.createElement("span");
|
|
160
|
-
n.textContent = e || "Your farm", _.default.marker(
|
|
163
|
+
n.textContent = e || "Your farm", _.default.marker(l, { icon: t }).addTo(i).bindPopup(n);
|
|
161
164
|
}
|
|
162
165
|
try {
|
|
163
|
-
let e = await (await fetch("https://api.rainviewer.com/public/weather-maps.json", { signal:
|
|
164
|
-
if (!
|
|
165
|
-
let t = _.default.tileLayer(`${e.host}${
|
|
166
|
+
let e = await (await fetch("https://api.rainviewer.com/public/weather-maps.json", { signal: n.signal })).json(), t = e.radar?.past ?? [], r = t[t.length - 1];
|
|
167
|
+
if (!a && i && e.host && r?.path) {
|
|
168
|
+
let t = _.default.tileLayer(`${e.host}${r.path}/256/{z}/{x}/{y}/4/1_1.png`, {
|
|
166
169
|
opacity: .55,
|
|
167
170
|
maxZoom: 18,
|
|
168
171
|
maxNativeZoom: 7
|
|
169
|
-
}).addTo(
|
|
170
|
-
|
|
172
|
+
}).addTo(i);
|
|
173
|
+
p.addOverlay(t, J), typeof r.time == "number" && G(/* @__PURE__ */ new Date(r.time * 1e3));
|
|
171
174
|
}
|
|
172
175
|
} catch {}
|
|
173
|
-
|
|
176
|
+
a || (N("ready"), window.setTimeout(() => i?.invalidateSize(), 80));
|
|
174
177
|
})().catch(() => {
|
|
175
|
-
|
|
178
|
+
a || N("error");
|
|
176
179
|
}), () => {
|
|
177
|
-
|
|
180
|
+
a = !0, n.abort(), Q(), $(), i?.remove(), D.current = null, O.current = null;
|
|
178
181
|
};
|
|
179
182
|
}, [
|
|
180
|
-
n,
|
|
181
183
|
X,
|
|
182
|
-
e,
|
|
183
|
-
Y,
|
|
184
184
|
Z,
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
Q,
|
|
186
|
+
e,
|
|
187
|
+
J,
|
|
188
|
+
$,
|
|
189
|
+
K,
|
|
190
|
+
q
|
|
187
191
|
]), /* @__PURE__ */ h("div", {
|
|
188
192
|
className: "relative",
|
|
189
193
|
children: [
|
|
@@ -191,16 +195,16 @@ var T = ({ location: e, center: n }) => {
|
|
|
191
195
|
className: "mb-3 flex flex-wrap items-center gap-2",
|
|
192
196
|
children: [
|
|
193
197
|
/* @__PURE__ */ h("form", {
|
|
194
|
-
onSubmit:
|
|
198
|
+
onSubmit: ie,
|
|
195
199
|
className: "flex min-w-[min(100%,22rem)] flex-1 flex-wrap items-center gap-2",
|
|
196
200
|
children: [
|
|
197
201
|
/* @__PURE__ */ h("div", {
|
|
198
202
|
className: "relative min-w-[12rem] flex-1",
|
|
199
203
|
children: [/* @__PURE__ */ m(f, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ m("input", {
|
|
200
204
|
type: "search",
|
|
201
|
-
value:
|
|
202
|
-
onChange: (e) =>
|
|
203
|
-
disabled:
|
|
205
|
+
value: R,
|
|
206
|
+
onChange: (e) => z(e.target.value),
|
|
207
|
+
disabled: M !== "ready" || B,
|
|
204
208
|
placeholder: v("healthybowl.weather.map.search.placeholder", "Search city or place..."),
|
|
205
209
|
"aria-label": v("healthybowl.weather.map.search.label", "Search map by place"),
|
|
206
210
|
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)] disabled:cursor-not-allowed disabled:opacity-60"
|
|
@@ -210,18 +214,18 @@ var T = ({ location: e, center: n }) => {
|
|
|
210
214
|
type: "submit",
|
|
211
215
|
variant: "outline",
|
|
212
216
|
size: "sm",
|
|
213
|
-
disabled:
|
|
217
|
+
disabled: M !== "ready" || B,
|
|
214
218
|
children: [
|
|
215
219
|
/* @__PURE__ */ m(f, { className: "h-4 w-4" }),
|
|
216
220
|
" ",
|
|
217
|
-
|
|
221
|
+
B ? v("healthybowl.weather.map.search.searching", "Searching...") : v("healthybowl.weather.map.search.action", "Search")
|
|
218
222
|
]
|
|
219
223
|
}),
|
|
220
|
-
|
|
224
|
+
H && /* @__PURE__ */ m(g, {
|
|
221
225
|
type: "button",
|
|
222
226
|
variant: "ghost",
|
|
223
227
|
size: "sm",
|
|
224
|
-
onClick:
|
|
228
|
+
onClick: te,
|
|
225
229
|
"aria-label": v("healthybowl.weather.map.search.clear", "Clear searched place"),
|
|
226
230
|
title: v("healthybowl.weather.map.search.clear", "Clear searched place"),
|
|
227
231
|
children: /* @__PURE__ */ m(p, { className: "h-4 w-4" })
|
|
@@ -231,8 +235,8 @@ var T = ({ location: e, center: n }) => {
|
|
|
231
235
|
/* @__PURE__ */ h(g, {
|
|
232
236
|
variant: "outline",
|
|
233
237
|
size: "sm",
|
|
234
|
-
onClick:
|
|
235
|
-
disabled: !
|
|
238
|
+
onClick: ne,
|
|
239
|
+
disabled: !P || M === "loading",
|
|
236
240
|
title: v("healthybowl.weather.map.actions.focusFarm.title", "Focus the weather map on the farm"),
|
|
237
241
|
"aria-label": v("healthybowl.weather.map.actions.focusFarm.title", "Focus the weather map on the farm"),
|
|
238
242
|
children: [
|
|
@@ -244,31 +248,31 @@ var T = ({ location: e, center: n }) => {
|
|
|
244
248
|
/* @__PURE__ */ h(g, {
|
|
245
249
|
variant: "outline",
|
|
246
250
|
size: "sm",
|
|
247
|
-
onClick:
|
|
248
|
-
disabled:
|
|
251
|
+
onClick: re,
|
|
252
|
+
disabled: I || M !== "ready",
|
|
249
253
|
title: v("healthybowl.weather.map.actions.locateMe.title", "Go to my current location"),
|
|
250
254
|
"aria-label": v("healthybowl.weather.map.actions.locateMe.title", "Go to my current location"),
|
|
251
255
|
children: [
|
|
252
256
|
/* @__PURE__ */ m(u, { className: "h-4 w-4" }),
|
|
253
257
|
" ",
|
|
254
|
-
|
|
258
|
+
I ? v("healthybowl.weather.map.actions.locating", "Locating...") : v("healthybowl.weather.map.actions.locateMe", "My location")
|
|
255
259
|
]
|
|
256
260
|
})
|
|
257
261
|
]
|
|
258
262
|
}),
|
|
259
263
|
/* @__PURE__ */ m("div", {
|
|
260
|
-
ref:
|
|
264
|
+
ref: E,
|
|
261
265
|
className: "h-[60vh] max-h-[460px] w-full overflow-hidden rounded-md border border-border-subtle bg-bg-sunken"
|
|
262
266
|
}),
|
|
263
|
-
|
|
267
|
+
M === "loading" && /* @__PURE__ */ m("div", {
|
|
264
268
|
className: "pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/60 text-sm text-text-secondary",
|
|
265
269
|
children: "Loading map…"
|
|
266
270
|
}),
|
|
267
|
-
|
|
271
|
+
M === "error" && /* @__PURE__ */ m("div", {
|
|
268
272
|
className: "pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/80 px-4 text-center text-sm text-text-secondary",
|
|
269
273
|
children: "Weather map needs an internet connection and couldn’t load."
|
|
270
274
|
}),
|
|
271
|
-
|
|
275
|
+
M === "ready" && !P && /* @__PURE__ */ m("div", {
|
|
272
276
|
className: "pointer-events-none absolute left-1/2 top-16 z-[400] -translate-x-1/2 rounded-full bg-bg-surface/90 px-3 py-1.5 text-xs text-text-secondary shadow-sm",
|
|
273
277
|
children: v("healthybowl.weather.map.noLocation", "No farm coordinates available")
|
|
274
278
|
}),
|
|
@@ -277,8 +281,8 @@ var T = ({ location: e, center: n }) => {
|
|
|
277
281
|
children: [
|
|
278
282
|
"Live precipitation radar via RainViewer · base map © OpenStreetMap",
|
|
279
283
|
e ? ` · centered on ${e}` : "",
|
|
280
|
-
|
|
281
|
-
|
|
284
|
+
H ? ` · viewing ${H}` : "",
|
|
285
|
+
W ? ` · radar ${W.toLocaleTimeString([], {
|
|
282
286
|
hour: "2-digit",
|
|
283
287
|
minute: "2-digit"
|
|
284
288
|
})}` : ""
|
|
@@ -286,7 +290,7 @@ var T = ({ location: e, center: n }) => {
|
|
|
286
290
|
}),
|
|
287
291
|
/* @__PURE__ */ m(t, {
|
|
288
292
|
toasts: y,
|
|
289
|
-
onDismiss:
|
|
293
|
+
onDismiss: ee
|
|
290
294
|
})
|
|
291
295
|
]
|
|
292
296
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeatherMap.js","names":[],"sources":["../../../src/healthybowl/components/WeatherMap.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState, type FC, type FormEvent } from 'react';\nimport L from 'leaflet';\nimport { LocateFixed, MapPinned, Search, X } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { geocodePlace } from '../utils/geocode';\nimport { useToast } from '../hooks/useToast';\nimport { ToastContainer } from './Toast';\n\ninterface WeatherMapProps {\n /** Resolved place name (from the weather data) used to center the map. */\n location: string;\n /** Backend-resolved farm/weather coordinates. Preferred over client-side geocoding. */\n center?: { lat: number; lng: number } | null;\n}\n\nconst LEAFLET_CSS = 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css';\n// SRI for leaflet@1.9.4/dist/leaflet.css (immutable versioned URL) — guards against a CDN compromise.\nconst LEAFLET_CSS_SRI = 'sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=';\nconst FARM_WEATHER_ZOOM = 7;\nconst USER_LOCATION_ZOOM = 10;\nconst SEARCH_LOCATION_ZOOM = 10;\n\nconst isUsableCoordinate = (value?: { lat: number; lng: number } | null): value is { lat: number; lng: number } =>\n Boolean(\n value &&\n Number.isFinite(value.lat) &&\n Number.isFinite(value.lng) &&\n value.lat >= -90 &&\n value.lat <= 90 &&\n value.lng >= -180 &&\n value.lng <= 180 &&\n (value.lat !== 0 || value.lng !== 0)\n );\n\n/**\n * Inject Leaflet's stylesheet at runtime. The MFE library build doesn't deliver\n * a component's bundled CSS to the host shell (the host styles come from its own\n * Tailwind), so we load Leaflet's CSS from a CDN instead — consistent with the\n * map being an inherently online feature (tiles + radar).\n */\nfunction ensureLeafletCss(): void {\n if (document.getElementById('leaflet-css')) return;\n const link = document.createElement('link');\n link.id = 'leaflet-css';\n link.rel = 'stylesheet';\n link.href = LEAFLET_CSS;\n link.integrity = LEAFLET_CSS_SRI;\n link.crossOrigin = 'anonymous';\n document.head.appendChild(link);\n}\n\n/**\n * Interactive weather map: OpenStreetMap base + live precipitation radar overlay\n * (RainViewer, keyless), centered on backend-resolved farm coordinates when\n * available, then client-geocoded from the weather location as a fallback.\n */\nexport const WeatherMap: FC<WeatherMapProps> = ({ location, center }) => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const containerRef = useRef<HTMLDivElement>(null);\n const mapRef = useRef<L.Map | null>(null);\n const farmCenterRef = useRef<L.LatLng | null>(null);\n const userLocationMarkerRef = useRef<L.CircleMarker | null>(null);\n const userAccuracyCircleRef = useRef<L.Circle | null>(null);\n const searchedPlaceMarkerRef = useRef<L.CircleMarker | null>(null);\n const [status, setStatus] = useState<'loading' | 'ready' | 'error'>('loading');\n const [hasFarmCenter, setHasFarmCenter] = useState(false);\n const [locating, setLocating] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [searching, setSearching] = useState(false);\n const [searchedPlace, setSearchedPlace] = useState<string | null>(null);\n const [radarUpdatedAt, setRadarUpdatedAt] = useState<Date | null>(null);\n const streetsLayerLabel = t('healthybowl.weather.map.layers.streets', 'Streets');\n const terrainLayerLabel = t('healthybowl.weather.map.layers.terrain', 'Terrain');\n const radarLayerLabel = t('healthybowl.weather.map.layers.radar', 'Live radar');\n\n const clearUserLocation = useCallback(() => {\n const map = mapRef.current;\n if (userLocationMarkerRef.current && map) map.removeLayer(userLocationMarkerRef.current);\n if (userAccuracyCircleRef.current && map) map.removeLayer(userAccuracyCircleRef.current);\n userLocationMarkerRef.current = null;\n userAccuracyCircleRef.current = null;\n }, []);\n\n const removeSearchedPlaceMarker = useCallback(() => {\n const map = mapRef.current;\n if (searchedPlaceMarkerRef.current && map) map.removeLayer(searchedPlaceMarkerRef.current);\n searchedPlaceMarkerRef.current = null;\n }, []);\n\n const clearSearchedPlace = useCallback(() => {\n removeSearchedPlaceMarker();\n setSearchedPlace(null);\n }, [removeSearchedPlaceMarker]);\n\n const focusFarm = useCallback(() => {\n const map = mapRef.current;\n const farmCenter = farmCenterRef.current;\n if (!map || !farmCenter) return;\n map.flyTo(farmCenter, FARM_WEATHER_ZOOM, { duration: 0.6 });\n }, []);\n\n const handleLocateMe = useCallback(() => {\n const map = mapRef.current;\n if (!map) return;\n if (typeof navigator === 'undefined' || !navigator.geolocation) {\n toast({\n title: t('healthybowl.weather.map.toast.locationUnsupported.title', 'Location unavailable'),\n description: t(\n 'healthybowl.weather.map.toast.locationUnsupported.description',\n 'This browser does not support device location.'\n ),\n variant: 'warning',\n });\n return;\n }\n\n setLocating(true);\n navigator.geolocation.getCurrentPosition(\n (position) => {\n const latlng: L.LatLngExpression = [position.coords.latitude, position.coords.longitude];\n clearUserLocation();\n userAccuracyCircleRef.current = L.circle(latlng, {\n radius: Math.max(10, position.coords.accuracy || 0),\n color: '#2563eb',\n fillColor: '#3b82f6',\n fillOpacity: 0.12,\n opacity: 0.45,\n weight: 1,\n }).addTo(map);\n userLocationMarkerRef.current = L.circleMarker(latlng, {\n radius: 7,\n color: '#ffffff',\n weight: 2,\n fillColor: '#2563eb',\n fillOpacity: 1,\n }).addTo(map);\n map.flyTo(latlng, Math.max(map.getZoom(), USER_LOCATION_ZOOM), { duration: 0.75 });\n setLocating(false);\n },\n (error) => {\n const blocked = error.code === error.PERMISSION_DENIED;\n toast({\n title: blocked\n ? t('healthybowl.weather.map.toast.locationBlocked.title', 'Location blocked')\n : t('healthybowl.weather.map.toast.locationFailed.title', 'Could not get location'),\n description: blocked\n ? t(\n 'healthybowl.weather.map.toast.locationBlocked.description',\n 'Allow location access in the browser, then try again.'\n )\n : t(\n 'healthybowl.weather.map.toast.locationFailed.description',\n 'Make sure GPS is enabled and the page is open over HTTPS.'\n ),\n variant: 'warning',\n });\n setLocating(false);\n },\n { enableHighAccuracy: true, timeout: 12000, maximumAge: 60000 }\n );\n }, [clearUserLocation, t, toast]);\n\n const handleSearchPlace = useCallback(\n async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const map = mapRef.current;\n const place = searchQuery.trim();\n if (!place) {\n toast({\n title: t('healthybowl.weather.map.toast.searchRequired.title', 'Place required'),\n description: t(\n 'healthybowl.weather.map.toast.searchRequired.description',\n 'Enter a city, village, district, or region to view it on the map.'\n ),\n variant: 'warning',\n });\n return;\n }\n if (!map) return;\n\n setSearching(true);\n try {\n const hit = await geocodePlace(place);\n if (!hit) {\n toast({\n title: t('healthybowl.weather.map.toast.searchNotFound.title', 'Place not found'),\n description: t(\n 'healthybowl.weather.map.toast.searchNotFound.description',\n 'Try a more specific location name, such as city and state.'\n ),\n variant: 'warning',\n });\n return;\n }\n\n const label = [hit.name, hit.admin1, hit.country].filter(Boolean).join(', ') || place;\n const latlng: L.LatLngExpression = [hit.latitude, hit.longitude];\n removeSearchedPlaceMarker();\n const popupEl = document.createElement('span');\n popupEl.textContent = label;\n searchedPlaceMarkerRef.current = L.circleMarker(latlng, {\n radius: 8,\n color: '#ffffff',\n weight: 2,\n fillColor: '#0ea5e9',\n fillOpacity: 1,\n })\n .addTo(map)\n .bindPopup(popupEl)\n .openPopup();\n map.flyTo(latlng, Math.max(map.getZoom(), SEARCH_LOCATION_ZOOM), { duration: 0.75 });\n setSearchedPlace(label);\n } catch (err) {\n toast({\n title: t('healthybowl.weather.map.toast.searchFailed.title', 'Search failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setSearching(false);\n }\n },\n [removeSearchedPlaceMarker, searchQuery, t, toast]\n );\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return undefined;\n ensureLeafletCss();\n const controller = new AbortController();\n let map: L.Map | undefined;\n let cancelled = false;\n setStatus('loading');\n setHasFarmCenter(false);\n setRadarUpdatedAt(null);\n setSearchedPlace(null);\n farmCenterRef.current = null;\n\n void (async () => {\n const backendCenter = isUsableCoordinate(center) ? center : null;\n const hit = backendCenter ? null : await geocodePlace(location, controller.signal);\n const located: [number, number] | null = backendCenter\n ? [backendCenter.lat, backendCenter.lng]\n : hit\n ? [hit.latitude, hit.longitude]\n : null;\n if (cancelled || !containerRef.current) return;\n const mapCenter: L.LatLngExpression = located ?? [20, 0];\n // z7 keeps the RainViewer radar at its native resolution (it has no tiles past z7)\n // while still framing the farm and its surrounding weather system.\n const zoom = located ? FARM_WEATHER_ZOOM : 2;\n farmCenterRef.current = located ? L.latLng(located[0], located[1]) : null;\n setHasFarmCenter(Boolean(located));\n\n map = L.map(el, { center: mapCenter, zoom, scrollWheelZoom: true });\n mapRef.current = map;\n const streetsLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors',\n maxZoom: 18,\n });\n const terrainLayer = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors',\n maxZoom: 17,\n });\n streetsLayer.addTo(map);\n const layerControl = L.control\n .layers(\n {\n [streetsLayerLabel]: streetsLayer,\n [terrainLayerLabel]: terrainLayer,\n },\n undefined,\n { collapsed: false }\n )\n .addTo(map);\n L.control.scale({ imperial: false }).addTo(map);\n\n if (located) {\n const icon = L.divIcon({\n className: 'hb-weather-marker',\n html:\n '<div style=\"width:16px;height:16px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);' +\n 'background:var(--color-action-primary-bg, #16a34a);border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.4)\"></div>',\n iconSize: [16, 16],\n iconAnchor: [8, 16],\n });\n // bindPopup treats a string as HTML; pass a text node so the place name\n // can never be interpreted as markup (defense-in-depth against a tainted value).\n const popupEl = document.createElement('span');\n popupEl.textContent = location || 'Your farm';\n L.marker(mapCenter, { icon }).addTo(map).bindPopup(popupEl);\n }\n\n // Live precipitation radar overlay (RainViewer — free, keyless).\n try {\n const res = await fetch('https://api.rainviewer.com/public/weather-maps.json', { signal: controller.signal });\n const data = (await res.json()) as {\n host?: string;\n radar?: { past?: Array<{ path?: string; time?: number }> };\n };\n const frames = data.radar?.past ?? [];\n const latest = frames[frames.length - 1];\n // The map may have been removed during the await — guard before touching it.\n if (!cancelled && map && data.host && latest?.path) {\n // RainViewer radar only has tiles up to z7; cap maxNativeZoom so Leaflet\n // upscales from z7 instead of requesting the \"Zoom Level Not Supported\" placeholder.\n const radarLayer = L.tileLayer(`${data.host}${latest.path}/256/{z}/{x}/{y}/4/1_1.png`, {\n opacity: 0.55,\n maxZoom: 18,\n maxNativeZoom: 7,\n }).addTo(map);\n layerControl.addOverlay(radarLayer, radarLayerLabel);\n if (typeof latest.time === 'number') setRadarUpdatedAt(new Date(latest.time * 1000));\n }\n } catch {\n /* radar overlay is best-effort */\n }\n\n if (!cancelled) {\n setStatus('ready');\n window.setTimeout(() => map?.invalidateSize(), 80);\n }\n })().catch(() => {\n if (!cancelled) setStatus('error');\n });\n\n return () => {\n cancelled = true;\n controller.abort();\n clearUserLocation();\n removeSearchedPlaceMarker();\n map?.remove();\n mapRef.current = null;\n farmCenterRef.current = null;\n };\n }, [\n center,\n clearUserLocation,\n location,\n radarLayerLabel,\n removeSearchedPlaceMarker,\n streetsLayerLabel,\n terrainLayerLabel,\n ]);\n\n return (\n <div className=\"relative\">\n <div className=\"mb-3 flex flex-wrap items-center gap-2\">\n <form onSubmit={handleSearchPlace} className=\"flex min-w-[min(100%,22rem)] flex-1 flex-wrap items-center gap-2\">\n <div className=\"relative min-w-[12rem] flex-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary\" />\n <input\n type=\"search\"\n value={searchQuery}\n onChange={(event) => setSearchQuery(event.target.value)}\n disabled={status !== 'ready' || searching}\n placeholder={t('healthybowl.weather.map.search.placeholder', 'Search city or place...')}\n aria-label={t('healthybowl.weather.map.search.label', 'Search map by place')}\n 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)] disabled:cursor-not-allowed disabled:opacity-60\"\n />\n </div>\n <Button type=\"submit\" variant=\"outline\" size=\"sm\" disabled={status !== 'ready' || searching}>\n <Search className=\"h-4 w-4\" />{' '}\n {searching\n ? t('healthybowl.weather.map.search.searching', 'Searching...')\n : t('healthybowl.weather.map.search.action', 'Search')}\n </Button>\n {searchedPlace && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={clearSearchedPlace}\n aria-label={t('healthybowl.weather.map.search.clear', 'Clear searched place')}\n title={t('healthybowl.weather.map.search.clear', 'Clear searched place')}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n )}\n </form>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={focusFarm}\n disabled={!hasFarmCenter || status === 'loading'}\n title={t('healthybowl.weather.map.actions.focusFarm.title', 'Focus the weather map on the farm')}\n aria-label={t('healthybowl.weather.map.actions.focusFarm.title', 'Focus the weather map on the farm')}\n >\n <MapPinned className=\"h-4 w-4\" /> {t('healthybowl.weather.map.actions.focusFarm', 'Farm')}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleLocateMe}\n disabled={locating || status !== 'ready'}\n title={t('healthybowl.weather.map.actions.locateMe.title', 'Go to my current location')}\n aria-label={t('healthybowl.weather.map.actions.locateMe.title', 'Go to my current location')}\n >\n <LocateFixed className=\"h-4 w-4\" />{' '}\n {locating\n ? t('healthybowl.weather.map.actions.locating', 'Locating...')\n : t('healthybowl.weather.map.actions.locateMe', 'My location')}\n </Button>\n </div>\n <div\n ref={containerRef}\n className=\"h-[60vh] max-h-[460px] w-full overflow-hidden rounded-md border border-border-subtle bg-bg-sunken\"\n />\n {status === 'loading' && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/60 text-sm text-text-secondary\">\n Loading map…\n </div>\n )}\n {status === 'error' && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/80 px-4 text-center text-sm text-text-secondary\">\n Weather map needs an internet connection and couldn’t load.\n </div>\n )}\n {status === 'ready' && !hasFarmCenter && (\n <div className=\"pointer-events-none absolute left-1/2 top-16 z-[400] -translate-x-1/2 rounded-full bg-bg-surface/90 px-3 py-1.5 text-xs text-text-secondary shadow-sm\">\n {t('healthybowl.weather.map.noLocation', 'No farm coordinates available')}\n </div>\n )}\n <p className=\"mt-2 text-xs text-text-secondary\">\n Live precipitation radar via RainViewer · base map © OpenStreetMap\n {location ? ` · centered on ${location}` : ''}\n {searchedPlace ? ` · viewing ${searchedPlace}` : ''}\n {radarUpdatedAt\n ? ` · radar ${radarUpdatedAt.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`\n : ''}\n </p>\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;mCAgBM,IAAc,oDAEd,IAAkB,uDAClB,IAAoB,GACpB,IAAqB,IACrB,IAAuB,IAEvB,KAAsB,MAC1B,GACE,KACA,OAAO,SAAS,EAAM,IAAI,I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IACE,KAAK;IACL,WAAU;IACV,CAAA;GACD,MAAW,aACV,kBAAC,OAAD;IAAK,WAAU;cAAgI;IAEzI,CAAA;GAEP,MAAW,WACV,kBAAC,OAAD;IAAK,WAAU;cAAiJ;IAE1J,CAAA;GAEP,MAAW,WAAW,CAAC,KACtB,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAE,sCAAsC,gCAAgC;IACrE,CAAA;GAER,kBAAC,KAAD;IAAG,WAAU;cAAb;KAAgD;KAE7C,IAAW,kBAAkB,MAAa;KAC1C,IAAgB,cAAc,MAAkB;KAChD,IACG,YAAY,EAAe,mBAAmB,EAAE,EAAE;MAAE,MAAM;MAAW,QAAQ;MAAW,CAAC,KACzF;KACF;;GACJ,kBAAC,GAAD;IAAwB;IAAQ,WAAW;IAAW,CAAA;GAClD"}
|
|
1
|
+
{"version":3,"file":"WeatherMap.js","names":[],"sources":["../../../src/healthybowl/components/WeatherMap.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState, type FC, type FormEvent } from 'react';\nimport L from 'leaflet';\nimport { LocateFixed, MapPinned, Search, X } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { geocodePlace } from '../utils/geocode';\nimport { useToast } from '../hooks/useToast';\nimport { ToastContainer } from './Toast';\n\ninterface WeatherMapProps {\n /** Resolved place name (from the weather data) used to center the map. */\n location: string;\n /** Backend-resolved farm/weather coordinates. Preferred over client-side geocoding. */\n center?: { lat: number; lng: number } | null;\n}\n\nconst LEAFLET_CSS = 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css';\n// SRI for leaflet@1.9.4/dist/leaflet.css (immutable versioned URL) — guards against a CDN compromise.\nconst LEAFLET_CSS_SRI = 'sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=';\nconst FARM_WEATHER_ZOOM = 7;\nconst USER_LOCATION_ZOOM = 10;\nconst SEARCH_LOCATION_ZOOM = 10;\n\nconst isUsableCoordinate = (value?: { lat: number; lng: number } | null): value is { lat: number; lng: number } =>\n Boolean(\n value &&\n Number.isFinite(value.lat) &&\n Number.isFinite(value.lng) &&\n value.lat >= -90 &&\n value.lat <= 90 &&\n value.lng >= -180 &&\n value.lng <= 180 &&\n (value.lat !== 0 || value.lng !== 0)\n );\n\n/**\n * Inject Leaflet's stylesheet at runtime. The MFE library build doesn't deliver\n * a component's bundled CSS to the host shell (the host styles come from its own\n * Tailwind), so we load Leaflet's CSS from a CDN instead — consistent with the\n * map being an inherently online feature (tiles + radar).\n */\nfunction ensureLeafletCss(): void {\n if (document.getElementById('leaflet-css')) return;\n const link = document.createElement('link');\n link.id = 'leaflet-css';\n link.rel = 'stylesheet';\n link.href = LEAFLET_CSS;\n link.integrity = LEAFLET_CSS_SRI;\n link.crossOrigin = 'anonymous';\n document.head.appendChild(link);\n}\n\n/**\n * Interactive weather map: OpenStreetMap base + live precipitation radar overlay\n * (RainViewer, keyless), centered on backend-resolved farm coordinates when\n * available, then client-geocoded from the weather location as a fallback.\n */\nexport const WeatherMap: FC<WeatherMapProps> = ({ location, center }) => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const containerRef = useRef<HTMLDivElement>(null);\n const mapRef = useRef<L.Map | null>(null);\n const farmCenterRef = useRef<L.LatLng | null>(null);\n const userLocationMarkerRef = useRef<L.CircleMarker | null>(null);\n const userAccuracyCircleRef = useRef<L.Circle | null>(null);\n const searchedPlaceMarkerRef = useRef<L.CircleMarker | null>(null);\n const [status, setStatus] = useState<'loading' | 'ready' | 'error'>('loading');\n const [hasFarmCenter, setHasFarmCenter] = useState(false);\n const [locating, setLocating] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [searching, setSearching] = useState(false);\n const [searchedPlace, setSearchedPlace] = useState<string | null>(null);\n const [radarUpdatedAt, setRadarUpdatedAt] = useState<Date | null>(null);\n const streetsLayerLabel = t('healthybowl.weather.map.layers.streets', 'Streets');\n const terrainLayerLabel = t('healthybowl.weather.map.layers.terrain', 'Terrain');\n const radarLayerLabel = t('healthybowl.weather.map.layers.radar', 'Live radar');\n\n // Depend on the primitive coordinates, not the `center` object: the parent\n // re-renders on every weather/radar refresh and hands us a fresh {lat,lng}\n // object with identical values. Keying the map-creation effect on the object\n // reference re-created the whole Leaflet map on each refresh, snapping the view\n // back to the farm and wiping any place the user had searched for.\n const usableCenter = isUsableCoordinate(center) ? center : null;\n const centerLat = usableCenter ? usableCenter.lat : null;\n const centerLng = usableCenter ? usableCenter.lng : null;\n\n const clearUserLocation = useCallback(() => {\n const map = mapRef.current;\n if (userLocationMarkerRef.current && map) map.removeLayer(userLocationMarkerRef.current);\n if (userAccuracyCircleRef.current && map) map.removeLayer(userAccuracyCircleRef.current);\n userLocationMarkerRef.current = null;\n userAccuracyCircleRef.current = null;\n }, []);\n\n const removeSearchedPlaceMarker = useCallback(() => {\n const map = mapRef.current;\n if (searchedPlaceMarkerRef.current && map) map.removeLayer(searchedPlaceMarkerRef.current);\n searchedPlaceMarkerRef.current = null;\n }, []);\n\n const clearSearchedPlace = useCallback(() => {\n removeSearchedPlaceMarker();\n setSearchedPlace(null);\n }, [removeSearchedPlaceMarker]);\n\n const focusFarm = useCallback(() => {\n const map = mapRef.current;\n const farmCenter = farmCenterRef.current;\n if (!map || !farmCenter) return;\n map.flyTo(farmCenter, FARM_WEATHER_ZOOM, { duration: 0.6 });\n }, []);\n\n const handleLocateMe = useCallback(() => {\n const map = mapRef.current;\n if (!map) return;\n if (typeof navigator === 'undefined' || !navigator.geolocation) {\n toast({\n title: t('healthybowl.weather.map.toast.locationUnsupported.title', 'Location unavailable'),\n description: t(\n 'healthybowl.weather.map.toast.locationUnsupported.description',\n 'This browser does not support device location.'\n ),\n variant: 'warning',\n });\n return;\n }\n\n setLocating(true);\n navigator.geolocation.getCurrentPosition(\n (position) => {\n const latlng: L.LatLngExpression = [position.coords.latitude, position.coords.longitude];\n clearUserLocation();\n userAccuracyCircleRef.current = L.circle(latlng, {\n radius: Math.max(10, position.coords.accuracy || 0),\n color: '#2563eb',\n fillColor: '#3b82f6',\n fillOpacity: 0.12,\n opacity: 0.45,\n weight: 1,\n }).addTo(map);\n userLocationMarkerRef.current = L.circleMarker(latlng, {\n radius: 7,\n color: '#ffffff',\n weight: 2,\n fillColor: '#2563eb',\n fillOpacity: 1,\n }).addTo(map);\n map.flyTo(latlng, Math.max(map.getZoom(), USER_LOCATION_ZOOM), { duration: 0.75 });\n setLocating(false);\n },\n (error) => {\n const blocked = error.code === error.PERMISSION_DENIED;\n toast({\n title: blocked\n ? t('healthybowl.weather.map.toast.locationBlocked.title', 'Location blocked')\n : t('healthybowl.weather.map.toast.locationFailed.title', 'Could not get location'),\n description: blocked\n ? t(\n 'healthybowl.weather.map.toast.locationBlocked.description',\n 'Allow location access in the browser, then try again.'\n )\n : t(\n 'healthybowl.weather.map.toast.locationFailed.description',\n 'Make sure GPS is enabled and the page is open over HTTPS.'\n ),\n variant: 'warning',\n });\n setLocating(false);\n },\n { enableHighAccuracy: true, timeout: 12000, maximumAge: 60000 }\n );\n }, [clearUserLocation, t, toast]);\n\n const handleSearchPlace = useCallback(\n async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const map = mapRef.current;\n const place = searchQuery.trim();\n if (!place) {\n toast({\n title: t('healthybowl.weather.map.toast.searchRequired.title', 'Place required'),\n description: t(\n 'healthybowl.weather.map.toast.searchRequired.description',\n 'Enter a city, village, district, or region to view it on the map.'\n ),\n variant: 'warning',\n });\n return;\n }\n if (!map) return;\n\n setSearching(true);\n try {\n const hit = await geocodePlace(place);\n if (!hit) {\n toast({\n title: t('healthybowl.weather.map.toast.searchNotFound.title', 'Place not found'),\n description: t(\n 'healthybowl.weather.map.toast.searchNotFound.description',\n 'Try a more specific location name, such as city and state.'\n ),\n variant: 'warning',\n });\n return;\n }\n\n const label = [hit.name, hit.admin1, hit.country].filter(Boolean).join(', ') || place;\n const latlng: L.LatLngExpression = [hit.latitude, hit.longitude];\n removeSearchedPlaceMarker();\n const popupEl = document.createElement('span');\n popupEl.textContent = label;\n searchedPlaceMarkerRef.current = L.circleMarker(latlng, {\n radius: 8,\n color: '#ffffff',\n weight: 2,\n fillColor: '#0ea5e9',\n fillOpacity: 1,\n })\n .addTo(map)\n .bindPopup(popupEl)\n .openPopup();\n map.flyTo(latlng, Math.max(map.getZoom(), SEARCH_LOCATION_ZOOM), { duration: 0.75 });\n setSearchedPlace(label);\n } catch (err) {\n toast({\n title: t('healthybowl.weather.map.toast.searchFailed.title', 'Search failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setSearching(false);\n }\n },\n [removeSearchedPlaceMarker, searchQuery, t, toast]\n );\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return undefined;\n ensureLeafletCss();\n const controller = new AbortController();\n let map: L.Map | undefined;\n let cancelled = false;\n setStatus('loading');\n setHasFarmCenter(false);\n setRadarUpdatedAt(null);\n setSearchedPlace(null);\n farmCenterRef.current = null;\n\n void (async () => {\n const backendCenter = centerLat !== null && centerLng !== null ? { lat: centerLat, lng: centerLng } : null;\n const hit = backendCenter ? null : await geocodePlace(location, controller.signal);\n const located: [number, number] | null = backendCenter\n ? [backendCenter.lat, backendCenter.lng]\n : hit\n ? [hit.latitude, hit.longitude]\n : null;\n if (cancelled || !containerRef.current) return;\n const mapCenter: L.LatLngExpression = located ?? [20, 0];\n // z7 keeps the RainViewer radar at its native resolution (it has no tiles past z7)\n // while still framing the farm and its surrounding weather system.\n const zoom = located ? FARM_WEATHER_ZOOM : 2;\n farmCenterRef.current = located ? L.latLng(located[0], located[1]) : null;\n setHasFarmCenter(Boolean(located));\n\n map = L.map(el, { center: mapCenter, zoom, scrollWheelZoom: true });\n mapRef.current = map;\n const streetsLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors',\n maxZoom: 18,\n });\n const terrainLayer = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors',\n maxZoom: 17,\n });\n streetsLayer.addTo(map);\n const layerControl = L.control\n .layers(\n {\n [streetsLayerLabel]: streetsLayer,\n [terrainLayerLabel]: terrainLayer,\n },\n undefined,\n { collapsed: false }\n )\n .addTo(map);\n L.control.scale({ imperial: false }).addTo(map);\n\n if (located) {\n const icon = L.divIcon({\n className: 'hb-weather-marker',\n html:\n '<div style=\"width:16px;height:16px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);' +\n 'background:var(--color-action-primary-bg, #16a34a);border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.4)\"></div>',\n iconSize: [16, 16],\n iconAnchor: [8, 16],\n });\n // bindPopup treats a string as HTML; pass a text node so the place name\n // can never be interpreted as markup (defense-in-depth against a tainted value).\n const popupEl = document.createElement('span');\n popupEl.textContent = location || 'Your farm';\n L.marker(mapCenter, { icon }).addTo(map).bindPopup(popupEl);\n }\n\n // Live precipitation radar overlay (RainViewer — free, keyless).\n try {\n const res = await fetch('https://api.rainviewer.com/public/weather-maps.json', { signal: controller.signal });\n const data = (await res.json()) as {\n host?: string;\n radar?: { past?: Array<{ path?: string; time?: number }> };\n };\n const frames = data.radar?.past ?? [];\n const latest = frames[frames.length - 1];\n // The map may have been removed during the await — guard before touching it.\n if (!cancelled && map && data.host && latest?.path) {\n // RainViewer radar only has tiles up to z7; cap maxNativeZoom so Leaflet\n // upscales from z7 instead of requesting the \"Zoom Level Not Supported\" placeholder.\n const radarLayer = L.tileLayer(`${data.host}${latest.path}/256/{z}/{x}/{y}/4/1_1.png`, {\n opacity: 0.55,\n maxZoom: 18,\n maxNativeZoom: 7,\n }).addTo(map);\n layerControl.addOverlay(radarLayer, radarLayerLabel);\n if (typeof latest.time === 'number') setRadarUpdatedAt(new Date(latest.time * 1000));\n }\n } catch {\n /* radar overlay is best-effort */\n }\n\n if (!cancelled) {\n setStatus('ready');\n window.setTimeout(() => map?.invalidateSize(), 80);\n }\n })().catch(() => {\n if (!cancelled) setStatus('error');\n });\n\n return () => {\n cancelled = true;\n controller.abort();\n clearUserLocation();\n removeSearchedPlaceMarker();\n map?.remove();\n mapRef.current = null;\n farmCenterRef.current = null;\n };\n }, [\n centerLat,\n centerLng,\n clearUserLocation,\n location,\n radarLayerLabel,\n removeSearchedPlaceMarker,\n streetsLayerLabel,\n terrainLayerLabel,\n ]);\n\n return (\n <div className=\"relative\">\n <div className=\"mb-3 flex flex-wrap items-center gap-2\">\n <form onSubmit={handleSearchPlace} className=\"flex min-w-[min(100%,22rem)] flex-1 flex-wrap items-center gap-2\">\n <div className=\"relative min-w-[12rem] flex-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary\" />\n <input\n type=\"search\"\n value={searchQuery}\n onChange={(event) => setSearchQuery(event.target.value)}\n disabled={status !== 'ready' || searching}\n placeholder={t('healthybowl.weather.map.search.placeholder', 'Search city or place...')}\n aria-label={t('healthybowl.weather.map.search.label', 'Search map by place')}\n 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)] disabled:cursor-not-allowed disabled:opacity-60\"\n />\n </div>\n <Button type=\"submit\" variant=\"outline\" size=\"sm\" disabled={status !== 'ready' || searching}>\n <Search className=\"h-4 w-4\" />{' '}\n {searching\n ? t('healthybowl.weather.map.search.searching', 'Searching...')\n : t('healthybowl.weather.map.search.action', 'Search')}\n </Button>\n {searchedPlace && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={clearSearchedPlace}\n aria-label={t('healthybowl.weather.map.search.clear', 'Clear searched place')}\n title={t('healthybowl.weather.map.search.clear', 'Clear searched place')}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n )}\n </form>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={focusFarm}\n disabled={!hasFarmCenter || status === 'loading'}\n title={t('healthybowl.weather.map.actions.focusFarm.title', 'Focus the weather map on the farm')}\n aria-label={t('healthybowl.weather.map.actions.focusFarm.title', 'Focus the weather map on the farm')}\n >\n <MapPinned className=\"h-4 w-4\" /> {t('healthybowl.weather.map.actions.focusFarm', 'Farm')}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleLocateMe}\n disabled={locating || status !== 'ready'}\n title={t('healthybowl.weather.map.actions.locateMe.title', 'Go to my current location')}\n aria-label={t('healthybowl.weather.map.actions.locateMe.title', 'Go to my current location')}\n >\n <LocateFixed className=\"h-4 w-4\" />{' '}\n {locating\n ? t('healthybowl.weather.map.actions.locating', 'Locating...')\n : t('healthybowl.weather.map.actions.locateMe', 'My location')}\n </Button>\n </div>\n <div\n ref={containerRef}\n className=\"h-[60vh] max-h-[460px] w-full overflow-hidden rounded-md border border-border-subtle bg-bg-sunken\"\n />\n {status === 'loading' && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/60 text-sm text-text-secondary\">\n Loading map…\n </div>\n )}\n {status === 'error' && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/80 px-4 text-center text-sm text-text-secondary\">\n Weather map needs an internet connection and couldn’t load.\n </div>\n )}\n {status === 'ready' && !hasFarmCenter && (\n <div className=\"pointer-events-none absolute left-1/2 top-16 z-[400] -translate-x-1/2 rounded-full bg-bg-surface/90 px-3 py-1.5 text-xs text-text-secondary shadow-sm\">\n {t('healthybowl.weather.map.noLocation', 'No farm coordinates available')}\n </div>\n )}\n <p className=\"mt-2 text-xs text-text-secondary\">\n Live precipitation radar via RainViewer · base map © OpenStreetMap\n {location ? ` · centered on ${location}` : ''}\n {searchedPlace ? ` · viewing ${searchedPlace}` : ''}\n {radarUpdatedAt\n ? ` · radar ${radarUpdatedAt.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })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