@burdenoff/microfe-healthybowl 2026.624.4 → 2026.624.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.
@@ -1,40 +1,35 @@
1
1
  import { formatDate as e } from "../../utils/helpers.js";
2
2
  import { useBasePath as t } from "../../hooks/useBasePath.js";
3
- import { PageLayout as n } from "../../components/PageLayout.js";
4
- import { StatusBadge as r } from "../../components/StatusBadge.js";
5
- import { EmptyState as ee } from "../../components/EmptyState.js";
6
- import { ErrorState as te } from "../../components/ErrorState.js";
7
- import { ToastContainer as ne } from "../../components/Toast.js";
8
- import { Breadcrumbs as re } from "../../components/Breadcrumbs.js";
9
- import { PageLoader as ie } from "../../components/PageLoader.js";
10
- import { Modal as i } from "../../components/Modal.js";
11
- import { HBEntityImages as a } from "../../components/HBEntityImages.js";
3
+ import { ToastContainer as n } from "../../components/Toast.js";
4
+ import { HBEntityImages as r } from "../../components/HBEntityImages.js";
12
5
  import "../../components/index.js";
13
- import { useHealthyBowlData as o } from "../../hooks/useHealthyBowlData.js";
14
- import { useToast as s } from "../../hooks/useToast.js";
15
- import { isNative as c, nativeConfirm as ae, nativeNotify as l, nativeToast as u } from "../../../utils/nativeBridge.js";
16
- import { useEffect as d, useRef as oe, useState as f } from "react";
17
- import { useI18n as se } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
18
- import { ArrowRight as ce, Calendar as p, Edit as m, Eye as h, MapPin as g, MoreVertical as le, Plus as _, Scissors as ue, Search as de, Sprout as v, Sun as fe, Trash2 as y, TrendingUp as b } from "lucide-react";
19
- import { useNavigate as pe } from "react-router-dom";
20
- import { Fragment as me, jsx as x, jsxs as S } from "react/jsx-runtime";
6
+ import { useHealthyBowlData as ee } from "../../hooks/useHealthyBowlData.js";
7
+ import { useToast as te } from "../../hooks/useToast.js";
8
+ import { isNative as i, nativeConfirm as ne, nativeNotify as a, nativeToast as o } from "../../../utils/nativeBridge.js";
9
+ import { useEffect as re, useState as s } from "react";
10
+ import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
11
+ import { AlertTriangle as ae, ArrowRight as oe, Calendar as c, Edit as l, Eye as u, MapPin as d, MoreVertical as se, Plus as f, Scissors as ce, Search as le, Sprout as p, Sun as ue, Trash2 as m, TrendingUp as h } from "lucide-react";
12
+ import { useNavigate as de } from "react-router-dom";
13
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
+ import { Badge as v, Button as y, Card as fe, CardContent as pe, CardHeader as b, DropdownMenu as me, DropdownMenuContent as he, DropdownMenuItem as x, DropdownMenuTrigger as ge, EmptyState as S, Input as C, PageContainer as _e, ResponsiveDialog as ve, ResponsiveDialogContent as ye, ResponsiveDialogDescription as be, ResponsiveDialogFooter as xe, ResponsiveDialogHeader as Se, ResponsiveDialogTitle as Ce, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O, Spinner as k } from "@burdenoff/fe-libs/ui";
15
+ import { PageHeader as A } from "@burdenoff/fe-libs/chrome";
21
16
  //#region src/healthybowl/pages/crops/CropsPage.tsx
