@burdenoff/microfe-healthybowl 2026.902.32 → 2026.902.33
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/HealthyBowlRoot.js +57 -56
- package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
- package/dist/healthybowl/offline/HeaderOfflinePill.js +28 -0
- package/dist/healthybowl/offline/HeaderOfflinePill.js.map +1 -0
- package/dist/healthybowl/offline/OfflineStatusPill.js +40 -21
- package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
- package/dist/healthybowl/offline/headerSlot.js +24 -0
- package/dist/healthybowl/offline/headerSlot.js.map +1 -0
- package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
- package/package.json +1 -1
|
@@ -4,14 +4,15 @@ import { normalizeBasePath as r, setHbFormatLocale as i } from "./utils/helpers.
|
|
|
4
4
|
import { ErrorBoundary as a } from "./components/ErrorBoundary.js";
|
|
5
5
|
import { ConfirmProvider as o } from "./components/ConfirmDialog.js";
|
|
6
6
|
import { HealthyBowlRoutes as s } from "./HealthyBowlRoutes.js";
|
|
7
|
-
import { OfflineSyncProvider as
|
|
8
|
-
import {
|
|
7
|
+
import { OfflineSyncProvider as c } from "./offline/OfflineSyncProvider.js";
|
|
8
|
+
import { HeaderOfflinePill as te } from "./offline/HeaderOfflinePill.js";
|
|
9
|
+
import { useCallback as ne, useEffect as l } from "react";
|
|
9
10
|
import { useI18n as re } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
10
|
-
import { Award as ie, Banknote as ae, BarChart3 as oe, Bug as se, Cloud as
|
|
11
|
-
import { jsx as
|
|
12
|
-
import { FeatureFlagProvider as
|
|
11
|
+
import { Award as ie, Banknote as ae, BarChart3 as oe, Bug as se, Cloud as u, CloudUpload as d, DollarSign as f, Factory as p, Fence as m, FlaskConical as h, Globe as g, HardHat as _, Home as v, Landmark as y, Leaf as b, LineChart as x, ListChecks as S, Map as C, Package as w, PawPrint as T, Radio as E, RefreshCw as D, ScanLine as O, ScanSearch as k, ShieldAlert as A, ShieldCheck as j, ShoppingCart as M, Sprout as N, Stethoscope as ce, Tractor as P, UserCheck as F, Users as I, Users2 as L, Wheat as R } from "lucide-react";
|
|
12
|
+
import { jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
13
|
+
import { FeatureFlagProvider as V, useFeatureFlags as H } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
13
14
|
//#region src/healthybowl/HealthyBowlRoot.tsx
|
|
14
|
-
var
|
|
15
|
+
var U = /* @__PURE__ */ new Set([]), W = [
|
|
15
16
|
".lucide-arrow-right",
|
|
16
17
|
".lucide-arrow-left",
|
|
17
18
|
".lucide-chevron-right",
|
|
@@ -20,21 +21,21 @@ var H = /* @__PURE__ */ new Set([]), U = [
|
|
|
20
21
|
".lucide-chevrons-left",
|
|
21
22
|
".lucide-move-right",
|
|
22
23
|
".lucide-move-left"
|
|
23
|
-
].map((e) => `[dir="rtl"] ${e}`).join(",").concat("{transform:scaleX(-1)}"),
|
|
24
|
+
].map((e) => `[dir="rtl"] ${e}`).join(",").concat("{transform:scaleX(-1)}"), G = new Set([
|
|
24
25
|
"healthybowl-sustainability",
|
|
25
26
|
"healthybowl-sustainability-carbon",
|
|
26
27
|
"healthybowl-sustainability-soil",
|
|
27
28
|
"healthybowl-sustainability-credits",
|
|
28
29
|
"healthybowl-sustainability-eudr"
|
|
29
30
|
]);
|
|
30
|
-
function
|
|
31
|
-
return t ? e : e.filter((e) => !
|
|
31
|
+
function le(e, t) {
|
|
32
|
+
return t ? e : e.filter((e) => !G.has(e.id));
|
|
32
33
|
}
|
|
33
34
|
var K = (n) => {
|
|
34
|
-
let { registerNavItems:
|
|
35
|
+
let { registerNavItems: V, registerFooterItems: G, basePath: K = "/" } = n, { error: q, getEvaluation: ue, isLoading: de } = H(), J = ee(ue(t), de || q !== null), { t: Y, locale: X } = re();
|
|
35
36
|
i(X);
|
|
36
|
-
let Z =
|
|
37
|
-
|
|
37
|
+
let Z = U.has(X) ? "rtl" : "ltr";
|
|
38
|
+
l(() => {
|
|
38
39
|
let e = document.documentElement, t = e.getAttribute("dir");
|
|
39
40
|
return e.setAttribute("dir", Z), () => {
|
|
40
41
|
t === null ? e.removeAttribute("dir") : e.setAttribute("dir", t);
|
|
@@ -44,13 +45,13 @@ var K = (n) => {
|
|
|
44
45
|
let n = Y(e);
|
|
45
46
|
return n === e ? t : n;
|
|
46
47
|
}, [Y]), $ = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
47
|
-
return
|
|
48
|
-
if (
|
|
48
|
+
return l(() => {
|
|
49
|
+
if (V) return V(le([
|
|
49
50
|
{
|
|
50
51
|
id: "healthybowl-dashboard",
|
|
51
52
|
label: Q("healthybowl.nav.dashboard", "Dashboard"),
|
|
52
53
|
path: r(K),
|
|
53
|
-
icon: /* @__PURE__ */
|
|
54
|
+
icon: /* @__PURE__ */ z(v, { size: 20 }),
|
|
54
55
|
order: 1,
|
|
55
56
|
group: "main"
|
|
56
57
|
},
|
|
@@ -58,7 +59,7 @@ var K = (n) => {
|
|
|
58
59
|
id: "healthybowl-farm",
|
|
59
60
|
label: Q("healthybowl.nav.farm", "My Farm"),
|
|
60
61
|
path: $(K, "farm"),
|
|
61
|
-
icon: /* @__PURE__ */
|
|
62
|
+
icon: /* @__PURE__ */ z(P, { size: 20 }),
|
|
62
63
|
order: 2,
|
|
63
64
|
group: "main"
|
|
64
65
|
},
|
|
@@ -66,7 +67,7 @@ var K = (n) => {
|
|
|
66
67
|
id: "healthybowl-tasks",
|
|
67
68
|
label: Q("healthybowl.nav.tasks", "Tasks"),
|
|
68
69
|
path: $(K, "tasks"),
|
|
69
|
-
icon: /* @__PURE__ */
|
|
70
|
+
icon: /* @__PURE__ */ z(S, { size: 20 }),
|
|
70
71
|
order: 3,
|
|
71
72
|
group: "main"
|
|
72
73
|
},
|
|
@@ -74,7 +75,7 @@ var K = (n) => {
|
|
|
74
75
|
id: "healthybowl-crops",
|
|
75
76
|
label: Q("healthybowl.nav.crops", "Crops"),
|
|
76
77
|
path: $(K, "crops"),
|
|
77
|
-
icon: /* @__PURE__ */ R
|
|
78
|
+
icon: /* @__PURE__ */ z(R, { size: 20 }),
|
|
78
79
|
order: 10,
|
|
79
80
|
group: "farming"
|
|
80
81
|
},
|
|
@@ -82,7 +83,7 @@ var K = (n) => {
|
|
|
82
83
|
id: "healthybowl-livestock",
|
|
83
84
|
label: Q("healthybowl.nav.livestock", "Livestock"),
|
|
84
85
|
path: $(K, "livestock"),
|
|
85
|
-
icon: /* @__PURE__ */
|
|
86
|
+
icon: /* @__PURE__ */ z(T, { size: 20 }),
|
|
86
87
|
order: 11,
|
|
87
88
|
group: "farming"
|
|
88
89
|
},
|
|
@@ -90,7 +91,7 @@ var K = (n) => {
|
|
|
90
91
|
id: "healthybowl-livestock-analytics",
|
|
91
92
|
label: Q("healthybowl.nav.livestockAnalytics", "Livestock Analytics"),
|
|
92
93
|
path: $(K, "livestock/analytics"),
|
|
93
|
-
icon: /* @__PURE__ */
|
|
94
|
+
icon: /* @__PURE__ */ z(x, { size: 20 }),
|
|
94
95
|
order: 11.3,
|
|
95
96
|
group: "farming"
|
|
96
97
|
},
|
|
@@ -98,7 +99,7 @@ var K = (n) => {
|
|
|
98
99
|
id: "healthybowl-grazing",
|
|
99
100
|
label: Q("healthybowl.nav.grazing", "Grazing"),
|
|
100
101
|
path: $(K, "livestock/grazing"),
|
|
101
|
-
icon: /* @__PURE__ */
|
|
102
|
+
icon: /* @__PURE__ */ z(m, { size: 20 }),
|
|
102
103
|
order: 11.4,
|
|
103
104
|
group: "farming"
|
|
104
105
|
},
|
|
@@ -106,7 +107,7 @@ var K = (n) => {
|
|
|
106
107
|
id: "healthybowl-withdrawal-alerts",
|
|
107
108
|
label: Q("healthybowl.nav.withdrawalAlerts", "Withdrawal Alerts"),
|
|
108
109
|
path: $(K, "livestock/withdrawal-alerts"),
|
|
109
|
-
icon: /* @__PURE__ */
|
|
110
|
+
icon: /* @__PURE__ */ z(A, { size: 20 }),
|
|
110
111
|
order: 11.5,
|
|
111
112
|
group: "farming"
|
|
112
113
|
},
|
|
@@ -114,7 +115,7 @@ var K = (n) => {
|
|
|
114
115
|
id: "healthybowl-weather",
|
|
115
116
|
label: Q("healthybowl.nav.weather", "Weather"),
|
|
116
117
|
path: $(K, "weather"),
|
|
117
|
-
icon: /* @__PURE__ */
|
|
118
|
+
icon: /* @__PURE__ */ z(u, { size: 20 }),
|
|
118
119
|
order: 12,
|
|
119
120
|
group: "farming"
|
|
120
121
|
},
|
|
@@ -122,7 +123,7 @@ var K = (n) => {
|
|
|
122
123
|
id: "healthybowl-field-map",
|
|
123
124
|
label: Q("healthybowl.nav.fieldMap", "Field Map"),
|
|
124
125
|
path: $(K, "field-map"),
|
|
125
|
-
icon: /* @__PURE__ */
|
|
126
|
+
icon: /* @__PURE__ */ z(C, { size: 20 }),
|
|
126
127
|
order: 12.5,
|
|
127
128
|
group: "farming"
|
|
128
129
|
},
|
|
@@ -130,7 +131,7 @@ var K = (n) => {
|
|
|
130
131
|
id: "healthybowl-field-capture",
|
|
131
132
|
label: Q("healthybowl.nav.fieldCapture", "Field Capture"),
|
|
132
133
|
path: $(K, "field-capture"),
|
|
133
|
-
icon: /* @__PURE__ */
|
|
134
|
+
icon: /* @__PURE__ */ z(d, { size: 20 }),
|
|
134
135
|
order: 12.6,
|
|
135
136
|
group: "farming"
|
|
136
137
|
},
|
|
@@ -138,7 +139,7 @@ var K = (n) => {
|
|
|
138
139
|
id: "healthybowl-pending-sync",
|
|
139
140
|
label: Q("healthybowl.nav.pendingSync", "Pending Sync"),
|
|
140
141
|
path: $(K, "field-capture/pending"),
|
|
141
|
-
icon: /* @__PURE__ */
|
|
142
|
+
icon: /* @__PURE__ */ z(D, { size: 20 }),
|
|
142
143
|
order: 12.7,
|
|
143
144
|
group: "farming"
|
|
144
145
|
},
|
|
@@ -146,7 +147,7 @@ var K = (n) => {
|
|
|
146
147
|
id: "healthybowl-field-sensors",
|
|
147
148
|
label: Q("healthybowl.nav.fieldSensors", "Field Sensors"),
|
|
148
149
|
path: $(K, "field-sensors"),
|
|
149
|
-
icon: /* @__PURE__ */
|
|
150
|
+
icon: /* @__PURE__ */ z(E, { size: 20 }),
|
|
150
151
|
order: 12.75,
|
|
151
152
|
group: "farming"
|
|
152
153
|
},
|
|
@@ -154,7 +155,7 @@ var K = (n) => {
|
|
|
154
155
|
id: "healthybowl-soil",
|
|
155
156
|
label: Q("healthybowl.nav.soilHealth", "Soil Health"),
|
|
156
157
|
path: $(K, "soil"),
|
|
157
|
-
icon: /* @__PURE__ */
|
|
158
|
+
icon: /* @__PURE__ */ z(h, { size: 20 }),
|
|
158
159
|
order: 13,
|
|
159
160
|
group: "farming"
|
|
160
161
|
},
|
|
@@ -162,7 +163,7 @@ var K = (n) => {
|
|
|
162
163
|
id: "healthybowl-pest",
|
|
163
164
|
label: Q("healthybowl.nav.pestManagement", "Pest Management"),
|
|
164
165
|
path: $(K, "pest-management"),
|
|
165
|
-
icon: /* @__PURE__ */
|
|
166
|
+
icon: /* @__PURE__ */ z(se, { size: 20 }),
|
|
166
167
|
order: 14,
|
|
167
168
|
group: "farming"
|
|
168
169
|
},
|
|
@@ -170,7 +171,7 @@ var K = (n) => {
|
|
|
170
171
|
id: "healthybowl-pest-ai",
|
|
171
172
|
label: Q("healthybowl.nav.aiPestDetection", "AI Pest Detection"),
|
|
172
173
|
path: $(K, "pest-management/ai-detection"),
|
|
173
|
-
icon: /* @__PURE__ */
|
|
174
|
+
icon: /* @__PURE__ */ z(k, { size: 20 }),
|
|
174
175
|
order: 14.5,
|
|
175
176
|
group: "farming"
|
|
176
177
|
},
|
|
@@ -178,7 +179,7 @@ var K = (n) => {
|
|
|
178
179
|
id: "healthybowl-production",
|
|
179
180
|
label: Q("healthybowl.nav.production", "Production"),
|
|
180
181
|
path: $(K, "production"),
|
|
181
|
-
icon: /* @__PURE__ */
|
|
182
|
+
icon: /* @__PURE__ */ z(p, { size: 20 }),
|
|
182
183
|
order: 20,
|
|
183
184
|
group: "business"
|
|
184
185
|
},
|
|
@@ -186,7 +187,7 @@ var K = (n) => {
|
|
|
186
187
|
id: "healthybowl-products",
|
|
187
188
|
label: Q("healthybowl.nav.products", "Products"),
|
|
188
189
|
path: $(K, "products"),
|
|
189
|
-
icon: /* @__PURE__ */
|
|
190
|
+
icon: /* @__PURE__ */ z(w, { size: 20 }),
|
|
190
191
|
order: 21,
|
|
191
192
|
group: "business"
|
|
192
193
|
},
|
|
@@ -194,7 +195,7 @@ var K = (n) => {
|
|
|
194
195
|
id: "healthybowl-marketplace",
|
|
195
196
|
label: Q("healthybowl.nav.marketplace", "Marketplace"),
|
|
196
197
|
path: $(K, "marketplace"),
|
|
197
|
-
icon: /* @__PURE__ */
|
|
198
|
+
icon: /* @__PURE__ */ z(M, { size: 20 }),
|
|
198
199
|
order: 22,
|
|
199
200
|
group: "business"
|
|
200
201
|
},
|
|
@@ -202,7 +203,7 @@ var K = (n) => {
|
|
|
202
203
|
id: "healthybowl-labour",
|
|
203
204
|
label: Q("healthybowl.nav.labour", "Labour"),
|
|
204
205
|
path: $(K, "labour"),
|
|
205
|
-
icon: /* @__PURE__ */
|
|
206
|
+
icon: /* @__PURE__ */ z(_, { size: 20 }),
|
|
206
207
|
order: 22.5,
|
|
207
208
|
group: "business"
|
|
208
209
|
},
|
|
@@ -210,7 +211,7 @@ var K = (n) => {
|
|
|
210
211
|
id: "healthybowl-coop",
|
|
211
212
|
label: Q("healthybowl.nav.coop", "Co-operative"),
|
|
212
213
|
path: $(K, "coop"),
|
|
213
|
-
icon: /* @__PURE__ */
|
|
214
|
+
icon: /* @__PURE__ */ z(L, { size: 20 }),
|
|
214
215
|
order: 22.5,
|
|
215
216
|
group: "business"
|
|
216
217
|
},
|
|
@@ -218,7 +219,7 @@ var K = (n) => {
|
|
|
218
219
|
id: "healthybowl-financial",
|
|
219
220
|
label: Q("healthybowl.nav.financial", "Financial"),
|
|
220
221
|
path: $(K, "financial"),
|
|
221
|
-
icon: /* @__PURE__ */
|
|
222
|
+
icon: /* @__PURE__ */ z(f, { size: 20 }),
|
|
222
223
|
order: 23,
|
|
223
224
|
group: "business"
|
|
224
225
|
},
|
|
@@ -226,7 +227,7 @@ var K = (n) => {
|
|
|
226
227
|
id: "healthybowl-financier",
|
|
227
228
|
label: Q("healthybowl.nav.financier", "Financier"),
|
|
228
229
|
path: $(K, "financier"),
|
|
229
|
-
icon: /* @__PURE__ */
|
|
230
|
+
icon: /* @__PURE__ */ z(ae, { size: 20 }),
|
|
230
231
|
order: 24,
|
|
231
232
|
group: "business"
|
|
232
233
|
},
|
|
@@ -234,7 +235,7 @@ var K = (n) => {
|
|
|
234
235
|
id: "healthybowl-compliance",
|
|
235
236
|
label: Q("healthybowl.nav.compliance", "Compliance"),
|
|
236
237
|
path: $(K, "compliance"),
|
|
237
|
-
icon: /* @__PURE__ */
|
|
238
|
+
icon: /* @__PURE__ */ z(j, { size: 20 }),
|
|
238
239
|
order: 30,
|
|
239
240
|
group: "compliance"
|
|
240
241
|
},
|
|
@@ -242,7 +243,7 @@ var K = (n) => {
|
|
|
242
243
|
id: "healthybowl-traceability",
|
|
243
244
|
label: Q("healthybowl.nav.traceability", "Traceability"),
|
|
244
245
|
path: $(K, "traceability"),
|
|
245
|
-
icon: /* @__PURE__ */
|
|
246
|
+
icon: /* @__PURE__ */ z(O, { size: 20 }),
|
|
246
247
|
order: 31,
|
|
247
248
|
group: "compliance"
|
|
248
249
|
},
|
|
@@ -250,7 +251,7 @@ var K = (n) => {
|
|
|
250
251
|
id: "healthybowl-sustainability",
|
|
251
252
|
label: Q("healthybowl.nav.sustainability", "Sustainability"),
|
|
252
253
|
path: $(K, "sustainability"),
|
|
253
|
-
icon: /* @__PURE__ */
|
|
254
|
+
icon: /* @__PURE__ */ z(b, { size: 20 }),
|
|
254
255
|
order: 32,
|
|
255
256
|
group: "compliance"
|
|
256
257
|
},
|
|
@@ -258,7 +259,7 @@ var K = (n) => {
|
|
|
258
259
|
id: "healthybowl-sustainability-carbon",
|
|
259
260
|
label: Q("healthybowl.nav.sustainabilityCarbon", "Carbon & GHG"),
|
|
260
261
|
path: $(K, "sustainability/carbon"),
|
|
261
|
-
icon: /* @__PURE__ */
|
|
262
|
+
icon: /* @__PURE__ */ z(p, { size: 20 }),
|
|
262
263
|
order: 32.1,
|
|
263
264
|
group: "compliance"
|
|
264
265
|
},
|
|
@@ -266,7 +267,7 @@ var K = (n) => {
|
|
|
266
267
|
id: "healthybowl-sustainability-soil",
|
|
267
268
|
label: Q("healthybowl.nav.sustainabilitySoil", "Soil Carbon"),
|
|
268
269
|
path: $(K, "sustainability/soil-carbon"),
|
|
269
|
-
icon: /* @__PURE__ */
|
|
270
|
+
icon: /* @__PURE__ */ z(N, { size: 20 }),
|
|
270
271
|
order: 32.2,
|
|
271
272
|
group: "compliance"
|
|
272
273
|
},
|
|
@@ -274,7 +275,7 @@ var K = (n) => {
|
|
|
274
275
|
id: "healthybowl-sustainability-credits",
|
|
275
276
|
label: Q("healthybowl.nav.sustainabilityCredits", "Carbon Credits"),
|
|
276
277
|
path: $(K, "sustainability/credits"),
|
|
277
|
-
icon: /* @__PURE__ */
|
|
278
|
+
icon: /* @__PURE__ */ z(ie, { size: 20 }),
|
|
278
279
|
order: 32.3,
|
|
279
280
|
group: "compliance"
|
|
280
281
|
},
|
|
@@ -282,7 +283,7 @@ var K = (n) => {
|
|
|
282
283
|
id: "healthybowl-sustainability-eudr",
|
|
283
284
|
label: Q("healthybowl.nav.sustainabilityEudr", "EUDR Due-Diligence"),
|
|
284
285
|
path: $(K, "sustainability/eudr"),
|
|
285
|
-
icon: /* @__PURE__ */
|
|
286
|
+
icon: /* @__PURE__ */ z(g, { size: 20 }),
|
|
286
287
|
order: 32.4,
|
|
287
288
|
group: "compliance"
|
|
288
289
|
},
|
|
@@ -290,7 +291,7 @@ var K = (n) => {
|
|
|
290
291
|
id: "healthybowl-schemes",
|
|
291
292
|
label: Q("healthybowl.nav.governmentSchemes", "Gov. Schemes"),
|
|
292
293
|
path: $(K, "government-schemes"),
|
|
293
|
-
icon: /* @__PURE__ */
|
|
294
|
+
icon: /* @__PURE__ */ z(y, { size: 20 }),
|
|
294
295
|
order: 40,
|
|
295
296
|
group: "support"
|
|
296
297
|
},
|
|
@@ -298,7 +299,7 @@ var K = (n) => {
|
|
|
298
299
|
id: "healthybowl-network",
|
|
299
300
|
label: Q("healthybowl.nav.network", "Network"),
|
|
300
301
|
path: $(K, "network"),
|
|
301
|
-
icon: /* @__PURE__ */
|
|
302
|
+
icon: /* @__PURE__ */ z(I, { size: 20 }),
|
|
302
303
|
order: 41,
|
|
303
304
|
group: "support"
|
|
304
305
|
},
|
|
@@ -306,7 +307,7 @@ var K = (n) => {
|
|
|
306
307
|
id: "healthybowl-analytics",
|
|
307
308
|
label: Q("healthybowl.nav.analytics", "Analytics"),
|
|
308
309
|
path: $(K, "analytics"),
|
|
309
|
-
icon: /* @__PURE__ */
|
|
310
|
+
icon: /* @__PURE__ */ z(oe, { size: 20 }),
|
|
310
311
|
order: 42,
|
|
311
312
|
group: "support"
|
|
312
313
|
},
|
|
@@ -314,7 +315,7 @@ var K = (n) => {
|
|
|
314
315
|
id: "healthybowl-advisors",
|
|
315
316
|
label: Q("healthybowl.nav.advisors", "My Advisors"),
|
|
316
317
|
path: $(K, "advisors"),
|
|
317
|
-
icon: /* @__PURE__ */
|
|
318
|
+
icon: /* @__PURE__ */ z(F, { size: 20 }),
|
|
318
319
|
order: 43,
|
|
319
320
|
group: "support"
|
|
320
321
|
},
|
|
@@ -322,34 +323,34 @@ var K = (n) => {
|
|
|
322
323
|
id: "healthybowl-consultant",
|
|
323
324
|
label: Q("healthybowl.nav.consultant", "Consultant"),
|
|
324
325
|
path: $(K, "consultant"),
|
|
325
|
-
icon: /* @__PURE__ */
|
|
326
|
+
icon: /* @__PURE__ */ z(ce, { size: 20 }),
|
|
326
327
|
order: 44,
|
|
327
328
|
group: "support"
|
|
328
329
|
}
|
|
329
330
|
], J));
|
|
330
331
|
}, [
|
|
331
|
-
|
|
332
|
+
V,
|
|
332
333
|
K,
|
|
333
334
|
J,
|
|
334
335
|
Q
|
|
335
|
-
]),
|
|
336
|
-
if (
|
|
336
|
+
]), l(() => {
|
|
337
|
+
if (G) return G([{
|
|
337
338
|
id: "healthybowl-status",
|
|
338
339
|
label: Q("healthybowl.footer.ready", "HealthyBowl Ready"),
|
|
339
340
|
type: "status",
|
|
340
341
|
order: 10,
|
|
341
342
|
section: "left"
|
|
342
343
|
}]);
|
|
343
|
-
}, [
|
|
344
|
+
}, [G, Q]), /* @__PURE__ */ B(e, {
|
|
344
345
|
...n,
|
|
345
|
-
children: [/* @__PURE__ */
|
|
346
|
+
children: [/* @__PURE__ */ z("style", { children: W }), /* @__PURE__ */ z(a, { children: /* @__PURE__ */ z(o, { children: /* @__PURE__ */ B(c, { children: [/* @__PURE__ */ z(te, {}), /* @__PURE__ */ z(s, {})] }) }) })]
|
|
346
347
|
});
|
|
347
|
-
}, q = (e) => /* @__PURE__ */
|
|
348
|
+
}, q = (e) => /* @__PURE__ */ z(V, {
|
|
348
349
|
workspaceId: e.workspaceId ?? null,
|
|
349
350
|
gateway: "global",
|
|
350
351
|
flagKeys: n,
|
|
351
352
|
defaultEnabled: !0,
|
|
352
|
-
children: /* @__PURE__ */
|
|
353
|
+
children: /* @__PURE__ */ z(K, { ...e })
|
|
353
354
|
}, e.workspaceId ?? "no-workspace");
|
|
354
355
|
//#endregion
|
|
355
356
|
export { q as HealthyBowlRoot };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HealthyBowlRoot.js","names":[],"sources":["../../src/healthybowl/HealthyBowlRoot.tsx"],"sourcesContent":["/**\n * HealthyBowl Root Component\n * @module healthybowl\n */\n\nimport type { FC } from 'react';\nimport { useCallback, useEffect } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n Home,\n Tractor,\n ListChecks,\n Wheat,\n PawPrint,\n Cloud,\n Map as MapIcon,\n HardHat,\n ShoppingCart,\n DollarSign,\n BarChart3,\n FlaskConical,\n Bug,\n ScanSearch,\n Factory,\n Package,\n ScanLine,\n ShieldCheck,\n Landmark,\n Banknote,\n Stethoscope,\n UserCheck,\n Users,\n CloudUpload,\n RefreshCw,\n ShieldAlert,\n LineChart,\n Fence,\n Radio,\n Leaf,\n Sprout,\n Award,\n Globe,\n Users2,\n} from 'lucide-react';\nimport { HealthyBowlProvider } from './context/HealthyBowlContext';\nimport { FeatureFlagProvider, useFeatureFlags } from '@burdenoff/fe-libs/shared/feature-flags';\nimport {\n HEALTHYBOWL_CARBON_FEATURE_FLAG,\n HEALTHYBOWL_CARBON_FEATURE_FLAG_KEYS,\n isHealthyBowlCarbonEnabled,\n} from './carbonFeatureFlag';\nimport { HealthyBowlRoutes } from './HealthyBowlRoutes';\nimport { ErrorBoundary } from './components/ErrorBoundary';\nimport { ConfirmProvider } from './components/ConfirmDialog';\nimport { OfflineSyncProvider } from './offline/OfflineSyncProvider';\nimport { normalizeBasePath, setHbFormatLocale } from './utils/helpers';\nimport type { HealthyBowlRootProps, NavItem } from './types';\n\n// Locales that render right-to-left.\n//\n// DELIBERATELY EMPTY — Arabic was removed here, reverting BOFF-6119's rendering decision.\n//\n// BOFF-6119 migrated *this package* to logical CSS utilities (461 logical vs 54 physical) and then\n// set `dir` on `document.documentElement`. But the document root is not this package's to mirror:\n// the surrounding shell is `fe-libs` (177 physical utilities, 0 logical) and `healthybowl-app`\n// (7 physical, 0 logical). Neither is migrated, so `dir=\"rtl\"` mirrored them incorrectly and the\n// sidebar jumped to the right — which is what the layout complaint was about.\n//\n// fe-libs documents this exact failure mode and refuses to set `dir` for ANY locale until the\n// fleet-wide migration lands (see its I18nProvider note + BOFF-5998: \"sidebars on the wrong side,\n// icons mirrored, chevrons reversed\"). HealthyBowl was the only surface on the fleet setting it,\n// so Arabic rendered differently here than in every other product.\n//\n// Keeping the Set (rather than deleting the mechanism) so BOFF-6119 can be restored as a one-line\n// change once BOFF-5998 migrates the shell. Re-adding 'ar' before then reintroduces the bug.\nconst RTL_LOCALES = new Set<string>([]);\n\n// Horizontal directional lucide icons whose glyph must point the other way under RTL. lucide-react\n// tags every icon with a `lucide-<name>` class; scaleX(-1) mirrors the horizontal ones (vertical\n// chevrons up/down are unchanged by a horizontal flip). Kept off the LTR path via the [dir=rtl] scope.\nconst RTL_ICON_MIRROR_CSS = [\n '.lucide-arrow-right',\n '.lucide-arrow-left',\n '.lucide-chevron-right',\n '.lucide-chevron-left',\n '.lucide-chevrons-right',\n '.lucide-chevrons-left',\n '.lucide-move-right',\n '.lucide-move-left',\n]\n .map((c) => `[dir=\"rtl\"] ${c}`)\n .join(',')\n .concat('{transform:scaleX(-1)}');\n\nconst SUSTAINABILITY_NAV_ITEM_IDS = new Set([\n 'healthybowl-sustainability',\n 'healthybowl-sustainability-carbon',\n 'healthybowl-sustainability-soil',\n 'healthybowl-sustainability-credits',\n 'healthybowl-sustainability-eudr',\n]);\n\nexport function filterHealthyBowlNavItemsForCarbon(navItems: NavItem[], carbonEnabled: boolean): NavItem[] {\n return carbonEnabled ? navItems : navItems.filter((item) => !SUSTAINABILITY_NAV_ITEM_IDS.has(item.id));\n}\n\nconst HealthyBowlRootContent: FC<HealthyBowlRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const { error, getEvaluation, isLoading } = useFeatureFlags();\n const carbonEnabled = isHealthyBowlCarbonEnabled(\n getEvaluation(HEALTHYBOWL_CARBON_FEATURE_FLAG),\n isLoading || error !== null\n );\n const { t: translate, locale } = useI18n();\n\n // HealthyBowl's Intl.* formatters (utils/helpers.ts) are plain functions used\n // across ~490 call sites, so they can't call useI18n() themselves. Sync the\n // shell's active language into their ambient locale here — the product's\n // single I18n consumer that wraps every page — so number / currency / date\n // grouping tracks the chosen language (BOFF-6202). Done during render, not in\n // an effect, so children rendered in this same pass already format with the\n // current locale (no one-frame western-grouping flash on a language switch).\n setHbFormatLocale(locale);\n\n // BOFF-6119 wired RTL rendering here. `RTL_LOCALES` is now empty, so this resolves to 'ltr' for\n // every locale and the effect below writes dir=\"ltr\" — matching fe-libs and every other product.\n //\n // The original claim on this line was that \"HealthyBowl's own components are migrated to logical\n // CSS utilities, so setting `dir` makes the whole HB surface mirror correctly.\" Only the first\n // half held: this package is ~90% logical, but `dir` is set on the DOCUMENT ROOT (see below), so\n // it also mirrors fe-libs (177 physical / 0 logical) and healthybowl-app (7 / 0). \"The whole HB\n // surface\" is bigger than this package, and the rest of it was never migrated.\n const dir: 'rtl' | 'ltr' = RTL_LOCALES.has(locale) ? 'rtl' : 'ltr';\n\n // Set the direction on the document root, not just an in-flow wrapper: HB's overlays\n // (confirm/alert dialogs, dropdowns, tooltips) render through Radix portals attached to\n // document.body, so a subtree wrapper would leave them LTR. The shared fe-libs I18nProvider\n // deliberately leaves document.dir unset (the app shell and other products aren't migrated to\n // logical CSS yet — fleet ticket BOFF-5998), so HB owns it here and restores the previous value\n // on unmount, keeping the effect self-contained to when a HealthyBowl surface is mounted.\n useEffect(() => {\n const el = document.documentElement;\n const previous = el.getAttribute('dir');\n el.setAttribute('dir', dir);\n return () => {\n if (previous === null) el.removeAttribute('dir');\n else el.setAttribute('dir', previous);\n };\n }, [dir]);\n\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n\n // Helper to join paths correctly\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with shell on mount\n useEffect(() => {\n if (!registerNavItems) return;\n\n const allNavItems: NavItem[] = [\n // Dashboard\n {\n id: 'healthybowl-dashboard',\n label: t('healthybowl.nav.dashboard', 'Dashboard'),\n // The product index IS the dashboard. Normalize a trailing slash like\n // every sibling item (joinPath) so active-state highlighting matches if\n // the host ever passes '/healthybowl/'.\n path: normalizeBasePath(basePath),\n icon: <Home size={20} />,\n order: 1,\n group: 'main',\n },\n\n // My Farm\n {\n id: 'healthybowl-farm',\n label: t('healthybowl.nav.farm', 'My Farm'),\n path: joinPath(basePath, 'farm'),\n icon: <Tractor size={20} />,\n order: 2,\n group: 'main',\n },\n\n // Farm Tasks (PlanMagnet embed) — shared work-item board across the farm.\n {\n id: 'healthybowl-tasks',\n label: t('healthybowl.nav.tasks', 'Tasks'),\n path: joinPath(basePath, 'tasks'),\n icon: <ListChecks size={20} />,\n order: 3,\n group: 'main',\n },\n\n // Crops\n {\n id: 'healthybowl-crops',\n label: t('healthybowl.nav.crops', 'Crops'),\n path: joinPath(basePath, 'crops'),\n icon: <Wheat size={20} />,\n order: 10,\n group: 'farming',\n },\n\n // Livestock\n {\n id: 'healthybowl-livestock',\n label: t('healthybowl.nav.livestock', 'Livestock'),\n path: joinPath(basePath, 'livestock'),\n icon: <PawPrint size={20} />,\n order: 11,\n group: 'farming',\n },\n\n // Livestock — Analytics (BOFF-6126). The growth, feed and herd-stats charts (BOFF-5971) also\n // render inline on the livestock dashboard; this gives them a dedicated URL and full-width home.\n {\n id: 'healthybowl-livestock-analytics',\n label: t('healthybowl.nav.livestockAnalytics', 'Livestock Analytics'),\n path: joinPath(basePath, 'livestock/analytics'),\n icon: <LineChart size={20} />,\n order: 11.3,\n group: 'farming',\n },\n\n // Livestock — Grazing management (BOFF-5970). Sits next to Livestock rather than inside it\n // because rotational grazing is a daily decision about FIELDS, not a herd-record lookup.\n {\n id: 'healthybowl-grazing',\n label: t('healthybowl.nav.grazing', 'Grazing'),\n path: joinPath(basePath, 'livestock/grazing'),\n icon: <Fence size={20} />,\n order: 11.4,\n group: 'farming',\n },\n\n // Livestock — Medication Withdrawal Alerts (BOFF-2885)\n {\n id: 'healthybowl-withdrawal-alerts',\n label: t('healthybowl.nav.withdrawalAlerts', 'Withdrawal Alerts'),\n path: joinPath(basePath, 'livestock/withdrawal-alerts'),\n icon: <ShieldAlert size={20} />,\n order: 11.5,\n group: 'farming',\n },\n\n // Weather\n {\n id: 'healthybowl-weather',\n label: t('healthybowl.nav.weather', 'Weather'),\n path: joinPath(basePath, 'weather'),\n icon: <Cloud size={20} />,\n order: 12,\n group: 'farming',\n },\n\n // Field Map — draw & manage field boundaries on satellite imagery\n {\n id: 'healthybowl-field-map',\n label: t('healthybowl.nav.fieldMap', 'Field Map'),\n path: joinPath(basePath, 'field-map'),\n icon: <MapIcon size={20} />,\n order: 12.5,\n group: 'farming',\n },\n\n // Field Capture — offline-first observation capture (BOFF-2883)\n {\n id: 'healthybowl-field-capture',\n label: t('healthybowl.nav.fieldCapture', 'Field Capture'),\n path: joinPath(basePath, 'field-capture'),\n icon: <CloudUpload size={20} />,\n order: 12.6,\n group: 'farming',\n },\n\n // Pending Sync — the offline outbox / sync queue (BOFF-2883)\n {\n id: 'healthybowl-pending-sync',\n label: t('healthybowl.nav.pendingSync', 'Pending Sync'),\n path: joinPath(basePath, 'field-capture/pending'),\n icon: <RefreshCw size={20} />,\n order: 12.7,\n group: 'farming',\n },\n\n // Field Sensors — live probe monitoring (BOFF-2894)\n {\n id: 'healthybowl-field-sensors',\n label: t('healthybowl.nav.fieldSensors', 'Field Sensors'),\n path: joinPath(basePath, 'field-sensors'),\n icon: <Radio size={20} />,\n order: 12.75,\n group: 'farming',\n },\n\n // Soil Health\n {\n id: 'healthybowl-soil',\n label: t('healthybowl.nav.soilHealth', 'Soil Health'),\n path: joinPath(basePath, 'soil'),\n icon: <FlaskConical size={20} />,\n order: 13,\n group: 'farming',\n },\n\n // Pest Management\n {\n id: 'healthybowl-pest',\n label: t('healthybowl.nav.pestManagement', 'Pest Management'),\n path: joinPath(basePath, 'pest-management'),\n icon: <Bug size={20} />,\n order: 14,\n group: 'farming',\n },\n {\n id: 'healthybowl-pest-ai',\n label: t('healthybowl.nav.aiPestDetection', 'AI Pest Detection'),\n path: joinPath(basePath, 'pest-management/ai-detection'),\n icon: <ScanSearch size={20} />,\n order: 14.5,\n group: 'farming',\n },\n\n // Production\n {\n id: 'healthybowl-production',\n label: t('healthybowl.nav.production', 'Production'),\n path: joinPath(basePath, 'production'),\n icon: <Factory size={20} />,\n order: 20,\n group: 'business',\n },\n\n // Products\n {\n id: 'healthybowl-products',\n label: t('healthybowl.nav.products', 'Products'),\n path: joinPath(basePath, 'products'),\n icon: <Package size={20} />,\n order: 21,\n group: 'business',\n },\n\n // Marketplace\n {\n id: 'healthybowl-marketplace',\n label: t('healthybowl.nav.marketplace', 'Marketplace'),\n path: joinPath(basePath, 'marketplace'),\n icon: <ShoppingCart size={20} />,\n order: 22,\n group: 'business',\n },\n\n // Labour, crews and timesheets (BOFF-6024). Sits between Marketplace (22) and Co-operative,\n // in the business group, because its output lands on the financial pages next to it.\n {\n id: 'healthybowl-labour',\n label: t('healthybowl.nav.labour', 'Labour'),\n path: joinPath(basePath, 'labour'),\n icon: <HardHat size={20} />,\n order: 22.5,\n group: 'business',\n },\n\n // Co-operative / FPO aggregation (BOFF-6023)\n {\n id: 'healthybowl-coop',\n label: t('healthybowl.nav.coop', 'Co-operative'),\n path: joinPath(basePath, 'coop'),\n icon: <Users2 size={20} />,\n order: 22.5,\n group: 'business',\n },\n\n // Financial\n {\n id: 'healthybowl-financial',\n label: t('healthybowl.nav.financial', 'Financial'),\n path: joinPath(basePath, 'financial'),\n icon: <DollarSign size={20} />,\n order: 23,\n group: 'business',\n },\n\n // Financier portfolio (B2B2C bridge)\n {\n id: 'healthybowl-financier',\n label: t('healthybowl.nav.financier', 'Financier'),\n path: joinPath(basePath, 'financier'),\n icon: <Banknote size={20} />,\n order: 24,\n group: 'business',\n },\n\n // Compliance\n {\n id: 'healthybowl-compliance',\n label: t('healthybowl.nav.compliance', 'Compliance'),\n path: joinPath(basePath, 'compliance'),\n icon: <ShieldCheck size={20} />,\n order: 30,\n group: 'compliance',\n },\n\n // Traceability\n {\n id: 'healthybowl-traceability',\n label: t('healthybowl.nav.traceability', 'Traceability'),\n path: joinPath(basePath, 'traceability'),\n icon: <ScanLine size={20} />,\n order: 31,\n group: 'compliance',\n },\n\n // Sustainability — Carbon & Climate (BOFF-2896)\n {\n id: 'healthybowl-sustainability',\n label: t('healthybowl.nav.sustainability', 'Sustainability'),\n path: joinPath(basePath, 'sustainability'),\n icon: <Leaf size={20} />,\n order: 32,\n group: 'compliance',\n },\n {\n id: 'healthybowl-sustainability-carbon',\n label: t('healthybowl.nav.sustainabilityCarbon', 'Carbon & GHG'),\n path: joinPath(basePath, 'sustainability/carbon'),\n icon: <Factory size={20} />,\n order: 32.1,\n group: 'compliance',\n },\n {\n id: 'healthybowl-sustainability-soil',\n label: t('healthybowl.nav.sustainabilitySoil', 'Soil Carbon'),\n path: joinPath(basePath, 'sustainability/soil-carbon'),\n icon: <Sprout size={20} />,\n order: 32.2,\n group: 'compliance',\n },\n {\n id: 'healthybowl-sustainability-credits',\n label: t('healthybowl.nav.sustainabilityCredits', 'Carbon Credits'),\n path: joinPath(basePath, 'sustainability/credits'),\n icon: <Award size={20} />,\n order: 32.3,\n group: 'compliance',\n },\n {\n id: 'healthybowl-sustainability-eudr',\n label: t('healthybowl.nav.sustainabilityEudr', 'EUDR Due-Diligence'),\n path: joinPath(basePath, 'sustainability/eudr'),\n icon: <Globe size={20} />,\n order: 32.4,\n group: 'compliance',\n },\n\n // Government Schemes\n {\n id: 'healthybowl-schemes',\n label: t('healthybowl.nav.governmentSchemes', 'Gov. Schemes'),\n path: joinPath(basePath, 'government-schemes'),\n icon: <Landmark size={20} />,\n order: 40,\n group: 'support',\n },\n\n // Network\n {\n id: 'healthybowl-network',\n label: t('healthybowl.nav.network', 'Network'),\n path: joinPath(basePath, 'network'),\n icon: <Users size={20} />,\n order: 41,\n group: 'support',\n },\n\n // Analytics\n {\n id: 'healthybowl-analytics',\n label: t('healthybowl.nav.analytics', 'Analytics'),\n path: joinPath(basePath, 'analytics'),\n icon: <BarChart3 size={20} />,\n order: 42,\n group: 'support',\n },\n\n // My Advisors (UC-16 — farmer side)\n {\n id: 'healthybowl-advisors',\n label: t('healthybowl.nav.advisors', 'My Advisors'),\n path: joinPath(basePath, 'advisors'),\n icon: <UserCheck size={20} />,\n order: 43,\n group: 'support',\n },\n\n // Consultant portfolio (UC-16 — consultant side)\n {\n id: 'healthybowl-consultant',\n label: t('healthybowl.nav.consultant', 'Consultant'),\n path: joinPath(basePath, 'consultant'),\n icon: <Stethoscope size={20} />,\n order: 44,\n group: 'support',\n },\n ];\n\n // All sections are reachable. Marketplace (UC-08), Network (UC-12) and\n // Traceability (UC-11) render real read data + their real create flows\n // (createMarketplaceProduct / createCommunityPost / createTraceBatch); the\n // few genuinely-unbacked actions (checkout, booking, QR resolution) show\n // honest \"not available yet\" states in-page rather than hiding the section.\n // The operational carbon kill switch hides only Sustainability items;\n // Compliance and Traceability remain available.\n const navItems = filterHealthyBowlNavItemsForCarbon(allNavItems, carbonEnabled);\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath, carbonEnabled, t]);\n\n // Register footer items\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'healthybowl-status',\n label: t('healthybowl.footer.ready', 'HealthyBowl Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems, t]);\n\n return (\n <HealthyBowlProvider {...props}>\n {/* Logical CSS utilities flip an icon's *position* under RTL, but not its glyph. Navigational\n arrows/chevrons must also point the other way, so mirror the horizontal ones. Vertical\n chevrons (up/down, e.g. accordions) are unaffected by scaleX. Scoped to [dir=rtl] so it is\n inert in LTR. See BOFF-6119. */}\n <style>{RTL_ICON_MIRROR_CSS}</style>\n <ErrorBoundary>\n <ConfirmProvider>\n <OfflineSyncProvider>\n <HealthyBowlRoutes />\n </OfflineSyncProvider>\n </ConfirmProvider>\n </ErrorBoundary>\n </HealthyBowlProvider>\n );\n};\n\nexport const HealthyBowlRoot: FC<HealthyBowlRootProps> = (props) => (\n <FeatureFlagProvider\n key={props.workspaceId ?? 'no-workspace'}\n workspaceId={props.workspaceId ?? null}\n gateway=\"global\"\n flagKeys={HEALTHYBOWL_CARBON_FEATURE_FLAG_KEYS}\n defaultEnabled={true}\n >\n <HealthyBowlRootContent {...props} />\n </FeatureFlagProvider>\n);\n"],"mappings":";;;;;;;;;;;;;AA2EA,IAAM,oBAAc,IAAI,IAAY,CAAC,CAAC,GAKhC,IAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EACG,KAAK,MAAM,eAAe,GAAG,EAC7B,KAAK,GAAG,EACR,OAAO,wBAAwB,GAE5B,IAA8B,IAAI,IAAI;CAC1C;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,EAAmC,GAAqB,GAAmC;CACzG,OAAO,IAAgB,IAAW,EAAS,QAAQ,MAAS,CAAC,EAA4B,IAAI,EAAK,EAAE,CAAC;AACvG;AAEA,IAAM,KAAoD,MAAU;CAClE,IAAM,EAAE,qBAAkB,wBAAqB,cAAW,QAAQ,GAC5D,EAAE,UAAO,mBAAe,kBAAc,EAAgB,GACtD,IAAgB,GACpB,GAAc,CAA+B,GAC7C,MAAa,MAAU,IACzB,GACM,EAAE,GAAG,GAAW,cAAW,GAAQ;CASzC,EAAkB,CAAM;CAUxB,IAAM,IAAqB,EAAY,IAAI,CAAM,IAAI,QAAQ;CAQ7D,QAAgB;EACd,IAAM,IAAK,SAAS,iBACd,IAAW,EAAG,aAAa,KAAK;EAEtC,OADA,EAAG,aAAa,OAAO,CAAG,SACb;GACX,AAAI,MAAa,OAAM,EAAG,gBAAgB,KAAK,IAC1C,EAAG,aAAa,OAAO,CAAQ;EACtC;CACF,GAAG,CAAC,CAAG,CAAC;CAER,IAAM,IAAI,IACP,GAAa,MAA6B;EACzC,IAAM,IAAQ,EAAU,CAAG;EAC3B,OAAO,MAAU,IAAM,IAAW;CACpC,GACA,CAAC,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AAD,EAAA,UACE,kBAAC,GAAD,CAAoB,CAAA,EACD,CAAA,EACN,CAAA,EACJ,CAAA,CACI;;AAEzB,GAEa,KAA6C,MACxD,kBAAC,GAAD;CAEE,aAAa,EAAM,eAAe;CAClC,SAAQ;CACR,UAAU;CACV,gBAAgB;WAEhB,kBAAC,GAAD,EAAwB,GAAI,EAAQ,CAAA;AACjB,GAPd,EAAM,eAAe,cAOP"}
|
|
1
|
+
{"version":3,"file":"HealthyBowlRoot.js","names":[],"sources":["../../src/healthybowl/HealthyBowlRoot.tsx"],"sourcesContent":["/**\n * HealthyBowl Root Component\n * @module healthybowl\n */\n\nimport type { FC } from 'react';\nimport { useCallback, useEffect } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n Home,\n Tractor,\n ListChecks,\n Wheat,\n PawPrint,\n Cloud,\n Map as MapIcon,\n HardHat,\n ShoppingCart,\n DollarSign,\n BarChart3,\n FlaskConical,\n Bug,\n ScanSearch,\n Factory,\n Package,\n ScanLine,\n ShieldCheck,\n Landmark,\n Banknote,\n Stethoscope,\n UserCheck,\n Users,\n CloudUpload,\n RefreshCw,\n ShieldAlert,\n LineChart,\n Fence,\n Radio,\n Leaf,\n Sprout,\n Award,\n Globe,\n Users2,\n} from 'lucide-react';\nimport { HealthyBowlProvider } from './context/HealthyBowlContext';\nimport { FeatureFlagProvider, useFeatureFlags } from '@burdenoff/fe-libs/shared/feature-flags';\nimport {\n HEALTHYBOWL_CARBON_FEATURE_FLAG,\n HEALTHYBOWL_CARBON_FEATURE_FLAG_KEYS,\n isHealthyBowlCarbonEnabled,\n} from './carbonFeatureFlag';\nimport { HealthyBowlRoutes } from './HealthyBowlRoutes';\nimport { ErrorBoundary } from './components/ErrorBoundary';\nimport { ConfirmProvider } from './components/ConfirmDialog';\nimport { OfflineSyncProvider } from './offline/OfflineSyncProvider';\nimport { HeaderOfflinePill } from './offline/HeaderOfflinePill';\nimport { normalizeBasePath, setHbFormatLocale } from './utils/helpers';\nimport type { HealthyBowlRootProps, NavItem } from './types';\n\n// Locales that render right-to-left.\n//\n// DELIBERATELY EMPTY — Arabic was removed here, reverting BOFF-6119's rendering decision.\n//\n// BOFF-6119 migrated *this package* to logical CSS utilities (461 logical vs 54 physical) and then\n// set `dir` on `document.documentElement`. But the document root is not this package's to mirror:\n// the surrounding shell is `fe-libs` (177 physical utilities, 0 logical) and `healthybowl-app`\n// (7 physical, 0 logical). Neither is migrated, so `dir=\"rtl\"` mirrored them incorrectly and the\n// sidebar jumped to the right — which is what the layout complaint was about.\n//\n// fe-libs documents this exact failure mode and refuses to set `dir` for ANY locale until the\n// fleet-wide migration lands (see its I18nProvider note + BOFF-5998: \"sidebars on the wrong side,\n// icons mirrored, chevrons reversed\"). HealthyBowl was the only surface on the fleet setting it,\n// so Arabic rendered differently here than in every other product.\n//\n// Keeping the Set (rather than deleting the mechanism) so BOFF-6119 can be restored as a one-line\n// change once BOFF-5998 migrates the shell. Re-adding 'ar' before then reintroduces the bug.\nconst RTL_LOCALES = new Set<string>([]);\n\n// Horizontal directional lucide icons whose glyph must point the other way under RTL. lucide-react\n// tags every icon with a `lucide-<name>` class; scaleX(-1) mirrors the horizontal ones (vertical\n// chevrons up/down are unchanged by a horizontal flip). Kept off the LTR path via the [dir=rtl] scope.\nconst RTL_ICON_MIRROR_CSS = [\n '.lucide-arrow-right',\n '.lucide-arrow-left',\n '.lucide-chevron-right',\n '.lucide-chevron-left',\n '.lucide-chevrons-right',\n '.lucide-chevrons-left',\n '.lucide-move-right',\n '.lucide-move-left',\n]\n .map((c) => `[dir=\"rtl\"] ${c}`)\n .join(',')\n .concat('{transform:scaleX(-1)}');\n\nconst SUSTAINABILITY_NAV_ITEM_IDS = new Set([\n 'healthybowl-sustainability',\n 'healthybowl-sustainability-carbon',\n 'healthybowl-sustainability-soil',\n 'healthybowl-sustainability-credits',\n 'healthybowl-sustainability-eudr',\n]);\n\nexport function filterHealthyBowlNavItemsForCarbon(navItems: NavItem[], carbonEnabled: boolean): NavItem[] {\n return carbonEnabled ? navItems : navItems.filter((item) => !SUSTAINABILITY_NAV_ITEM_IDS.has(item.id));\n}\n\nconst HealthyBowlRootContent: FC<HealthyBowlRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const { error, getEvaluation, isLoading } = useFeatureFlags();\n const carbonEnabled = isHealthyBowlCarbonEnabled(\n getEvaluation(HEALTHYBOWL_CARBON_FEATURE_FLAG),\n isLoading || error !== null\n );\n const { t: translate, locale } = useI18n();\n\n // HealthyBowl's Intl.* formatters (utils/helpers.ts) are plain functions used\n // across ~490 call sites, so they can't call useI18n() themselves. Sync the\n // shell's active language into their ambient locale here — the product's\n // single I18n consumer that wraps every page — so number / currency / date\n // grouping tracks the chosen language (BOFF-6202). Done during render, not in\n // an effect, so children rendered in this same pass already format with the\n // current locale (no one-frame western-grouping flash on a language switch).\n setHbFormatLocale(locale);\n\n // BOFF-6119 wired RTL rendering here. `RTL_LOCALES` is now empty, so this resolves to 'ltr' for\n // every locale and the effect below writes dir=\"ltr\" — matching fe-libs and every other product.\n //\n // The original claim on this line was that \"HealthyBowl's own components are migrated to logical\n // CSS utilities, so setting `dir` makes the whole HB surface mirror correctly.\" Only the first\n // half held: this package is ~90% logical, but `dir` is set on the DOCUMENT ROOT (see below), so\n // it also mirrors fe-libs (177 physical / 0 logical) and healthybowl-app (7 / 0). \"The whole HB\n // surface\" is bigger than this package, and the rest of it was never migrated.\n const dir: 'rtl' | 'ltr' = RTL_LOCALES.has(locale) ? 'rtl' : 'ltr';\n\n // Set the direction on the document root, not just an in-flow wrapper: HB's overlays\n // (confirm/alert dialogs, dropdowns, tooltips) render through Radix portals attached to\n // document.body, so a subtree wrapper would leave them LTR. The shared fe-libs I18nProvider\n // deliberately leaves document.dir unset (the app shell and other products aren't migrated to\n // logical CSS yet — fleet ticket BOFF-5998), so HB owns it here and restores the previous value\n // on unmount, keeping the effect self-contained to when a HealthyBowl surface is mounted.\n useEffect(() => {\n const el = document.documentElement;\n const previous = el.getAttribute('dir');\n el.setAttribute('dir', dir);\n return () => {\n if (previous === null) el.removeAttribute('dir');\n else el.setAttribute('dir', previous);\n };\n }, [dir]);\n\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n\n // Helper to join paths correctly\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with shell on mount\n useEffect(() => {\n if (!registerNavItems) return;\n\n const allNavItems: NavItem[] = [\n // Dashboard\n {\n id: 'healthybowl-dashboard',\n label: t('healthybowl.nav.dashboard', 'Dashboard'),\n // The product index IS the dashboard. Normalize a trailing slash like\n // every sibling item (joinPath) so active-state highlighting matches if\n // the host ever passes '/healthybowl/'.\n path: normalizeBasePath(basePath),\n icon: <Home size={20} />,\n order: 1,\n group: 'main',\n },\n\n // My Farm\n {\n id: 'healthybowl-farm',\n label: t('healthybowl.nav.farm', 'My Farm'),\n path: joinPath(basePath, 'farm'),\n icon: <Tractor size={20} />,\n order: 2,\n group: 'main',\n },\n\n // Farm Tasks (PlanMagnet embed) — shared work-item board across the farm.\n {\n id: 'healthybowl-tasks',\n label: t('healthybowl.nav.tasks', 'Tasks'),\n path: joinPath(basePath, 'tasks'),\n icon: <ListChecks size={20} />,\n order: 3,\n group: 'main',\n },\n\n // Crops\n {\n id: 'healthybowl-crops',\n label: t('healthybowl.nav.crops', 'Crops'),\n path: joinPath(basePath, 'crops'),\n icon: <Wheat size={20} />,\n order: 10,\n group: 'farming',\n },\n\n // Livestock\n {\n id: 'healthybowl-livestock',\n label: t('healthybowl.nav.livestock', 'Livestock'),\n path: joinPath(basePath, 'livestock'),\n icon: <PawPrint size={20} />,\n order: 11,\n group: 'farming',\n },\n\n // Livestock — Analytics (BOFF-6126). The growth, feed and herd-stats charts (BOFF-5971) also\n // render inline on the livestock dashboard; this gives them a dedicated URL and full-width home.\n {\n id: 'healthybowl-livestock-analytics',\n label: t('healthybowl.nav.livestockAnalytics', 'Livestock Analytics'),\n path: joinPath(basePath, 'livestock/analytics'),\n icon: <LineChart size={20} />,\n order: 11.3,\n group: 'farming',\n },\n\n // Livestock — Grazing management (BOFF-5970). Sits next to Livestock rather than inside it\n // because rotational grazing is a daily decision about FIELDS, not a herd-record lookup.\n {\n id: 'healthybowl-grazing',\n label: t('healthybowl.nav.grazing', 'Grazing'),\n path: joinPath(basePath, 'livestock/grazing'),\n icon: <Fence size={20} />,\n order: 11.4,\n group: 'farming',\n },\n\n // Livestock — Medication Withdrawal Alerts (BOFF-2885)\n {\n id: 'healthybowl-withdrawal-alerts',\n label: t('healthybowl.nav.withdrawalAlerts', 'Withdrawal Alerts'),\n path: joinPath(basePath, 'livestock/withdrawal-alerts'),\n icon: <ShieldAlert size={20} />,\n order: 11.5,\n group: 'farming',\n },\n\n // Weather\n {\n id: 'healthybowl-weather',\n label: t('healthybowl.nav.weather', 'Weather'),\n path: joinPath(basePath, 'weather'),\n icon: <Cloud size={20} />,\n order: 12,\n group: 'farming',\n },\n\n // Field Map — draw & manage field boundaries on satellite imagery\n {\n id: 'healthybowl-field-map',\n label: t('healthybowl.nav.fieldMap', 'Field Map'),\n path: joinPath(basePath, 'field-map'),\n icon: <MapIcon size={20} />,\n order: 12.5,\n group: 'farming',\n },\n\n // Field Capture — offline-first observation capture (BOFF-2883)\n {\n id: 'healthybowl-field-capture',\n label: t('healthybowl.nav.fieldCapture', 'Field Capture'),\n path: joinPath(basePath, 'field-capture'),\n icon: <CloudUpload size={20} />,\n order: 12.6,\n group: 'farming',\n },\n\n // Pending Sync — the offline outbox / sync queue (BOFF-2883)\n {\n id: 'healthybowl-pending-sync',\n label: t('healthybowl.nav.pendingSync', 'Pending Sync'),\n path: joinPath(basePath, 'field-capture/pending'),\n icon: <RefreshCw size={20} />,\n order: 12.7,\n group: 'farming',\n },\n\n // Field Sensors — live probe monitoring (BOFF-2894)\n {\n id: 'healthybowl-field-sensors',\n label: t('healthybowl.nav.fieldSensors', 'Field Sensors'),\n path: joinPath(basePath, 'field-sensors'),\n icon: <Radio size={20} />,\n order: 12.75,\n group: 'farming',\n },\n\n // Soil Health\n {\n id: 'healthybowl-soil',\n label: t('healthybowl.nav.soilHealth', 'Soil Health'),\n path: joinPath(basePath, 'soil'),\n icon: <FlaskConical size={20} />,\n order: 13,\n group: 'farming',\n },\n\n // Pest Management\n {\n id: 'healthybowl-pest',\n label: t('healthybowl.nav.pestManagement', 'Pest Management'),\n path: joinPath(basePath, 'pest-management'),\n icon: <Bug size={20} />,\n order: 14,\n group: 'farming',\n },\n {\n id: 'healthybowl-pest-ai',\n label: t('healthybowl.nav.aiPestDetection', 'AI Pest Detection'),\n path: joinPath(basePath, 'pest-management/ai-detection'),\n icon: <ScanSearch size={20} />,\n order: 14.5,\n group: 'farming',\n },\n\n // Production\n {\n id: 'healthybowl-production',\n label: t('healthybowl.nav.production', 'Production'),\n path: joinPath(basePath, 'production'),\n icon: <Factory size={20} />,\n order: 20,\n group: 'business',\n },\n\n // Products\n {\n id: 'healthybowl-products',\n label: t('healthybowl.nav.products', 'Products'),\n path: joinPath(basePath, 'products'),\n icon: <Package size={20} />,\n order: 21,\n group: 'business',\n },\n\n // Marketplace\n {\n id: 'healthybowl-marketplace',\n label: t('healthybowl.nav.marketplace', 'Marketplace'),\n path: joinPath(basePath, 'marketplace'),\n icon: <ShoppingCart size={20} />,\n order: 22,\n group: 'business',\n },\n\n // Labour, crews and timesheets (BOFF-6024). Sits between Marketplace (22) and Co-operative,\n // in the business group, because its output lands on the financial pages next to it.\n {\n id: 'healthybowl-labour',\n label: t('healthybowl.nav.labour', 'Labour'),\n path: joinPath(basePath, 'labour'),\n icon: <HardHat size={20} />,\n order: 22.5,\n group: 'business',\n },\n\n // Co-operative / FPO aggregation (BOFF-6023)\n {\n id: 'healthybowl-coop',\n label: t('healthybowl.nav.coop', 'Co-operative'),\n path: joinPath(basePath, 'coop'),\n icon: <Users2 size={20} />,\n order: 22.5,\n group: 'business',\n },\n\n // Financial\n {\n id: 'healthybowl-financial',\n label: t('healthybowl.nav.financial', 'Financial'),\n path: joinPath(basePath, 'financial'),\n icon: <DollarSign size={20} />,\n order: 23,\n group: 'business',\n },\n\n // Financier portfolio (B2B2C bridge)\n {\n id: 'healthybowl-financier',\n label: t('healthybowl.nav.financier', 'Financier'),\n path: joinPath(basePath, 'financier'),\n icon: <Banknote size={20} />,\n order: 24,\n group: 'business',\n },\n\n // Compliance\n {\n id: 'healthybowl-compliance',\n label: t('healthybowl.nav.compliance', 'Compliance'),\n path: joinPath(basePath, 'compliance'),\n icon: <ShieldCheck size={20} />,\n order: 30,\n group: 'compliance',\n },\n\n // Traceability\n {\n id: 'healthybowl-traceability',\n label: t('healthybowl.nav.traceability', 'Traceability'),\n path: joinPath(basePath, 'traceability'),\n icon: <ScanLine size={20} />,\n order: 31,\n group: 'compliance',\n },\n\n // Sustainability — Carbon & Climate (BOFF-2896)\n {\n id: 'healthybowl-sustainability',\n label: t('healthybowl.nav.sustainability', 'Sustainability'),\n path: joinPath(basePath, 'sustainability'),\n icon: <Leaf size={20} />,\n order: 32,\n group: 'compliance',\n },\n {\n id: 'healthybowl-sustainability-carbon',\n label: t('healthybowl.nav.sustainabilityCarbon', 'Carbon & GHG'),\n path: joinPath(basePath, 'sustainability/carbon'),\n icon: <Factory size={20} />,\n order: 32.1,\n group: 'compliance',\n },\n {\n id: 'healthybowl-sustainability-soil',\n label: t('healthybowl.nav.sustainabilitySoil', 'Soil Carbon'),\n path: joinPath(basePath, 'sustainability/soil-carbon'),\n icon: <Sprout size={20} />,\n order: 32.2,\n group: 'compliance',\n },\n {\n id: 'healthybowl-sustainability-credits',\n label: t('healthybowl.nav.sustainabilityCredits', 'Carbon Credits'),\n path: joinPath(basePath, 'sustainability/credits'),\n icon: <Award size={20} />,\n order: 32.3,\n group: 'compliance',\n },\n {\n id: 'healthybowl-sustainability-eudr',\n label: t('healthybowl.nav.sustainabilityEudr', 'EUDR Due-Diligence'),\n path: joinPath(basePath, 'sustainability/eudr'),\n icon: <Globe size={20} />,\n order: 32.4,\n group: 'compliance',\n },\n\n // Government Schemes\n {\n id: 'healthybowl-schemes',\n label: t('healthybowl.nav.governmentSchemes', 'Gov. Schemes'),\n path: joinPath(basePath, 'government-schemes'),\n icon: <Landmark size={20} />,\n order: 40,\n group: 'support',\n },\n\n // Network\n {\n id: 'healthybowl-network',\n label: t('healthybowl.nav.network', 'Network'),\n path: joinPath(basePath, 'network'),\n icon: <Users size={20} />,\n order: 41,\n group: 'support',\n },\n\n // Analytics\n {\n id: 'healthybowl-analytics',\n label: t('healthybowl.nav.analytics', 'Analytics'),\n path: joinPath(basePath, 'analytics'),\n icon: <BarChart3 size={20} />,\n order: 42,\n group: 'support',\n },\n\n // My Advisors (UC-16 — farmer side)\n {\n id: 'healthybowl-advisors',\n label: t('healthybowl.nav.advisors', 'My Advisors'),\n path: joinPath(basePath, 'advisors'),\n icon: <UserCheck size={20} />,\n order: 43,\n group: 'support',\n },\n\n // Consultant portfolio (UC-16 — consultant side)\n {\n id: 'healthybowl-consultant',\n label: t('healthybowl.nav.consultant', 'Consultant'),\n path: joinPath(basePath, 'consultant'),\n icon: <Stethoscope size={20} />,\n order: 44,\n group: 'support',\n },\n ];\n\n // All sections are reachable. Marketplace (UC-08), Network (UC-12) and\n // Traceability (UC-11) render real read data + their real create flows\n // (createMarketplaceProduct / createCommunityPost / createTraceBatch); the\n // few genuinely-unbacked actions (checkout, booking, QR resolution) show\n // honest \"not available yet\" states in-page rather than hiding the section.\n // The operational carbon kill switch hides only Sustainability items;\n // Compliance and Traceability remain available.\n const navItems = filterHealthyBowlNavItemsForCarbon(allNavItems, carbonEnabled);\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath, carbonEnabled, t]);\n\n // Register footer items\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'healthybowl-status',\n label: t('healthybowl.footer.ready', 'HealthyBowl Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems, t]);\n\n return (\n <HealthyBowlProvider {...props}>\n {/* Logical CSS utilities flip an icon's *position* under RTL, but not its glyph. Navigational\n arrows/chevrons must also point the other way, so mirror the horizontal ones. Vertical\n chevrons (up/down, e.g. accordions) are unaffected by scaleX. Scoped to [dir=rtl] so it is\n inert in LTR. See BOFF-6119. */}\n <style>{RTL_ICON_MIRROR_CSS}</style>\n <ErrorBoundary>\n <ConfirmProvider>\n <OfflineSyncProvider>\n {/* Portals the connectivity pill into the shell's top bar. Must sit INSIDE the provider:\n the portal relocates the DOM node, not the React tree, so this is what keeps\n `useOfflineSync()` resolvable from a node rendered in the header. See BOFF-6185. */}\n <HeaderOfflinePill />\n <HealthyBowlRoutes />\n </OfflineSyncProvider>\n </ConfirmProvider>\n </ErrorBoundary>\n </HealthyBowlProvider>\n );\n};\n\nexport const HealthyBowlRoot: FC<HealthyBowlRootProps> = (props) => (\n <FeatureFlagProvider\n key={props.workspaceId ?? 'no-workspace'}\n workspaceId={props.workspaceId ?? null}\n gateway=\"global\"\n flagKeys={HEALTHYBOWL_CARBON_FEATURE_FLAG_KEYS}\n defaultEnabled={true}\n >\n <HealthyBowlRootContent {...props} />\n </FeatureFlagProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;AA4EA,IAAM,oBAAc,IAAI,IAAY,CAAC,CAAC,GAKhC,IAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EACG,KAAK,MAAM,eAAe,GAAG,EAC7B,KAAK,GAAG,EACR,OAAO,wBAAwB,GAE5B,IAA8B,IAAI,IAAI;CAC1C;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,GAAmC,GAAqB,GAAmC;CACzG,OAAO,IAAgB,IAAW,EAAS,QAAQ,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MAAM,EAAS,GAAU,UAAU;IACnC,MAAM,kBAAC,GAAD,EAAW,MAAM,GAAK,CAAA;IAC5B,OAAO;IACP,OAAO;GACT;GAGA;IACE,IAAI;IACJ,OAAO,EAAE,8BAA8B,YAAY;IACnD,MAAM,EAAS,GAAU,YAAY;IACrC,MAAM,kBAAC,IAAD,EAAa,MAAM,GAAK,CAAA;IAC9B,OAAO;IACP,OAAO;GACT;EAUkD,GAAa,CAChC,CAC1B;CACT,GAAG;EAAC;EAAkB;EAAU;EAAe;CAAC,CAAC,GAGjD,QAAgB;EACT,OAaL,OADgB,EAAoB,CATlC;GACE,IAAI;GACJ,OAAO,EAAE,4BAA4B,mBAAmB;GACxD,MAAM;GACN,OAAO;GACP,SAAS;EACX,CAGkC,CAC7B;CACT,GAAG,CAAC,GAAqB,CAAC,CAAC,GAGzB,kBAAC,GAAD;EAAqB,GAAI;YAAzB,CAKE,kBAAC,SAAD,EAAA,UAAQ,EAA2B,CAAA,GACnC,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UAAA,CAIE,kBAAC,IAAD,CAAoB,CAAA,GACpB,kBAAC,GAAD,CAAoB,CAAA,CACD,EAAA,CAAA,EACN,CAAA,EACJ,CAAA,CACI;;AAEzB,GAEa,KAA6C,MACxD,kBAAC,GAAD;CAEE,aAAa,EAAM,eAAe;CAClC,SAAQ;CACR,UAAU;CACV,gBAAgB;WAEhB,kBAAC,GAAD,EAAwB,GAAI,EAAQ,CAAA;AACjB,GAPd,EAAM,eAAe,cAOP"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { findHeaderStatusSlot as e, mutationsMayAffectSlot as t } from "./headerSlot.js";
|
|
2
|
+
import { OfflineStatusPill as n } from "./OfflineStatusPill.js";
|
|
3
|
+
import { useEffect as r, useState as i } from "react";
|
|
4
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
5
|
+
import { createPortal as o } from "react-dom";
|
|
6
|
+
//#region src/healthybowl/offline/HeaderOfflinePill.tsx
|
|
7
|
+
var s = () => {
|
|
8
|
+
let [s, c] = i(null);
|
|
9
|
+
return r(() => {
|
|
10
|
+
if (typeof document > "u") return;
|
|
11
|
+
let n = () => {
|
|
12
|
+
let t = e(document);
|
|
13
|
+
c((e) => e === t ? e : t);
|
|
14
|
+
};
|
|
15
|
+
n();
|
|
16
|
+
let r = new MutationObserver((e) => {
|
|
17
|
+
t(e) && n();
|
|
18
|
+
});
|
|
19
|
+
return r.observe(document.body, {
|
|
20
|
+
childList: !0,
|
|
21
|
+
subtree: !0
|
|
22
|
+
}), () => r.disconnect();
|
|
23
|
+
}, []), s ? o(/* @__PURE__ */ a(n, { compact: !0 }), s) : null;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { s as HeaderOfflinePill };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=HeaderOfflinePill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderOfflinePill.js","names":[],"sources":["../../../src/healthybowl/offline/HeaderOfflinePill.tsx"],"sourcesContent":["/**\n * The persistent top-bar connectivity pill (BOFF-6185).\n *\n * `OfflineStatusPill` shipped in BOFF-2883, but only ever rendered on the two Field Capture screens.\n * A farmer who lost signal on Crops, Livestock, Tasks or Harvest got no offline indication and no\n * queue depth — just the shell's transient \"Connection lost\" toast, which auto-dismisses, is not in\n * the top bar, and never says how many records are waiting. The whole point of the pill is to be\n * visible from wherever the work is happening, which is not the Field Capture page.\n *\n * This mounts the *same* pill into the shell's header via a portal. Not a fork: one component means\n * the banner and the header chip can never drift apart in wording, which matters because AC-3 is\n * literally \"the header pill's count always equals the waiting count on the pending page\".\n *\n * @module healthybowl\n */\nimport { useEffect, useState, type FC } from 'react';\nimport { createPortal } from 'react-dom';\nimport { OfflineStatusPill } from './OfflineStatusPill';\nimport { findHeaderStatusSlot, mutationsMayAffectSlot } from './headerSlot';\n\n/**\n * Renders the offline pill into the app shell's header slot, or nothing when there is no slot.\n *\n * Must be mounted *inside* `<OfflineSyncProvider>` — the portal moves the DOM node, not the React\n * tree, so the pill still reads this MFE's context. Mounting it in the shell instead would put it\n * outside the provider and throw.\n */\nexport const HeaderOfflinePill: FC = () => {\n const [slot, setSlot] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n if (typeof document === 'undefined') return;\n\n const resolve = () => {\n // Compared before setting so an unchanged slot does not re-render on every unrelated DOM\n // mutation in the app — this observer sees all of them.\n const found = findHeaderStatusSlot(document);\n setSlot((current) => (current === found ? current : found));\n };\n\n resolve();\n\n // The slot and this component can arrive in either order: the MFE chunk is lazy-loaded, and the\n // shell unmounts and remounts its entire header when `effectiveHeaderVisible` flips. A one-shot\n // lookup on mount would be a coin toss, and losing it would mean the pill silently never appears.\n const observer = new MutationObserver((mutations) => {\n if (mutationsMayAffectSlot(mutations)) resolve();\n });\n observer.observe(document.body, { childList: true, subtree: true });\n return () => observer.disconnect();\n }, []);\n\n // Null is the correct outcome on shell-less routes (public `/b/:slug` pages render no header).\n // Rendering nothing is the requirement — no pill, no gap, no console error.\n if (!slot) return null;\n\n return createPortal(<OfflineStatusPill compact />, slot);\n};\n"],"mappings":";;;;;;AA2BA,IAAa,UAA8B;CACzC,IAAM,CAAC,GAAM,KAAW,EAA6B,IAAI;CA4BzD,OA1BA,QAAgB;EACd,IAAI,OAAO,WAAa,KAAa;EAErC,IAAM,UAAgB;GAGpB,IAAM,IAAQ,EAAqB,QAAQ;GAC3C,GAAS,MAAa,MAAY,IAAQ,IAAU,CAAM;EAC5D;EAEA,EAAQ;EAKR,IAAM,IAAW,IAAI,kBAAkB,MAAc;GACnD,AAAI,EAAuB,CAAS,KAAG,EAAQ;EACjD,CAAC;EAED,OADA,EAAS,QAAQ,SAAS,MAAM;GAAE,WAAW;GAAM,SAAS;EAAK,CAAC,SACrD,EAAS,WAAW;CACnC,GAAG,CAAC,CAAC,GAIA,IAEE,EAAa,kBAAC,GAAD,EAAmB,SAAA,GAAS,CAAA,GAAG,CAAI,IAFrC;AAGpB"}
|
|
@@ -1,30 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { useBasePath as e } from "../hooks/useBasePath.js";
|
|
2
|
+
import { useOfflineSync as t } from "./OfflineSyncProvider.js";
|
|
3
|
+
import { relativeTime as n } from "./observationMeta.js";
|
|
4
|
+
import { compactLabel as r } from "./headerSlot.js";
|
|
5
|
+
import { AlertTriangle as i, CheckCircle2 as a, RefreshCw as o, Wifi as s, WifiOff as c } from "lucide-react";
|
|
6
|
+
import { Link as l } from "react-router";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
8
|
//#region src/healthybowl/offline/OfflineStatusPill.tsx
|
|
6
|
-
var
|
|
7
|
-
let { online:
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
var f = ({ inline: f, compact: p, className: m }) => {
|
|
10
|
+
let { buildPath: h } = e(), { online: g, syncing: _, queuedCount: v, conflictCount: y, lastSyncedAt: b, syncNow: x } = t(), S = !g, C = v > 0, w = "ok";
|
|
11
|
+
S ? w = "offline" : (C || y > 0) && (w = "warning");
|
|
12
|
+
let T = w === "offline" || w === "warning" ? "bg-status-warning-bgSubtle text-status-warning-text border-status-warning-border" : "bg-status-success-bgSubtle text-status-success-text border-status-success-border", E = S ? c : y > 0 ? i : C ? s : a, D;
|
|
13
|
+
D = S ? C ? `Offline — ${v} record${v > 1 ? "s" : ""} queued` : "Offline — working locally" : _ ? "Online — syncing…" : y > 0 ? `Online — ${y} conflict${y > 1 ? "s" : ""} to review` : C ? `Online — ${v} record${v > 1 ? "s" : ""} queued` : b ? `Online — all synced · last synced ${n(b)}` : "Online — all synced";
|
|
14
|
+
let O = /* @__PURE__ */ d("button", {
|
|
15
|
+
type: "button",
|
|
16
|
+
onClick: () => void x({ manual: !0 }),
|
|
17
|
+
disabled: _ || !g,
|
|
18
|
+
title: g ? "Sync now" : "Reconnect to sync",
|
|
19
|
+
className: `inline-flex shrink-0 items-center gap-1.5 rounded-lg bg-bg-surface px-2.5 py-1 text-xs font-semibold text-text-primary shadow-sm ring-1 ring-border-subtle transition hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50 ${p ? "hidden lg:inline-flex" : ""}`,
|
|
20
|
+
children: [/* @__PURE__ */ u(o, { className: `h-3.5 w-3.5 ${_ ? "animate-spin" : ""}` }), "Sync Now"]
|
|
21
|
+
});
|
|
22
|
+
return p ? /* @__PURE__ */ d("div", {
|
|
23
|
+
className: `flex max-w-[13rem] items-center gap-2 rounded-full border px-3 py-1 xl:max-w-[22rem] ${T} ${m ?? ""}`,
|
|
24
|
+
role: "status",
|
|
25
|
+
"aria-live": "polite",
|
|
26
|
+
children: [/* @__PURE__ */ d(l, {
|
|
27
|
+
to: h("field-capture/pending"),
|
|
28
|
+
title: D,
|
|
29
|
+
"aria-label": D,
|
|
30
|
+
className: "flex min-w-0 flex-1 items-center gap-2 text-left transition hover:opacity-90",
|
|
31
|
+
children: [/* @__PURE__ */ u(E, { className: "h-4 w-4 shrink-0" }), /* @__PURE__ */ u("span", {
|
|
32
|
+
className: "truncate text-xs font-medium",
|
|
33
|
+
children: r(D)
|
|
34
|
+
})]
|
|
35
|
+
}), O]
|
|
36
|
+
}) : /* @__PURE__ */ d("div", {
|
|
37
|
+
className: `flex items-center justify-between gap-3 rounded-xl border px-3.5 py-2 ${T} ${f ? "" : "shadow-sm"} ${m ?? ""}`,
|
|
12
38
|
role: "status",
|
|
13
39
|
"aria-live": "polite",
|
|
14
|
-
children: [/* @__PURE__ */
|
|
40
|
+
children: [/* @__PURE__ */ d("span", {
|
|
15
41
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
16
|
-
children: [/* @__PURE__ */
|
|
17
|
-
}),
|
|
18
|
-
type: "button",
|
|
19
|
-
onClick: () => void g({ manual: !0 }),
|
|
20
|
-
disabled: f || !d && !0,
|
|
21
|
-
title: d ? "Sync now" : "Reconnect to sync",
|
|
22
|
-
className: "inline-flex shrink-0 items-center gap-1.5 rounded-lg bg-bg-surface px-2.5 py-1 text-xs font-semibold text-text-primary shadow-sm ring-1 ring-border-subtle transition hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50",
|
|
23
|
-
children: [/* @__PURE__ */ s(i, { className: `h-3.5 w-3.5 ${f ? "animate-spin" : ""}` }), "Sync Now"]
|
|
24
|
-
})]
|
|
42
|
+
children: [/* @__PURE__ */ u(E, { className: "h-4 w-4 shrink-0" }), D]
|
|
43
|
+
}), O]
|
|
25
44
|
});
|
|
26
45
|
};
|
|
27
46
|
//#endregion
|
|
28
|
-
export {
|
|
47
|
+
export { f as OfflineStatusPill };
|
|
29
48
|
|
|
30
49
|
//# sourceMappingURL=OfflineStatusPill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OfflineStatusPill.js","names":[],"sources":["../../../src/healthybowl/offline/OfflineStatusPill.tsx"],"sourcesContent":["/**\n * Offline status pill (BOFF-2883).\n *\n * A persistent, honest connectivity indicator: reflects the REAL network state\n * and the REAL queue depth.
|
|
1
|
+
{"version":3,"file":"OfflineStatusPill.js","names":[],"sources":["../../../src/healthybowl/offline/OfflineStatusPill.tsx"],"sourcesContent":["/**\n * Offline status pill (BOFF-2883, header variant BOFF-6185).\n *\n * A persistent, honest connectivity indicator: reflects the REAL network state\n * and the REAL queue depth. Rendered as a sticky banner on the Field Capture\n * screens and, via {@link HeaderOfflinePill}, as a compact chip in the app\n * shell's top bar. Includes a manual \"Sync Now\".\n *\n * One component serves both placements deliberately. Forking would let the\n * banner and the header chip drift apart in wording or arithmetic, and the\n * whole value of the header pill is that a farmer can trust it says the same\n * thing the Pending Sync screen does.\n *\n * @module healthybowl\n */\nimport type { FC } from 'react';\nimport { Link } from 'react-router';\nimport { Wifi, WifiOff, RefreshCw, CheckCircle2, AlertTriangle } from 'lucide-react';\nimport { useOfflineSync } from './OfflineSyncProvider';\nimport { relativeTime } from './observationMeta';\nimport { useBasePath } from '../hooks/useBasePath';\nimport { compactLabel } from './headerSlot';\n\ninterface Props {\n /** Compact inline pill (no full-width banner chrome). */\n inline?: boolean;\n /**\n * Header-chip variant: bounded width, truncated label, \"Sync Now\" hidden below `lg`, and the\n * whole pill navigates to Pending Sync. Everything the farmer needs to *act* is one tap away\n * rather than crammed into a bar that already holds eight controls.\n */\n compact?: boolean;\n className?: string;\n}\n\nexport const OfflineStatusPill: FC<Props> = ({ inline, compact, className }) => {\n const { buildPath } = useBasePath();\n const { online, syncing, queuedCount, conflictCount, lastSyncedAt, syncNow } = useOfflineSync();\n\n const offline = !online;\n const hasQueue = queuedCount > 0;\n\n let tone: 'offline' | 'warning' | 'ok' = 'ok';\n if (offline) tone = 'offline';\n else if (hasQueue || conflictCount > 0) tone = 'warning';\n\n const toneClasses =\n tone === 'offline'\n ? 'bg-status-warning-bgSubtle text-status-warning-text border-status-warning-border'\n : tone === 'warning'\n ? 'bg-status-warning-bgSubtle text-status-warning-text border-status-warning-border'\n : 'bg-status-success-bgSubtle text-status-success-text border-status-success-border';\n\n const Icon = offline ? WifiOff : conflictCount > 0 ? AlertTriangle : hasQueue ? Wifi : CheckCircle2;\n\n let label: string;\n if (offline) {\n label = hasQueue\n ? `Offline — ${queuedCount} record${queuedCount > 1 ? 's' : ''} queued`\n : 'Offline — working locally';\n } else if (syncing) {\n label = 'Online — syncing…';\n } else if (conflictCount > 0) {\n label = `Online — ${conflictCount} conflict${conflictCount > 1 ? 's' : ''} to review`;\n } else if (hasQueue) {\n label = `Online — ${queuedCount} record${queuedCount > 1 ? 's' : ''} queued`;\n } else {\n label = lastSyncedAt ? `Online — all synced · last synced ${relativeTime(lastSyncedAt)}` : 'Online — all synced';\n }\n\n const syncButton = (\n <button\n type=\"button\"\n onClick={() => void syncNow({ manual: true })}\n disabled={syncing || !online}\n title={online ? 'Sync now' : 'Reconnect to sync'}\n className={`inline-flex shrink-0 items-center gap-1.5 rounded-lg bg-bg-surface px-2.5 py-1 text-xs font-semibold text-text-primary shadow-sm ring-1 ring-border-subtle transition hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50 ${\n // Below lg the header collapses to icons; the mobile mockup keeps the label and drops the\n // button, so the label survives the squeeze rather than the action.\n compact ? 'hidden lg:inline-flex' : ''\n }`}\n >\n <RefreshCw className={`h-3.5 w-3.5 ${syncing ? 'animate-spin' : ''}`} />\n Sync Now\n </button>\n );\n\n if (compact) {\n return (\n // Link and button are SIBLINGS inside a plain container, not nested. The HTML content model\n // for `<a>` excludes interactive content, so a button inside the link would be as invalid as\n // the button-inside-button it replaced — validators flag it and assistive tech may restructure\n // the tree. As siblings both keep their real semantics, and clicking \"Sync Now\" cannot\n // navigate, so no event-propagation trickery is needed either.\n //\n // `role=\"status\"` belongs on this wrapper rather than the link: on the `<a>` it would override\n // the implicit `link` role, and the pill would be announced as a live region a screen-reader\n // user cannot tell is activatable.\n <div\n className={`flex max-w-[13rem] items-center gap-2 rounded-full border px-3 py-1 xl:max-w-[22rem] ${toneClasses} ${className ?? ''}`}\n role=\"status\"\n aria-live=\"polite\"\n >\n <Link\n to={buildPath('field-capture/pending')}\n // The full sentence lives here even when the visible text is clipped, so hover and\n // assistive tech both get the whole story rather than the truncated half.\n //\n // There is no generic conflict route — one exists per record — so a conflict lands on\n // Pending Sync, whose row opens the review screen.\n title={label}\n aria-label={label}\n className=\"flex min-w-0 flex-1 items-center gap-2 text-left transition hover:opacity-90\"\n >\n <Icon className=\"h-4 w-4 shrink-0\" />\n <span className=\"truncate text-xs font-medium\">{compactLabel(label)}</span>\n </Link>\n {syncButton}\n </div>\n );\n }\n\n return (\n <div\n className={`flex items-center justify-between gap-3 rounded-xl border px-3.5 py-2 ${toneClasses} ${\n inline ? '' : 'shadow-sm'\n } ${className ?? ''}`}\n role=\"status\"\n aria-live=\"polite\"\n >\n <span className=\"flex items-center gap-2 text-sm font-medium\">\n <Icon className=\"h-4 w-4 shrink-0\" />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MAKP,kBAAC,OAAD;EACE,WAAW,yEAAyE,EAAY,GAC9F,IAAS,KAAK,YACf,GAAG,KAAa;EACjB,MAAK;EACL,aAAU;YALZ,CAOE,kBAAC,QAAD;GAAM,WAAU;aAAhB,CACE,kBAAC,GAAD,EAAM,WAAU,mBAAoB,CAAA,GACnC,CACG;MACL,CACE;;AAET"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/healthybowl/offline/headerSlot.ts
|
|
2
|
+
var e = "hb-header-status-slot";
|
|
3
|
+
function t(t) {
|
|
4
|
+
return t ? t.getElementById(e) : null;
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
for (let t of e) if (t.type === "childList" && (t.addedNodes.length > 0 || t.removedNodes.length > 0)) return !0;
|
|
8
|
+
return !1;
|
|
9
|
+
}
|
|
10
|
+
function r(e, t = 40) {
|
|
11
|
+
let n = e.trim();
|
|
12
|
+
if (n.length <= t) return n;
|
|
13
|
+
let r = n.indexOf(" · ");
|
|
14
|
+
if (r > 0) {
|
|
15
|
+
let e = n.slice(0, r).trimEnd();
|
|
16
|
+
if (e.length <= t) return e;
|
|
17
|
+
}
|
|
18
|
+
let i = n.slice(0, t), a = i.lastIndexOf(" ");
|
|
19
|
+
return `${(a > t - 12 ? i.slice(0, a) : i).trimEnd()}…`;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { r as compactLabel, t as findHeaderStatusSlot, n as mutationsMayAffectSlot };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=headerSlot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headerSlot.js","names":[],"sources":["../../../src/healthybowl/offline/headerSlot.ts"],"sourcesContent":["/**\n * Resolving the app shell's header status slot (BOFF-6185) — pure, so it unit-tests without React.\n *\n * The pill has to render inside the shell's `<HeaderBar>`, which lives *above* this MFE in the React\n * tree: `App.tsx` renders `<AppShell>{children}</AppShell>`, and `HealthyBowlRoot` is one of those\n * children. Calling `useOfflineSync()` from the shell's own `Header.tsx` would therefore throw —\n * the provider is not an ancestor there.\n *\n * `createPortal` is the way out: it relocates the DOM node without moving the React tree, so the\n * pill keeps this MFE's context and `syncNow` while appearing in the header. The only thing needed\n * from the shell is an empty div to portal into.\n *\n * The awkward part is timing, which is what this module exists for. The slot and the MFE can settle\n * in either order — the MFE chunk is lazy, and the shell unmounts and remounts its whole header when\n * `effectiveHeaderVisible` flips — so a one-shot `getElementById` on mount is a coin toss.\n *\n * @module healthybowl\n */\n\n/**\n * The id the app shell renders into.\n *\n * **Cross-repo contract.** The other half is `healthybowl-app`\n * `src/components/chrome/Header.tsx`, which renders `<div id=\"hb-header-status-slot\" />`. If either\n * side is renamed the portal silently finds nothing and the pill simply never appears — no error,\n * no warning, which is precisely the failure mode BOFF-6185 exists to fix. Both sides carry a\n * comment naming the other, and the unit test below pins this literal so a rename here breaks a\n * test rather than production.\n */\nexport const HEADER_STATUS_SLOT_ID = 'hb-header-status-slot';\n\n/**\n * The slot element, or null when the shell has not rendered one.\n *\n * Null is a normal, expected answer — not a failure. Shell-less routes (`/b/:slug` public pages)\n * render no header at all, and the pill must simply not appear rather than error.\n */\nexport function findHeaderStatusSlot(doc: Pick<Document, 'getElementById'> | null | undefined): HTMLElement | null {\n if (!doc) return null;\n return doc.getElementById(HEADER_STATUS_SLOT_ID);\n}\n\n/**\n * Does this DOM mutation batch warrant re-resolving the slot?\n *\n * A `MutationObserver` on `document.body` fires for every render anywhere in the app — a table\n * re-sorting, a toast appearing. Re-querying on each one is wasteful, so the observer callback asks\n * this first: only added or removed nodes can change whether the slot exists, and attribute or text\n * changes never can.\n */\nexport function mutationsMayAffectSlot(mutations: readonly MutationRecord[]): boolean {\n for (const mutation of mutations) {\n if (mutation.type === 'childList' && (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The pill's label, trimmed for a header that already holds eight controls.\n *\n * Shortening happens by dropping the *secondary clause*, not by chopping characters. Every label is\n * built as `<state> · <detail>` — only \"Online — all synced · last synced 3 hours ago\" has a detail\n * half, and it is the half a farmer glancing at a header does not need. Cutting by length instead\n * would produce \"last synced 3…\", which reads as a truncated number rather than an omitted phrase.\n *\n * The state half is never abbreviated to a bare count: \"3\" beside a wifi icon does not say whether\n * three records are waiting or three failed. If a state clause were ever long enough to overflow,\n * CSS `truncate` handles it visually while `title`/`aria-label` keep the whole sentence.\n */\nexport function compactLabel(label: string, maxLength = 40): string {\n const trimmed = label.trim();\n if (trimmed.length <= maxLength) return trimmed;\n\n const separator = trimmed.indexOf(' · ');\n if (separator > 0) {\n const primary = trimmed.slice(0, separator).trimEnd();\n if (primary.length <= maxLength) return primary;\n }\n\n // No detail clause to drop, and still too long: cut at a word boundary near the limit so the\n // visible half stays readable rather than ending mid-word.\n const slice = trimmed.slice(0, maxLength);\n const lastSpace = slice.lastIndexOf(' ');\n const cut = lastSpace > maxLength - 12 ? slice.slice(0, lastSpace) : slice;\n return `${cut.trimEnd()}…`;\n}\n"],"mappings":";AA6BA,IAAa,IAAwB;AAQrC,SAAgB,EAAqB,GAA8E;CAEjH,OADK,IACE,EAAI,eAAe,CAAqB,IAD9B;AAEnB;AAUA,SAAgB,EAAuB,GAA+C;CACpF,KAAK,IAAM,KAAY,GACrB,IAAI,EAAS,SAAS,gBAAgB,EAAS,WAAW,SAAS,KAAK,EAAS,aAAa,SAAS,IACrG,OAAO;CAGX,OAAO;AACT;AAcA,SAAgB,EAAa,GAAe,IAAY,IAAY;CAClE,IAAM,IAAU,EAAM,KAAK;CAC3B,IAAI,EAAQ,UAAU,GAAW,OAAO;CAExC,IAAM,IAAY,EAAQ,QAAQ,KAAK;CACvC,IAAI,IAAY,GAAG;EACjB,IAAM,IAAU,EAAQ,MAAM,GAAG,CAAS,EAAE,QAAQ;EACpD,IAAI,EAAQ,UAAU,GAAW,OAAO;CAC1C;CAIA,IAAM,IAAQ,EAAQ,MAAM,GAAG,CAAS,GAClC,IAAY,EAAM,YAAY,GAAG;CAEvC,OAAO,IADK,IAAY,IAAY,KAAK,EAAM,MAAM,GAAG,CAAS,IAAI,GACvD,QAAQ,EAAE;AAC1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn as e } from "../../utils/helpers.js";
|
|
2
2
|
import { useOfflineSync as t } from "../../offline/OfflineSyncProvider.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { OBSERVATION_TYPES as n, typeMeta as r } from "../../offline/observationMeta.js";
|
|
4
|
+
import { captureGps as i, formatGps as a } from "../../offline/geolocation.js";
|
|
5
5
|
import { useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
6
6
|
import { Camera as d, Loader2 as f, MapPin as ee, WifiOff as te, X as p } from "lucide-react";
|
|
7
7
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
@@ -11,7 +11,7 @@ var C = () => {
|
|
|
11
11
|
let { fields: C, settings: w, capture: T, online: E } = t(), D = l(null), [O, k] = u("PEST"), [A, j] = u(""), [M, N] = u(""), [P, F] = u(""), [I, L] = u(""), [R, z] = u("kg"), [B, V] = u(""), [H, U] = u([]), [W, ne] = u(null), [re, G] = u(!1), [K, q] = u(!1), [ie, J] = u(!1), Y = c(() => C.find((e) => e.id === A), [C, A]), X = l(H);
|
|
12
12
|
X.current = H;
|
|
13
13
|
let Z = o(async () => {
|
|
14
|
-
w.autoStampGps && (G(!0), ne(await
|
|
14
|
+
w.autoStampGps && (G(!0), ne(await i({ highAccuracy: w.highAccuracyGps })), G(!1));
|
|
15
15
|
}, [w.autoStampGps, w.highAccuracyGps]);
|
|
16
16
|
s(() => {
|
|
17
17
|
Z();
|
|
@@ -101,13 +101,13 @@ var C = () => {
|
|
|
101
101
|
}),
|
|
102
102
|
/* @__PURE__ */ m("div", {
|
|
103
103
|
className: "flex flex-wrap gap-2",
|
|
104
|
-
children:
|
|
105
|
-
let n =
|
|
104
|
+
children: n.map((t) => {
|
|
105
|
+
let n = r(t), i = t === O, a = n.icon;
|
|
106
106
|
return /* @__PURE__ */ h("button", {
|
|
107
107
|
type: "button",
|
|
108
108
|
onClick: () => k(t),
|
|
109
|
-
className: e("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium transition",
|
|
110
|
-
children: [/* @__PURE__ */ m(
|
|
109
|
+
className: e("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium transition", i ? "border-transparent bg-action-primary-bg text-action-primary-text shadow-sm" : "border-border-subtle bg-bg-surface text-text-secondary hover:bg-bg-sunken"),
|
|
110
|
+
children: [/* @__PURE__ */ m(a, { className: "h-3.5 w-3.5" }), n.short]
|
|
111
111
|
}, t);
|
|
112
112
|
})
|
|
113
113
|
}),
|
|
@@ -235,7 +235,7 @@ var C = () => {
|
|
|
235
235
|
className: "flex items-center gap-1.5",
|
|
236
236
|
children: [/* @__PURE__ */ m(f, { className: "h-3.5 w-3.5 animate-spin" }), " Getting location…"]
|
|
237
237
|
}) : W ? /* @__PURE__ */ h("span", { children: [
|
|
238
|
-
|
|
238
|
+
a(W.latitude, W.longitude),
|
|
239
239
|
" ",
|
|
240
240
|
/* @__PURE__ */ h("span", {
|
|
241
241
|
className: "text-text-tertiary",
|
package/package.json
CHANGED