22
- var he = (e) => {
17
+ var we = (e) => {
23
18
  switch (e) {
24
19
  case "excellent": return "success";
25
20
  case "good": return "info";
26
21
  case "fair": return "warning";
27
- default: return "error";
22
+ default: return "destructive";
28
23
  }
29
- }, ge = (e) => {
24
+ }, Te = (e) => {
30
25
  switch (e) {
31
26
  case "harvest_ready": return "success";
32
27
  case "growing":
33
28
  case "fruiting": return "info";
34
- case "planted": return "muted";
29
+ case "planted": return "secondary";
35
30
  default: return "default";
36
31
  }
37
- }, C = {
32
+ }, j = {
38
33
  name: "",
39
34
  variety: "",
40
35
  category: "Vegetables",
@@ -44,134 +39,129 @@ var he = (e) => {
44
39
  field: "",
45
40
  yieldEstimate: 0,
46
41
  imageIds: []
47
- }, w = () => {
48
- let { crops: w, fields: T, errors: _e, loadings: ve, createCrop: ye, updateCrop: E, deleteCrop: D, refetch: O } = o(), [k, A] = f(w), [j, M] = f(""), [N, P] = f("all"), [F, be] = f("all"), [xe, I] = f(!1), [L, R] = f(C), [z, B] = f(null), [V, H] = f(!1), [U, W] = f(null), G = oe(null), K = pe(), { buildPath: q } = t(), { toasts: Se, toast: J, dismiss: Ce } = s(), { t: Y } = se();
49
- d(() => {
50
- A(w);
51
- }, [w]), d(() => {
52
- let e = (e) => {
53
- G.current && !G.current.contains(e.target) && W(null);
54
- };
55
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
56
- }, []);
57
- let X = k.filter((e) => {
58
- let t = (e.name ?? "").toLowerCase().includes(j.toLowerCase()) || (e.variety ?? "").toLowerCase().includes(j.toLowerCase()) || (e.fieldName ?? "").toLowerCase().includes(j.toLowerCase()), n = N === "all" || e.season === N, r = F === "all" || e.healthStatus === F;
42
+ }, M = () => {
43
+ let { crops: M, fields: N, errors: Ee, loadings: De, createCrop: Oe, updateCrop: ke, deleteCrop: Ae, refetch: je } = ee(), [P, Me] = s(M), [F, Ne] = s(""), [I, Pe] = s("all"), [L, Fe] = s("all"), [Ie, R] = s(!1), [z, B] = s(j), [V, H] = s(null), [U, W] = s(!1), G = de(), { buildPath: K } = t(), { toasts: Le, toast: q, dismiss: Re } = te(), { t: J } = ie();
44
+ re(() => {
45
+ Me(M);
46
+ }, [M]);
47
+ let Y = P.filter((e) => {
48
+ let t = (e.name ?? "").toLowerCase().includes(F.toLowerCase()) || (e.variety ?? "").toLowerCase().includes(F.toLowerCase()) || (e.fieldName ?? "").toLowerCase().includes(F.toLowerCase()), n = I === "all" || e.season === I, r = L === "all" || e.healthStatus === L;
59
49
  return t && n && r;
60
- }), we = k.filter((e) => e.healthStatus === "excellent" || e.healthStatus === "good").length, Te = k.reduce((e, t) => e + t.yieldEstimate, 0), Ee = async () => {
61
- if (!L.name || !L.variety || !L.field) {
62
- J({
63
- title: Y("healthybowl.crops.list.toast.missingFields.title", "Missing required fields"),
64
- description: Y("healthybowl.crops.list.toast.missingFields.message", "Please fill in name, variety, and field."),
50
+ }), ze = P.filter((e) => e.healthStatus === "excellent" || e.healthStatus === "good").length, Be = P.reduce((e, t) => e + t.yieldEstimate, 0), X = () => {
51
+ R(!1), B(j), H(null);
52
+ }, Ve = async () => {
53
+ if (!z.name || !z.variety || !z.field) {
54
+ q({
55
+ title: J("healthybowl.crops.list.toast.missingFields.title", "Missing required fields"),
56
+ description: J("healthybowl.crops.list.toast.missingFields.message", "Please fill in name, variety, and field."),
65
57
  variant: "warning"
66
58
  });
67
59
  return;
68
60
  }
69
- if (z) {
70
- H(!0);
61
+ if (V) {
62
+ W(!0);
71
63
  try {
72
- await E({
73
- id: z.id,
74
- name: L.name,
75
- variety: L.variety,
76
- category: L.category,
77
- season: L.season,
78
- plantingDate: L.plantingDate || void 0,
79
- expectedHarvestDate: L.expectedHarvestDate || void 0,
80
- fieldId: L.field || void 0,
81
- yieldEstimate: L.yieldEstimate ? Number(L.yieldEstimate) : void 0,
82
- imageIds: L.imageIds
83
- }), J({
84
- title: Y("healthybowl.crops.list.toast.updated.title", "Crop updated"),
85
- description: Y("healthybowl.crops.list.toast.updated.message", "{{name}} ({{variety}}) has been updated.", {
86
- name: L.name,
87
- variety: L.variety
64
+ await ke({
65
+ id: V.id,
66
+ name: z.name,
67
+ variety: z.variety,
68
+ category: z.category,
69
+ season: z.season,
70
+ plantingDate: z.plantingDate || void 0,
71
+ expectedHarvestDate: z.expectedHarvestDate || void 0,
72
+ fieldId: z.field || void 0,
73
+ yieldEstimate: z.yieldEstimate ? Number(z.yieldEstimate) : void 0,
74
+ imageIds: z.imageIds
75
+ }), q({
76
+ title: J("healthybowl.crops.list.toast.updated.title", "Crop updated"),
77
+ description: J("healthybowl.crops.list.toast.updated.message", "{{name}} ({{variety}}) has been updated.", {
78
+ name: z.name,
79
+ variety: z.variety
88
80
  }),
89
81
  variant: "success"
90
- }), I(!1), R(C), B(null);
82
+ }), R(!1), B(j), H(null);
91
83
  } catch (e) {
92
- J({
93
- title: Y("healthybowl.crops.list.toast.updateFailed.title", "Update failed"),
84
+ q({
85
+ title: J("healthybowl.crops.list.toast.updateFailed.title", "Update failed"),
94
86
  description: String(e),
95
87
  variant: "error"
96
88
  });
97
89
  } finally {
98
- H(!1);
90
+ W(!1);
99
91
  }
100
92
  return;
101
93
  }
102
- let e = L.field || T[0]?.id;
94
+ let e = z.field || N[0]?.id;
103
95
  if (!e) {
104
- J({
105
- title: Y("healthybowl.crops.list.toast.noField.title", "No field available"),
106
- description: Y("healthybowl.crops.list.toast.noField.message", "Please create a field before adding a crop."),
96
+ q({
97
+ title: J("healthybowl.crops.list.toast.noField.title", "No field available"),
98
+ description: J("healthybowl.crops.list.toast.noField.message", "Please create a field before adding a crop."),
107
99
  variant: "warning"
108
100
  });
109
101
  return;
110
102
  }
111
- H(!0);
103
+ W(!0);
112
104
  try {
113
- await ye({
114
- name: L.name,
115
- variety: L.variety,
116
- category: L.category || "vegetable",
117
- season: L.season || "kharif",
118
- plantingDate: L.plantingDate || (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
119
- expectedHarvestDate: L.expectedHarvestDate || new Date(Date.now() + 90 * 864e5).toISOString().split("T")[0],
105
+ await Oe({
106
+ name: z.name,
107
+ variety: z.variety,
108
+ category: z.category || "vegetable",
109
+ season: z.season || "kharif",
110
+ plantingDate: z.plantingDate || (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
111
+ expectedHarvestDate: z.expectedHarvestDate || new Date(Date.now() + 90 * 864e5).toISOString().split("T")[0],
120
112
  fieldId: e,
121
113
  status: "planted",
122
114
  growthStage: "Seedling",
123
115
  healthStatus: "good",
124
- yieldEstimate: L.yieldEstimate ? Number(L.yieldEstimate) : 100,
116
+ yieldEstimate: z.yieldEstimate ? Number(z.yieldEstimate) : 100,
125
117
  yieldUnit: "kg",
126
118
  organicCertified: !1,
127
119
  daysToHarvest: 90,
128
120
  progress: 0,
129
- imageIds: L.imageIds
130
- }), J({
131
- title: Y("healthybowl.crops.list.toast.created.title", "Crop added successfully"),
132
- description: Y("healthybowl.crops.list.toast.created.message", "{{name}} ({{variety}}) has been created.", {
133
- name: L.name,
134
- variety: L.variety
121
+ imageIds: z.imageIds
122
+ }), q({
123
+ title: J("healthybowl.crops.list.toast.created.title", "Crop added successfully"),
124
+ description: J("healthybowl.crops.list.toast.created.message", "{{name}} ({{variety}}) has been created.", {
125
+ name: z.name,
126
+ variety: z.variety
135
127
  }),
136
128
  variant: "success"
137
- }), I(!1), R(C), B(null);
129
+ }), R(!1), B(j), H(null);
138
130
  } catch (e) {
139
- J({
140
- title: Y("healthybowl.crops.list.toast.createFailed.title", "Create failed"),
131
+ q({
132
+ title: J("healthybowl.crops.list.toast.createFailed.title", "Create failed"),
141
133
  description: String(e),
142
134
  variant: "error"
143
135
  });
144
136
  } finally {
145
- H(!1);
137
+ W(!1);
146
138
  }
147
139
  }, Z = async (e) => {
148
- if (await ae({
149
- title: Y("healthybowl.crops.list.delete.confirm.title", "Delete crop?"),
150
- message: Y("healthybowl.crops.list.delete.confirm.message", "{{name}} will be permanently removed.", { name: e.name ?? Y("healthybowl.crops.list.delete.confirm.fallbackName", "This crop") }),
151
- okButtonTitle: Y("healthybowl.common.delete", "Delete"),
152
- cancelButtonTitle: Y("healthybowl.common.cancel", "Cancel")
153
- }) === !1) {
154
- W(null);
155
- return;
156
- }
157
- H(!0);
158
- try {
159
- await D(e.id), J({
160
- title: Y("healthybowl.crops.list.toast.deleted.title", "Crop deleted"),
161
- description: Y("healthybowl.crops.list.toast.deleted.message", "{{name}} has been removed.", { name: e.name ?? Y("healthybowl.crops.list.toast.deleted.fallbackName", "Crop") }),
162
- variant: "success"
163
- }), c() && (u(Y("healthybowl.crops.list.toast.deleted.title", "Crop deleted")), l("success"));
164
- } catch (e) {
165
- J({
166
- title: Y("healthybowl.crops.list.toast.deleteFailed.title", "Delete failed"),
167
- description: String(e),
168
- variant: "error"
169
- }), c() && (u(Y("healthybowl.crops.list.toast.deleteFailed.title", "Delete failed")), l("error"));
170
- } finally {
171
- H(!1), W(null);
140
+ if (await ne({
141
+ title: J("healthybowl.crops.list.delete.confirm.title", "Delete crop?"),
142
+ message: J("healthybowl.crops.list.delete.confirm.message", "{{name}} will be permanently removed.", { name: e.name ?? J("healthybowl.crops.list.delete.confirm.fallbackName", "This crop") }),
143
+ okButtonTitle: J("healthybowl.common.delete", "Delete"),
144
+ cancelButtonTitle: J("healthybowl.common.cancel", "Cancel")
145
+ }) !== !1) {
146
+ W(!0);
147
+ try {
148
+ await Ae(e.id), q({
149
+ title: J("healthybowl.crops.list.toast.deleted.title", "Crop deleted"),
150
+ description: J("healthybowl.crops.list.toast.deleted.message", "{{name}} has been removed.", { name: e.name ?? J("healthybowl.crops.list.toast.deleted.fallbackName", "Crop") }),
151
+ variant: "success"
152
+ }), i() && (o(J("healthybowl.crops.list.toast.deleted.title", "Crop deleted")), a("success"));
153
+ } catch (e) {
154
+ q({
155
+ title: J("healthybowl.crops.list.toast.deleteFailed.title", "Delete failed"),
156
+ description: String(e),
157
+ variant: "error"
158
+ }), i() && (o(J("healthybowl.crops.list.toast.deleteFailed.title", "Delete failed")), a("error"));
159
+ } finally {
160
+ W(!1);
161
+ }
172
162
  }
173
163
  }, Q = (e) => {
174
- B(e), R({
164
+ H(e), B({
175
165
  name: e.name,
176
166
  variety: e.variety,
177
167
  category: e.category,
@@ -181,317 +171,320 @@ var he = (e) => {
181
171
  field: e.field,
182
172
  yieldEstimate: e.yieldEstimate,
183
173
  imageIds: e.imageIds ?? []
184
- }), I(!0), W(null);
185
- }, $ = (e, t) => R((n) => ({
174
+ }), R(!0);
175
+ }, $ = (e, t) => B((n) => ({
186
176
  ...n,
187
177
  [e]: t
188
178
  }));
189
- return /* @__PURE__ */ S(n, {
190
- title: Y("healthybowl.crops.list.title", "Crop Management"),
191
- description: Y("healthybowl.crops.list.subtitle", "Manage and monitor all your crops in one place"),
192
- actions: /* @__PURE__ */ S("button", {
193
- onClick: () => {
194
- B(null), R(C), I(!0);
195
- },
196
- className: "flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90",
179
+ return /* @__PURE__ */ _(_e, { children: [
180
+ /* @__PURE__ */ g(A, {
181
+ title: J("healthybowl.crops.list.title", "Crop Management"),
182
+ description: J("healthybowl.crops.list.subtitle", "Manage and monitor all your crops in one place"),
183
+ breadcrumb: [{ label: J("healthybowl.crops.list.breadcrumb.crops", "Crops") }],
184
+ actions: /* @__PURE__ */ _(y, {
185
+ onClick: () => {
186
+ H(null), B(j), R(!0);
187
+ },
188
+ children: [
189
+ /* @__PURE__ */ g(f, { className: "h-4 w-4" }),
190
+ " ",
191
+ J("healthybowl.crops.list.actions.addCrop", "Add New Crop")
192
+ ]
193
+ })
194
+ }),
195
+ /* @__PURE__ */ g("div", {
196
+ className: "flex flex-wrap gap-3",
197
+ children: [
198
+ {
199
+ key: "fields",
200
+ label: J("healthybowl.crops.list.nav.fields.label", "Fields"),
201
+ icon: d,
202
+ path: K("crops/fields"),
203
+ desc: J("healthybowl.crops.list.nav.fields.desc", "Manage farm fields")
204
+ },
205
+ {
206
+ key: "planning",
207
+ label: J("healthybowl.crops.list.nav.planning.label", "Planning"),
208
+ icon: c,
209
+ path: K("crops/planning"),
210
+ desc: J("healthybowl.crops.list.nav.planning.desc", "Planting plans")
211
+ },
212
+ {
213
+ key: "harvest",
214
+ label: J("healthybowl.crops.list.nav.harvest.label", "Harvest"),
215
+ icon: ce,
216
+ path: K("crops/harvest"),
217
+ desc: J("healthybowl.crops.list.nav.harvest.desc", "Harvest records")
218
+ }
219
+ ].map((e) => /* @__PURE__ */ _("button", {
220
+ type: "button",
221
+ onClick: () => G(e.path),
222
+ className: "flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface px-4 py-3 text-left shadow-sm transition-colors hover:border-primary/30 hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
223
+ children: [
224
+ /* @__PURE__ */ g(e.icon, { className: "h-5 w-5 text-text-secondary" }),
225
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
226
+ className: "text-sm font-medium text-text-primary",
227
+ children: e.label
228
+ }), /* @__PURE__ */ g("p", {
229
+ className: "text-xs text-text-secondary",
230
+ children: e.desc
231
+ })] }),
232
+ /* @__PURE__ */ g(oe, { className: "ml-2 h-4 w-4 text-text-secondary" })
233
+ ]
234
+ }, e.key))
235
+ }),
236
+ /* @__PURE__ */ _("div", {
237
+ className: "mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
197
238
  children: [
198
- /* @__PURE__ */ x(_, { className: "h-4 w-4" }),
199
- " ",
200
- Y("healthybowl.crops.list.actions.addCrop", "Add New Crop")
239
+ /* @__PURE__ */ g("div", {
240
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
241
+ children: /* @__PURE__ */ _("div", {
242
+ className: "flex items-center justify-between",
243
+ children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
244
+ className: "text-xs font-medium text-text-secondary",
245
+ children: J("healthybowl.crops.list.stats.totalCrops.label", "Total Crops")
246
+ }), /* @__PURE__ */ g("p", {
247
+ className: "mt-1 text-2xl font-bold tabular-nums text-text-primary",
248
+ children: P.length
249
+ })] }), /* @__PURE__ */ g(p, { className: "h-6 w-6 text-text-secondary" })]
250
+ })
251
+ }),
252
+ /* @__PURE__ */ g("div", {
253
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
254
+ children: /* @__PURE__ */ _("div", {
255
+ className: "flex items-center justify-between",
256
+ children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
257
+ className: "text-xs font-medium text-text-secondary",
258
+ children: J("healthybowl.crops.list.stats.totalFields.label", "Total Fields")
259
+ }), /* @__PURE__ */ g("p", {
260
+ className: "mt-1 text-2xl font-bold tabular-nums text-text-primary",
261
+ children: N.length
262
+ })] }), /* @__PURE__ */ g(d, { className: "h-6 w-6 text-text-secondary" })]
263
+ })
264
+ }),
265
+ /* @__PURE__ */ g("div", {
266
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
267
+ children: /* @__PURE__ */ _("div", {
268
+ className: "flex items-center justify-between",
269
+ children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
270
+ className: "text-xs font-medium text-text-secondary",
271
+ children: J("healthybowl.crops.list.stats.healthyCrops.label", "Healthy Crops")
272
+ }), /* @__PURE__ */ g("p", {
273
+ className: "mt-1 text-2xl font-bold tabular-nums text-success",
274
+ children: ze
275
+ })] }), /* @__PURE__ */ g(ue, { className: "h-6 w-6 text-text-secondary" })]
276
+ })
277
+ }),
278
+ /* @__PURE__ */ g("div", {
279
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
280
+ children: /* @__PURE__ */ _("div", {
281
+ className: "flex items-center justify-between",
282
+ children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
283
+ className: "text-xs font-medium text-text-secondary",
284
+ children: J("healthybowl.crops.list.stats.estYield.label", "Est. Yield")
285
+ }), /* @__PURE__ */ _("p", {
286
+ className: "mt-1 text-2xl font-bold tabular-nums text-text-primary",
287
+ children: [(Be / 1e3).toFixed(1), "t"]
288
+ })] }), /* @__PURE__ */ g(h, { className: "h-6 w-6 text-text-secondary" })]
289
+ })
290
+ })
201
291
  ]
202
292
  }),
203
- children: [
204
- /* @__PURE__ */ x(re, { items: [{ label: Y("healthybowl.crops.list.breadcrumb.crops", "Crops") }] }),
205
- /* @__PURE__ */ x("div", {
206
- className: "flex flex-wrap gap-3",
293
+ /* @__PURE__ */ _("div", {
294
+ className: "mt-4 flex flex-col gap-4 rounded-lg border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between",
295
+ children: [/* @__PURE__ */ _("div", {
296
+ className: "flex flex-wrap items-center gap-3",
207
297
  children: [
208
- {
209
- key: "fields",
210
- label: Y("healthybowl.crops.list.nav.fields.label", "Fields"),
211
- icon: g,
212
- path: q("crops/fields"),
213
- desc: Y("healthybowl.crops.list.nav.fields.desc", "Manage farm fields")
214
- },
215
- {
216
- key: "planning",
217
- label: Y("healthybowl.crops.list.nav.planning.label", "Planning"),
218
- icon: p,
219
- path: q("crops/planning"),
220
- desc: Y("healthybowl.crops.list.nav.planning.desc", "Planting plans")
221
- },
222
- {
223
- key: "harvest",
224
- label: Y("healthybowl.crops.list.nav.harvest.label", "Harvest"),
225
- icon: ue,
226
- path: q("crops/harvest"),
227
- desc: Y("healthybowl.crops.list.nav.harvest.desc", "Harvest records")
228
- }
229
- ].map((e) => /* @__PURE__ */ S("button", {
230
- type: "button",
231
- onClick: () => K(e.path),
232
- className: "flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface px-4 py-3 text-left shadow-sm transition-colors hover:border-primary/30 hover:bg-accent",
233
- children: [
234
- /* @__PURE__ */ x(e.icon, { className: "h-5 w-5 text-text-secondary" }),
235
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
236
- className: "text-sm font-medium text-text-primary",
237
- children: e.label
238
- }), /* @__PURE__ */ x("p", {
239
- className: "text-xs text-text-secondary",
240
- children: e.desc
241
- })] }),
242
- /* @__PURE__ */ x(ce, { className: "ml-2 h-4 w-4 text-text-secondary" })
243
- ]
244
- }, e.key))
245
- }),
246
- /* @__PURE__ */ S("div", {
247
- className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
248
- children: [
249
- /* @__PURE__ */ x("div", {
250
- className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
251
- children: /* @__PURE__ */ S("div", {
252
- className: "flex items-center justify-between",
253
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
254
- className: "text-xs font-medium text-text-secondary",
255
- children: Y("healthybowl.crops.list.stats.totalCrops.label", "Total Crops")
256
- }), /* @__PURE__ */ x("p", {
257
- className: "mt-1 text-2xl font-bold text-text-primary",
258
- children: k.length
259
- })] }), /* @__PURE__ */ x(v, { className: "h-6 w-6 text-text-secondary" })]
260
- })
261
- }),
262
- /* @__PURE__ */ x("div", {
263
- className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
264
- children: /* @__PURE__ */ S("div", {
265
- className: "flex items-center justify-between",
266
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
267
- className: "text-xs font-medium text-text-secondary",
268
- children: Y("healthybowl.crops.list.stats.totalFields.label", "Total Fields")
269
- }), /* @__PURE__ */ x("p", {
270
- className: "mt-1 text-2xl font-bold text-text-primary",
271
- children: T.length
272
- })] }), /* @__PURE__ */ x(g, { className: "h-6 w-6 text-text-secondary" })]
273
- })
298
+ /* @__PURE__ */ _("div", {
299
+ className: "relative",
300
+ children: [/* @__PURE__ */ g(le, { className: "absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ g(C, {
301
+ type: "text",
302
+ placeholder: J("healthybowl.crops.list.filters.search.placeholder", "Search crops, varieties, or fields..."),
303
+ value: F,
304
+ onChange: (e) => Ne(e.target.value),
305
+ className: "w-64 pl-10"
306
+ })]
274
307
  }),
275
- /* @__PURE__ */ x("div", {
276
- className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
277
- children: /* @__PURE__ */ S("div", {
278
- className: "flex items-center justify-between",
279
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
280
- className: "text-xs font-medium text-text-secondary",
281
- children: Y("healthybowl.crops.list.stats.healthyCrops.label", "Healthy Crops")
282
- }), /* @__PURE__ */ x("p", {
283
- className: "mt-1 text-2xl font-bold text-success",
284
- children: we
285
- })] }), /* @__PURE__ */ x(fe, { className: "h-6 w-6 text-text-secondary" })]
286
- })
308
+ /* @__PURE__ */ _(w, {
309
+ value: I,
310
+ onValueChange: (e) => Pe(e),
311
+ children: [/* @__PURE__ */ g(D, {
312
+ className: "w-auto min-w-[10rem]",
313
+ children: /* @__PURE__ */ g(O, {})
314
+ }), /* @__PURE__ */ _(T, { children: [
315
+ /* @__PURE__ */ g(E, {
316
+ value: "all",
317
+ children: J("healthybowl.crops.list.filters.season.all", "All Seasons")
318
+ }),
319
+ /* @__PURE__ */ g(E, {
320
+ value: "kharif",
321
+ children: J("healthybowl.crops.list.filters.season.kharif", "Kharif")
322
+ }),
323
+ /* @__PURE__ */ g(E, {
324
+ value: "rabi",
325
+ children: J("healthybowl.crops.list.filters.season.rabi", "Rabi")
326
+ }),
327
+ /* @__PURE__ */ g(E, {
328
+ value: "zaid",
329
+ children: J("healthybowl.crops.list.filters.season.zaid", "Zaid")
330
+ }),
331
+ /* @__PURE__ */ g(E, {
332
+ value: "perennial",
333
+ children: J("healthybowl.crops.list.filters.season.perennial", "Perennial")
334
+ })
335
+ ] })]
287
336
  }),
288
- /* @__PURE__ */ x("div", {
289
- className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
290
- children: /* @__PURE__ */ S("div", {
291
- className: "flex items-center justify-between",
292
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
293
- className: "text-xs font-medium text-text-secondary",
294
- children: Y("healthybowl.crops.list.stats.estYield.label", "Est. Yield")
295
- }), /* @__PURE__ */ S("p", {
296
- className: "mt-1 text-2xl font-bold text-text-primary",
297
- children: [(Te / 1e3).toFixed(1), "t"]
298
- })] }), /* @__PURE__ */ x(b, { className: "h-6 w-6 text-text-secondary" })]
299
- })
337
+ /* @__PURE__ */ _(w, {
338
+ value: L,
339
+ onValueChange: (e) => Fe(e),
340
+ children: [/* @__PURE__ */ g(D, {
341
+ className: "w-auto min-w-[10rem]",
342
+ children: /* @__PURE__ */ g(O, {})
343
+ }), /* @__PURE__ */ _(T, { children: [
344
+ /* @__PURE__ */ g(E, {
345
+ value: "all",
346
+ children: J("healthybowl.crops.list.filters.health.all", "All Health")
347
+ }),
348
+ /* @__PURE__ */ g(E, {
349
+ value: "excellent",
350
+ children: J("healthybowl.crops.list.filters.health.excellent", "Excellent")
351
+ }),
352
+ /* @__PURE__ */ g(E, {
353
+ value: "good",
354
+ children: J("healthybowl.crops.list.filters.health.good", "Good")
355
+ }),
356
+ /* @__PURE__ */ g(E, {
357
+ value: "fair",
358
+ children: J("healthybowl.crops.list.filters.health.fair", "Fair")
359
+ }),
360
+ /* @__PURE__ */ g(E, {
361
+ value: "poor",
362
+ children: J("healthybowl.crops.list.filters.health.poor", "Poor")
363
+ })
364
+ ] })]
300
365
  })
301
366
  ]
302
- }),
303
- /* @__PURE__ */ S("div", {
304
- className: "flex flex-col gap-4 rounded-lg border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between",
305
- children: [/* @__PURE__ */ S("div", {
306
- className: "flex flex-wrap items-center gap-3",
307
- children: [
308
- /* @__PURE__ */ S("div", {
309
- className: "relative",
310
- children: [/* @__PURE__ */ x(de, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ x("input", {
311
- type: "text",
312
- placeholder: Y("healthybowl.crops.list.filters.search.placeholder", "Search crops, varieties, or fields..."),
313
- value: j,
314
- onChange: (e) => M(e.target.value),
315
- className: "w-64 rounded-md border border-border-subtle bg-bg-surface py-2 pl-10 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
316
- })]
317
- }),
318
- /* @__PURE__ */ S("select", {
319
- value: N,
320
- onChange: (e) => P(e.target.value),
321
- className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
322
- children: [
323
- /* @__PURE__ */ x("option", {
324
- value: "all",
325
- children: Y("healthybowl.crops.list.filters.season.all", "All Seasons")
326
- }),
327
- /* @__PURE__ */ x("option", {
328
- value: "kharif",
329
- children: Y("healthybowl.crops.list.filters.season.kharif", "Kharif")
330
- }),
331
- /* @__PURE__ */ x("option", {
332
- value: "rabi",
333
- children: Y("healthybowl.crops.list.filters.season.rabi", "Rabi")
334
- }),
335
- /* @__PURE__ */ x("option", {
336
- value: "zaid",
337
- children: Y("healthybowl.crops.list.filters.season.zaid", "Zaid")
338
- }),
339
- /* @__PURE__ */ x("option", {
340
- value: "perennial",
341
- children: Y("healthybowl.crops.list.filters.season.perennial", "Perennial")
342
- })
343
- ]
344
- }),
345
- /* @__PURE__ */ S("select", {
346
- value: F,
347
- onChange: (e) => be(e.target.value),
348
- className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
367
+ }), /* @__PURE__ */ g("span", {
368
+ className: "text-xs text-text-secondary",
369
+ children: J("healthybowl.crops.list.filters.resultCount", "Showing {{shown}} of {{total}} crops", {
370
+ shown: Y.length,
371
+ total: P.length
372
+ })
373
+ })]
374
+ }),
375
+ /* @__PURE__ */ g("div", {
376
+ className: "mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
377
+ children: Y.map((t) => /* @__PURE__ */ _(fe, {
378
+ className: "bg-bg-surface",
379
+ children: [/* @__PURE__ */ g(b, {
380
+ className: "space-y-0 p-4",
381
+ children: /* @__PURE__ */ _("div", {
382
+ className: "flex items-start justify-between",
383
+ children: [/* @__PURE__ */ _("div", {
384
+ className: "flex items-center gap-2",
385
+ children: [/* @__PURE__ */ g(p, { className: "h-5 w-5 text-primary" }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("h3", {
386
+ className: "font-medium text-text-primary",
387
+ children: t.name
388
+ }), /* @__PURE__ */ g("p", {
389
+ className: "text-xs text-text-secondary",
390
+ children: t.variety
391
+ })] })]
392
+ }), /* @__PURE__ */ _(me, { children: [/* @__PURE__ */ g(ge, {
393
+ asChild: !0,
394
+ children: /* @__PURE__ */ g(y, {
395
+ variant: "ghost",
396
+ size: "icon",
397
+ className: "text-text-secondary",
398
+ children: /* @__PURE__ */ g(se, { className: "h-4 w-4" })
399
+ })
400
+ }), /* @__PURE__ */ _(he, {
401
+ align: "end",
402
+ className: "w-36",
349
403
  children: [
350
- /* @__PURE__ */ x("option", {
351
- value: "all",
352
- children: Y("healthybowl.crops.list.filters.health.all", "All Health")
353
- }),
354
- /* @__PURE__ */ x("option", {
355
- value: "excellent",
356
- children: Y("healthybowl.crops.list.filters.health.excellent", "Excellent")
357
- }),
358
- /* @__PURE__ */ x("option", {
359
- value: "good",
360
- children: Y("healthybowl.crops.list.filters.health.good", "Good")
404
+ /* @__PURE__ */ _(x, {
405
+ onClick: () => G(K(`crops/${t.id}`)),
406
+ children: [
407
+ /* @__PURE__ */ g(u, { className: "h-3.5 w-3.5" }),
408
+ " ",
409
+ J("healthybowl.common.view", "View")
410
+ ]
361
411
  }),
362
- /* @__PURE__ */ x("option", {
363
- value: "fair",
364
- children: Y("healthybowl.crops.list.filters.health.fair", "Fair")
412
+ /* @__PURE__ */ _(x, {
413
+ onClick: () => Q(t),
414
+ children: [
415
+ /* @__PURE__ */ g(l, { className: "h-3.5 w-3.5" }),
416
+ " ",
417
+ J("healthybowl.common.edit", "Edit")
418
+ ]
365
419
  }),
366
- /* @__PURE__ */ x("option", {
367
- value: "poor",
368
- children: Y("healthybowl.crops.list.filters.health.poor", "Poor")
420
+ /* @__PURE__ */ _(x, {
421
+ onClick: () => Z(t),
422
+ disabled: U,
423
+ className: "text-status-error-text",
424
+ children: [
425
+ /* @__PURE__ */ g(m, { className: "h-3.5 w-3.5" }),
426
+ " ",
427
+ J("healthybowl.common.delete", "Delete")
428
+ ]
369
429
  })
370
430
  ]
371
- })
372
- ]
373
- }), /* @__PURE__ */ x("span", {
374
- className: "text-xs text-text-secondary",
375
- children: Y("healthybowl.crops.list.filters.resultCount", "Showing {{shown}} of {{total}} crops", {
376
- shown: X.length,
377
- total: k.length
431
+ })] })]
378
432
  })
379
- })]
380
- }),
381
- /* @__PURE__ */ x("div", {
382
- className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
383
- children: X.map((t) => /* @__PURE__ */ S("div", {
384
- className: "rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm transition-shadow hover:shadow-md",
433
+ }), /* @__PURE__ */ _(pe, {
434
+ className: "p-4 pt-0",
385
435
  children: [
386
- /* @__PURE__ */ S("div", {
387
- className: "flex items-start justify-between",
388
- children: [/* @__PURE__ */ S("div", {
389
- className: "flex items-center gap-2",
390
- children: [/* @__PURE__ */ x(v, { className: "h-5 w-5 text-primary" }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h3", {
391
- className: "font-medium text-text-primary",
392
- children: t.name
393
- }), /* @__PURE__ */ x("p", {
394
- className: "text-xs text-text-secondary",
395
- children: t.variety
396
- })] })]
397
- }), /* @__PURE__ */ S("div", {
398
- className: "relative",
399
- ref: U === t.id ? G : void 0,
400
- children: [/* @__PURE__ */ x("button", {
401
- onClick: (e) => {
402
- e.stopPropagation(), W(U === t.id ? null : t.id);
403
- },
404
- className: "rounded-md p-1 text-text-secondary hover:bg-bg-sunken/50",
405
- children: /* @__PURE__ */ x(le, { className: "h-4 w-4" })
406
- }), U === t.id && /* @__PURE__ */ S("div", {
407
- className: "absolute right-0 z-10 mt-1 w-36 rounded-md border border-border-subtle bg-bg-surface shadow-lg",
408
- children: [
409
- /* @__PURE__ */ S("button", {
410
- onClick: () => {
411
- K(q(`crops/${t.id}`)), W(null);
412
- },
413
- className: "flex w-full items-center gap-2 px-3 py-2 text-sm text-text-primary hover:bg-bg-sunken/50",
414
- children: [
415
- /* @__PURE__ */ x(h, { className: "h-3.5 w-3.5" }),
416
- " ",
417
- Y("healthybowl.common.view", "View")
418
- ]
419
- }),
420
- /* @__PURE__ */ S("button", {
421
- onClick: () => Q(t),
422
- className: "flex w-full items-center gap-2 px-3 py-2 text-sm text-text-primary hover:bg-bg-sunken/50",
423
- children: [
424
- /* @__PURE__ */ x(m, { className: "h-3.5 w-3.5" }),
425
- " ",
426
- Y("healthybowl.common.edit", "Edit")
427
- ]
428
- }),
429
- /* @__PURE__ */ S("button", {
430
- onClick: () => Z(t),
431
- disabled: V,
432
- className: "flex w-full items-center gap-2 px-3 py-2 text-sm text-status-error-text hover:bg-bg-sunken/50 disabled:opacity-60",
433
- children: [
434
- /* @__PURE__ */ x(y, { className: "h-3.5 w-3.5" }),
435
- " ",
436
- Y("healthybowl.common.delete", "Delete")
437
- ]
438
- })
439
- ]
440
- })]
436
+ /* @__PURE__ */ _("div", {
437
+ className: "flex items-center gap-2",
438
+ children: [/* @__PURE__ */ g(v, {
439
+ variant: Te(t.status ?? "unknown"),
440
+ children: t.growthStage
441
+ }), /* @__PURE__ */ g(v, {
442
+ variant: "secondary",
443
+ children: t.season
441
444
  })]
442
445
  }),
443
- /* @__PURE__ */ S("div", {
444
- className: "mt-3 flex items-center gap-2",
445
- children: [/* @__PURE__ */ x(r, {
446
- label: t.growthStage,
447
- variant: ge(t.status ?? "unknown")
448
- }), /* @__PURE__ */ x(r, {
449
- label: t.season,
450
- variant: "muted"
451
- })]
452
- }),
453
- /* @__PURE__ */ S("div", {
446
+ /* @__PURE__ */ _("div", {
454
447
  className: "mt-3 space-y-2 text-xs",
455
448
  children: [
456
- /* @__PURE__ */ S("div", {
449
+ /* @__PURE__ */ _("div", {
457
450
  className: "flex items-center justify-between",
458
- children: [/* @__PURE__ */ S("span", {
451
+ children: [/* @__PURE__ */ _("span", {
459
452
  className: "flex items-center gap-1 text-text-secondary",
460
453
  children: [
461
- /* @__PURE__ */ x(g, { className: "h-3.5 w-3.5" }),
454
+ /* @__PURE__ */ g(d, { className: "h-3.5 w-3.5" }),
462
455
  " ",
463
456
  t.fieldName
464
457
  ]
465
- }), /* @__PURE__ */ x("span", {
458
+ }), /* @__PURE__ */ g("span", {
466
459
  className: "font-medium text-text-primary",
467
460
  children: t.category
468
461
  })]
469
462
  }),
470
- /* @__PURE__ */ S("div", {
463
+ /* @__PURE__ */ _("div", {
471
464
  className: "flex items-center justify-between",
472
- children: [/* @__PURE__ */ S("span", {
465
+ children: [/* @__PURE__ */ _("span", {
473
466
  className: "flex items-center gap-1 text-text-secondary",
474
467
  children: [
475
- /* @__PURE__ */ x(p, { className: "h-3.5 w-3.5" }),
468
+ /* @__PURE__ */ g(c, { className: "h-3.5 w-3.5" }),
476
469
  " ",
477
- Y("healthybowl.crops.list.card.planted", "Planted")
470
+ J("healthybowl.crops.list.card.planted", "Planted")
478
471
  ]
479
- }), /* @__PURE__ */ x("span", {
480
- className: "font-medium text-text-primary",
472
+ }), /* @__PURE__ */ g("span", {
473
+ className: "font-medium tabular-nums text-text-primary",
481
474
  children: e(t.plantingDate)
482
475
  })]
483
476
  }),
484
- /* @__PURE__ */ S("div", {
477
+ /* @__PURE__ */ _("div", {
485
478
  className: "flex items-center justify-between",
486
- children: [/* @__PURE__ */ S("span", {
479
+ children: [/* @__PURE__ */ _("span", {
487
480
  className: "flex items-center gap-1 text-text-secondary",
488
481
  children: [
489
- /* @__PURE__ */ x(b, { className: "h-3.5 w-3.5" }),
482
+ /* @__PURE__ */ g(h, { className: "h-3.5 w-3.5" }),
490
483
  " ",
491
- Y("healthybowl.crops.list.card.estYield", "Est. Yield")
484
+ J("healthybowl.crops.list.card.estYield", "Est. Yield")
492
485
  ]
493
- }), /* @__PURE__ */ S("span", {
494
- className: "font-medium text-text-primary",
486
+ }), /* @__PURE__ */ _("span", {
487
+ className: "font-medium tabular-nums text-text-primary",
495
488
  children: [
496
489
  t.yieldEstimate,
497
490
  " ",
@@ -501,257 +494,277 @@ var he = (e) => {
501
494
  })
502
495
  ]
503
496
  }),
504
- /* @__PURE__ */ x("div", {
497
+ /* @__PURE__ */ g("div", {
505
498
  className: "mt-3",
506
- children: /* @__PURE__ */ S("div", {
499
+ children: /* @__PURE__ */ _("div", {
507
500
  className: "flex items-center gap-2",
508
- children: [/* @__PURE__ */ x("div", {
501
+ children: [/* @__PURE__ */ g("div", {
509
502
  className: "h-2 flex-1 rounded-full bg-bg-sunken",
510
- children: /* @__PURE__ */ x("div", {
503
+ children: /* @__PURE__ */ g("div", {
511
504
  className: "h-2 rounded-full bg-action-primary-bg",
512
505
  style: { width: `${t.progress}%` }
513
506
  })
514
- }), /* @__PURE__ */ S("span", {
515
- className: "text-xs font-medium text-text-secondary",
507
+ }), /* @__PURE__ */ _("span", {
508
+ className: "text-xs font-medium tabular-nums text-text-secondary",
516
509
  children: [t.progress, "%"]
517
510
  })]
518
511
  })
519
512
  }),
520
- /* @__PURE__ */ S("div", {
513
+ /* @__PURE__ */ _("div", {
521
514
  className: "mt-3 flex items-center justify-between",
522
- children: [/* @__PURE__ */ x(r, {
523
- label: t.healthStatus,
524
- variant: he(t.healthStatus)
525
- }), /* @__PURE__ */ x("span", {
526
- className: "text-xs text-text-secondary",
527
- children: Y("healthybowl.crops.list.card.daysToHarvest", "{{days}}d to harvest", { days: t.daysToHarvest })
515
+ children: [/* @__PURE__ */ g(v, {
516
+ variant: we(t.healthStatus),
517
+ children: t.healthStatus
518
+ }), /* @__PURE__ */ g("span", {
519
+ className: "text-xs tabular-nums text-text-secondary",
520
+ children: J("healthybowl.crops.list.card.daysToHarvest", "{{days}}d to harvest", { days: t.daysToHarvest })
528
521
  })]
529
522
  }),
530
- /* @__PURE__ */ S("div", {
523
+ /* @__PURE__ */ _("div", {
531
524
  className: "mt-3 flex gap-2",
532
525
  children: [
533
- /* @__PURE__ */ S("button", {
534
- onClick: () => K(q(`crops/${t.id}`)),
535
- className: "flex flex-1 items-center justify-center gap-1 rounded-md border border-border-subtle py-1.5 text-xs text-text-primary hover:bg-bg-sunken/50",
526
+ /* @__PURE__ */ _(y, {
527
+ variant: "outline",
528
+ size: "sm",
529
+ className: "flex-1",
530
+ onClick: () => G(K(`crops/${t.id}`)),
536
531
  children: [
537
- /* @__PURE__ */ x(h, { className: "h-3.5 w-3.5" }),
532
+ /* @__PURE__ */ g(u, { className: "h-3.5 w-3.5" }),
538
533
  " ",
539
- Y("healthybowl.common.view", "View")
534
+ J("healthybowl.common.view", "View")
540
535
  ]
541
536
  }),
542
- /* @__PURE__ */ S("button", {
537
+ /* @__PURE__ */ _(y, {
538
+ variant: "outline",
539
+ size: "sm",
540
+ className: "flex-1",
543
541
  onClick: () => Q(t),
544
- className: "flex flex-1 items-center justify-center gap-1 rounded-md border border-border-subtle py-1.5 text-xs text-text-primary hover:bg-bg-sunken/50",
545
542
  children: [
546
- /* @__PURE__ */ x(m, { className: "h-3.5 w-3.5" }),
543
+ /* @__PURE__ */ g(l, { className: "h-3.5 w-3.5" }),
547
544
  " ",
548
- Y("healthybowl.common.edit", "Edit")
545
+ J("healthybowl.common.edit", "Edit")
549
546
  ]
550
547
  }),
551
- /* @__PURE__ */ x("button", {
548
+ /* @__PURE__ */ g(y, {
549
+ variant: "outline",
550
+ size: "icon-sm",
552
551
  onClick: () => Z(t),
553
- disabled: V,
554
- className: "rounded-md border border-border-subtle px-2 py-1.5 text-xs text-text-secondary hover:bg-bg-sunken/50 disabled:opacity-60",
555
- children: /* @__PURE__ */ x(y, { className: "h-3.5 w-3.5" })
552
+ disabled: U,
553
+ className: "text-text-secondary",
554
+ children: /* @__PURE__ */ g(m, { className: "h-3.5 w-3.5" })
556
555
  })
557
556
  ]
558
557
  })
559
558
  ]
560
- }, t.id))
561
- }),
562
- X.length === 0 && (ve.crops ? /* @__PURE__ */ x(ie, {}) : _e.crops ? /* @__PURE__ */ x(te, { onRetry: O }) : /* @__PURE__ */ x(ee, {
563
- title: Y("healthybowl.crops.list.emptyState.title", "No crops found"),
564
- description: j || N !== "all" || F !== "all" ? Y("healthybowl.crops.list.emptyState.filtered", "Try adjusting your filters") : Y("healthybowl.crops.list.emptyState.message", "Get started by adding your first crop"),
565
- icon: /* @__PURE__ */ x(v, { className: "h-12 w-12 text-text-secondary" }),
566
- action: !j && N === "all" && F === "all" ? /* @__PURE__ */ S("button", {
567
- onClick: () => I(!0),
568
- className: "rounded-md bg-action-primary-bg px-4 py-2 text-sm text-action-primary-text",
569
- children: [
570
- /* @__PURE__ */ x(_, { className: "mr-1 inline h-4 w-4" }),
571
- " ",
572
- Y("healthybowl.crops.list.emptyState.addFirstCrop", "Add Your First Crop")
573
- ]
574
- }) : void 0
575
- })),
576
- /* @__PURE__ */ x(i, {
577
- open: xe,
578
- onClose: () => {
579
- I(!1), R(C), B(null);
580
- },
581
- title: z ? Y("healthybowl.crops.list.modal.editTitle", "Edit {{name}}", { name: z.name }) : Y("healthybowl.crops.list.modal.addTitle", "Add New Crop"),
582
- description: z ? Y("healthybowl.crops.list.modal.editDescription", "Update the crop details.") : Y("healthybowl.crops.list.modal.addDescription", "Fill in the details to register a new crop on your farm."),
583
- size: "lg",
584
- footer: /* @__PURE__ */ S(me, { children: [/* @__PURE__ */ x("button", {
585
- onClick: () => {
586
- I(!1), R(C), B(null);
587
- },
588
- className: "rounded-md border border-border-subtle px-4 py-2 text-sm text-text-secondary hover:text-text-primary",
589
- children: Y("healthybowl.common.cancel", "Cancel")
590
- }), /* @__PURE__ */ x("button", {
591
- onClick: Ee,
592
- disabled: V,
593
- className: "rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-60",
594
- children: V ? Y("healthybowl.crops.list.modal.saving", "Saving...") : z ? Y("healthybowl.crops.list.modal.saveChanges", "Save Changes") : Y("healthybowl.crops.list.modal.addCrop", "Add Crop")
595
- })] }),
596
- children: /* @__PURE__ */ S("div", {
597
- className: "grid gap-4 sm:grid-cols-2",
598
- children: [
599
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
600
- className: "text-sm font-medium text-text-primary",
601
- children: Y("healthybowl.crops.list.form.name.label", "Crop Name *")
602
- }), /* @__PURE__ */ x("input", {
603
- type: "text",
604
- value: L.name,
605
- onChange: (e) => $("name", e.target.value),
606
- placeholder: Y("healthybowl.crops.list.form.name.placeholder", "e.g., Tomatoes"),
607
- className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
608
- })] }),
609
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
610
- className: "text-sm font-medium text-text-primary",
611
- children: Y("healthybowl.crops.list.form.variety.label", "Variety *")
612
- }), /* @__PURE__ */ x("input", {
613
- type: "text",
614
- value: L.variety,
615
- onChange: (e) => $("variety", e.target.value),
616
- placeholder: Y("healthybowl.crops.list.form.variety.placeholder", "e.g., Roma"),
617
- className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
618
- })] }),
619
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
620
- className: "text-sm font-medium text-text-primary",
621
- children: Y("healthybowl.crops.list.form.category.label", "Category")
622
- }), /* @__PURE__ */ S("select", {
623
- value: L.category,
624
- onChange: (e) => $("category", e.target.value),
625
- className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
626
- children: [
627
- /* @__PURE__ */ x("option", {
628
- value: "Vegetables",
629
- children: Y("healthybowl.crops.list.form.category.vegetables", "Vegetables")
630
- }),
631
- /* @__PURE__ */ x("option", {
632
- value: "Fruits",
633
- children: Y("healthybowl.crops.list.form.category.fruits", "Fruits")
634
- }),
635
- /* @__PURE__ */ x("option", {
636
- value: "Herbs",
637
- children: Y("healthybowl.crops.list.form.category.herbs", "Herbs")
638
- }),
639
- /* @__PURE__ */ x("option", {
640
- value: "Leafy Greens",
641
- children: Y("healthybowl.crops.list.form.category.leafyGreens", "Leafy Greens")
642
- }),
643
- /* @__PURE__ */ x("option", {
644
- value: "Grains",
645
- children: Y("healthybowl.crops.list.form.category.grains", "Grains")
646
- }),
647
- /* @__PURE__ */ x("option", {
648
- value: "Legumes",
649
- children: Y("healthybowl.crops.list.form.category.legumes", "Legumes")
650
- })
651
- ]
652
- })] }),
653
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
654
- className: "text-sm font-medium text-text-primary",
655
- children: Y("healthybowl.crops.list.form.season.label", "Season")
656
- }), /* @__PURE__ */ S("select", {
657
- value: L.season,
658
- onChange: (e) => $("season", e.target.value),
659
- className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
660
- children: [
661
- /* @__PURE__ */ x("option", {
662
- value: "kharif",
663
- children: Y("healthybowl.crops.list.form.season.kharif", "Kharif (Summer)")
664
- }),
665
- /* @__PURE__ */ x("option", {
666
- value: "rabi",
667
- children: Y("healthybowl.crops.list.form.season.rabi", "Rabi (Winter)")
668
- }),
669
- /* @__PURE__ */ x("option", {
670
- value: "zaid",
671
- children: Y("healthybowl.crops.list.form.season.zaid", "Zaid (Spring)")
672
- }),
673
- /* @__PURE__ */ x("option", {
674
- value: "perennial",
675
- children: Y("healthybowl.crops.list.form.season.perennial", "Perennial")
676
- })
677
- ]
678
- })] }),
679
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
680
- className: "text-sm font-medium text-text-primary",
681
- children: Y("healthybowl.crops.list.form.field.label", "Field *")
682
- }), /* @__PURE__ */ S("select", {
683
- value: L.field,
684
- onChange: (e) => $("field", e.target.value),
685
- className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
686
- children: [/* @__PURE__ */ x("option", {
687
- value: "",
688
- children: Y("healthybowl.crops.list.form.field.placeholder", "Select a field")
689
- }), T.map((e) => /* @__PURE__ */ S("option", {
690
- value: e.id,
691
- children: [
692
- e.name,
693
- " (",
694
- e.area,
695
- " ",
696
- e.unit,
697
- ")"
698
- ]
699
- }, e.id))]
700
- })] }),
701
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
702
- className: "text-sm font-medium text-text-primary",
703
- children: Y("healthybowl.crops.list.form.yieldEstimate.label", "Yield Estimate (kg)")
704
- }), /* @__PURE__ */ x("input", {
705
- type: "number",
706
- min: 0,
707
- value: L.yieldEstimate || "",
708
- onChange: (e) => $("yieldEstimate", Number(e.target.value)),
709
- placeholder: Y("healthybowl.crops.list.form.yieldEstimate.placeholder", "e.g., 2500"),
710
- className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
711
- })] }),
712
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
713
- className: "text-sm font-medium text-text-primary",
714
- children: Y("healthybowl.crops.list.form.plantingDate.label", "Planting Date")
715
- }), /* @__PURE__ */ x("input", {
716
- type: "date",
717
- value: L.plantingDate,
718
- onChange: (e) => $("plantingDate", e.target.value),
719
- className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
720
- })] }),
721
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
722
- className: "text-sm font-medium text-text-primary",
723
- children: Y("healthybowl.crops.list.form.expectedHarvestDate.label", "Expected Harvest Date")
724
- }), /* @__PURE__ */ x("input", {
725
- type: "date",
726
- value: L.expectedHarvestDate,
727
- onChange: (e) => $("expectedHarvestDate", e.target.value),
728
- className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
729
- })] }),
730
- /* @__PURE__ */ S("div", {
731
- className: "sm:col-span-2",
732
- children: [/* @__PURE__ */ x("label", {
559
+ })]
560
+ }, t.id))
561
+ }),
562
+ Y.length === 0 && (De.crops ? /* @__PURE__ */ g("div", {
563
+ className: "flex justify-center py-12",
564
+ children: /* @__PURE__ */ g(k, {})
565
+ }) : Ee.crops ? /* @__PURE__ */ g(S, {
566
+ icon: /* @__PURE__ */ g(ae, { className: "h-12 w-12 text-status-error-text" }),
567
+ title: J("healthybowl.crops.list.errorState.title", "Couldn't load crops"),
568
+ description: J("healthybowl.crops.list.errorState.message", "Something went wrong while loading your crops."),
569
+ action: /* @__PURE__ */ g(y, {
570
+ variant: "outline",
571
+ onClick: je,
572
+ children: J("healthybowl.crops.list.errorState.retry", "Retry")
573
+ })
574
+ }) : /* @__PURE__ */ g(S, {
575
+ title: J("healthybowl.crops.list.emptyState.title", "No crops found"),
576
+ description: F || I !== "all" || L !== "all" ? J("healthybowl.crops.list.emptyState.filtered", "Try adjusting your filters") : J("healthybowl.crops.list.emptyState.message", "Get started by adding your first crop"),
577
+ icon: /* @__PURE__ */ g(p, { className: "h-12 w-12 text-text-secondary" }),
578
+ action: !F && I === "all" && L === "all" ? /* @__PURE__ */ _(y, {
579
+ onClick: () => R(!0),
580
+ children: [
581
+ /* @__PURE__ */ g(f, { className: "h-4 w-4" }),
582
+ " ",
583
+ J("healthybowl.crops.list.emptyState.addFirstCrop", "Add Your First Crop")
584
+ ]
585
+ }) : void 0
586
+ })),
587
+ /* @__PURE__ */ g(ve, {
588
+ open: Ie,
589
+ onOpenChange: (e) => {
590
+ e || X();
591
+ },
592
+ children: /* @__PURE__ */ _(ye, {
593
+ className: "sm:max-w-2xl",
594
+ children: [
595
+ /* @__PURE__ */ _(Se, { children: [/* @__PURE__ */ g(Ce, { children: V ? J("healthybowl.crops.list.modal.editTitle", "Edit {{name}}", { name: V.name }) : J("healthybowl.crops.list.modal.addTitle", "Add New Crop") }), /* @__PURE__ */ g(be, { children: V ? J("healthybowl.crops.list.modal.editDescription", "Update the crop details.") : J("healthybowl.crops.list.modal.addDescription", "Fill in the details to register a new crop on your farm.") })] }),
596
+ /* @__PURE__ */ _("div", {
597
+ className: "grid gap-4 sm:grid-cols-2",
598
+ children: [
599
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
733
600
  className: "text-sm font-medium text-text-primary",
734
- children: Y("healthybowl.crops.list.form.photos.label", "Photos")
735
- }), /* @__PURE__ */ x("div", {
736
- className: "mt-1",
737
- children: /* @__PURE__ */ x(a, {
738
- entity: "Crop",
739
- imageIds: L.imageIds,
740
- onChange: (e) => $("imageIds", e)
741
- })
742
- })]
743
- })
744
- ]
745
- })
746
- }),
747
- /* @__PURE__ */ x(ne, {
748
- toasts: Se,
749
- onDismiss: Ce
601
+ children: J("healthybowl.crops.list.form.name.label", "Crop Name *")
602
+ }), /* @__PURE__ */ g(C, {
603
+ type: "text",
604
+ value: z.name,
605
+ onChange: (e) => $("name", e.target.value),
606
+ placeholder: J("healthybowl.crops.list.form.name.placeholder", "e.g., Tomatoes"),
607
+ className: "mt-1"
608
+ })] }),
609
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
610
+ className: "text-sm font-medium text-text-primary",
611
+ children: J("healthybowl.crops.list.form.variety.label", "Variety *")
612
+ }), /* @__PURE__ */ g(C, {
613
+ type: "text",
614
+ value: z.variety,
615
+ onChange: (e) => $("variety", e.target.value),
616
+ placeholder: J("healthybowl.crops.list.form.variety.placeholder", "e.g., Roma"),
617
+ className: "mt-1"
618
+ })] }),
619
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
620
+ className: "text-sm font-medium text-text-primary",
621
+ children: J("healthybowl.crops.list.form.category.label", "Category")
622
+ }), /* @__PURE__ */ _(w, {
623
+ value: z.category,
624
+ onValueChange: (e) => $("category", e),
625
+ children: [/* @__PURE__ */ g(D, {
626
+ className: "mt-1",
627
+ children: /* @__PURE__ */ g(O, {})
628
+ }), /* @__PURE__ */ _(T, { children: [
629
+ /* @__PURE__ */ g(E, {
630
+ value: "Vegetables",
631
+ children: J("healthybowl.crops.list.form.category.vegetables", "Vegetables")
632
+ }),
633
+ /* @__PURE__ */ g(E, {
634
+ value: "Fruits",
635
+ children: J("healthybowl.crops.list.form.category.fruits", "Fruits")
636
+ }),
637
+ /* @__PURE__ */ g(E, {
638
+ value: "Herbs",
639
+ children: J("healthybowl.crops.list.form.category.herbs", "Herbs")
640
+ }),
641
+ /* @__PURE__ */ g(E, {
642
+ value: "Leafy Greens",
643
+ children: J("healthybowl.crops.list.form.category.leafyGreens", "Leafy Greens")
644
+ }),
645
+ /* @__PURE__ */ g(E, {
646
+ value: "Grains",
647
+ children: J("healthybowl.crops.list.form.category.grains", "Grains")
648
+ }),
649
+ /* @__PURE__ */ g(E, {
650
+ value: "Legumes",
651
+ children: J("healthybowl.crops.list.form.category.legumes", "Legumes")
652
+ })
653
+ ] })]
654
+ })] }),
655
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
656
+ className: "text-sm font-medium text-text-primary",
657
+ children: J("healthybowl.crops.list.form.season.label", "Season")
658
+ }), /* @__PURE__ */ _(w, {
659
+ value: z.season,
660
+ onValueChange: (e) => $("season", e),
661
+ children: [/* @__PURE__ */ g(D, {
662
+ className: "mt-1",
663
+ children: /* @__PURE__ */ g(O, {})
664
+ }), /* @__PURE__ */ _(T, { children: [
665
+ /* @__PURE__ */ g(E, {
666
+ value: "kharif",
667
+ children: J("healthybowl.crops.list.form.season.kharif", "Kharif (Summer)")
668
+ }),
669
+ /* @__PURE__ */ g(E, {
670
+ value: "rabi",
671
+ children: J("healthybowl.crops.list.form.season.rabi", "Rabi (Winter)")
672
+ }),
673
+ /* @__PURE__ */ g(E, {
674
+ value: "zaid",
675
+ children: J("healthybowl.crops.list.form.season.zaid", "Zaid (Spring)")
676
+ }),
677
+ /* @__PURE__ */ g(E, {
678
+ value: "perennial",
679
+ children: J("healthybowl.crops.list.form.season.perennial", "Perennial")
680
+ })
681
+ ] })]
682
+ })] }),
683
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
684
+ className: "text-sm font-medium text-text-primary",
685
+ children: J("healthybowl.crops.list.form.field.label", "Field *")
686
+ }), /* @__PURE__ */ _(w, {
687
+ value: z.field,
688
+ onValueChange: (e) => $("field", e),
689
+ children: [/* @__PURE__ */ g(D, {
690
+ className: "mt-1",
691
+ children: /* @__PURE__ */ g(O, { placeholder: J("healthybowl.crops.list.form.field.placeholder", "Select a field") })
692
+ }), /* @__PURE__ */ g(T, { children: N.map((e) => /* @__PURE__ */ _(E, {
693
+ value: e.id,
694
+ children: [
695
+ e.name,
696
+ " (",
697
+ e.area,
698
+ " ",
699
+ e.unit,
700
+ ")"
701
+ ]
702
+ }, e.id)) })]
703
+ })] }),
704
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
705
+ className: "text-sm font-medium text-text-primary",
706
+ children: J("healthybowl.crops.list.form.yieldEstimate.label", "Yield Estimate (kg)")
707
+ }), /* @__PURE__ */ g(C, {
708
+ type: "number",
709
+ min: 0,
710
+ value: z.yieldEstimate || "",
711
+ onChange: (e) => $("yieldEstimate", Number(e.target.value)),
712
+ placeholder: J("healthybowl.crops.list.form.yieldEstimate.placeholder", "e.g., 2500"),
713
+ className: "mt-1 tabular-nums"
714
+ })] }),
715
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
716
+ className: "text-sm font-medium text-text-primary",
717
+ children: J("healthybowl.crops.list.form.plantingDate.label", "Planting Date")
718
+ }), /* @__PURE__ */ g(C, {
719
+ type: "date",
720
+ value: z.plantingDate,
721
+ onChange: (e) => $("plantingDate", e.target.value),
722
+ className: "mt-1 tabular-nums"
723
+ })] }),
724
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
725
+ className: "text-sm font-medium text-text-primary",
726
+ children: J("healthybowl.crops.list.form.expectedHarvestDate.label", "Expected Harvest Date")
727
+ }), /* @__PURE__ */ g(C, {
728
+ type: "date",
729
+ value: z.expectedHarvestDate,
730
+ onChange: (e) => $("expectedHarvestDate", e.target.value),
731
+ className: "mt-1 tabular-nums"
732
+ })] }),
733
+ /* @__PURE__ */ _("div", {
734
+ className: "sm:col-span-2",
735
+ children: [/* @__PURE__ */ g("label", {
736
+ className: "text-sm font-medium text-text-primary",
737
+ children: J("healthybowl.crops.list.form.photos.label", "Photos")
738
+ }), /* @__PURE__ */ g("div", {
739
+ className: "mt-1",
740
+ children: /* @__PURE__ */ g(r, {
741
+ entity: "Crop",
742
+ imageIds: z.imageIds,
743
+ onChange: (e) => $("imageIds", e)
744
+ })
745
+ })]
746
+ })
747
+ ]
748
+ }),
749
+ /* @__PURE__ */ _(xe, { children: [/* @__PURE__ */ g(y, {
750
+ variant: "outline",
751
+ onClick: X,
752
+ children: J("healthybowl.common.cancel", "Cancel")
753
+ }), /* @__PURE__ */ _(y, {
754
+ onClick: Ve,
755
+ disabled: U,
756
+ children: [U ? /* @__PURE__ */ g(k, { size: "sm" }) : null, U ? J("healthybowl.crops.list.modal.saving", "Saving...") : V ? J("healthybowl.crops.list.modal.saveChanges", "Save Changes") : J("healthybowl.crops.list.modal.addCrop", "Add Crop")]
757
+ })] })
758
+ ]
750
759
  })
751
- ]
752
- });
760
+ }),
761
+ /* @__PURE__ */ g(n, {
762
+ toasts: Le,
763
+ onDismiss: Re
764
+ })
765
+ ] });
753
766
  };
754
767
  //#endregion
755
- export { w as CropsPage };
768
+ export { M as CropsPage };
756
769
 
757
770
  //# sourceMappingURL=CropsPage.js.map