@burdenoff/microfe-ecoimpacthub 2026.704.4 → 2026.704.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.
Files changed (47) hide show
  1. package/dist/ecoimpacthub/pages/DashboardPage.js +345 -189
  2. package/dist/ecoimpacthub/pages/DashboardPage.js.map +1 -1
  3. package/dist/ecoimpacthub/pages/_shared/ConservationBadge.js +58 -0
  4. package/dist/ecoimpacthub/pages/_shared/ConservationBadge.js.map +1 -0
  5. package/dist/ecoimpacthub/pages/_shared/EvidenceThumb.js +70 -0
  6. package/dist/ecoimpacthub/pages/_shared/EvidenceThumb.js.map +1 -0
  7. package/dist/ecoimpacthub/pages/_shared/MethodBadge.js +51 -0
  8. package/dist/ecoimpacthub/pages/_shared/MethodBadge.js.map +1 -0
  9. package/dist/ecoimpacthub/pages/_shared/TaxonChip.js +29 -0
  10. package/dist/ecoimpacthub/pages/_shared/TaxonChip.js.map +1 -0
  11. package/dist/ecoimpacthub/pages/badges.js +71 -0
  12. package/dist/ecoimpacthub/pages/badges.js.map +1 -0
  13. package/dist/ecoimpacthub/pages/carbon/CarbonPage.js +337 -300
  14. package/dist/ecoimpacthub/pages/carbon/CarbonPage.js.map +1 -1
  15. package/dist/ecoimpacthub/pages/carbonVisuals.js +89 -0
  16. package/dist/ecoimpacthub/pages/carbonVisuals.js.map +1 -0
  17. package/dist/ecoimpacthub/pages/habitat/HabitatProjectDetailPage.js +252 -218
  18. package/dist/ecoimpacthub/pages/habitat/HabitatProjectDetailPage.js.map +1 -1
  19. package/dist/ecoimpacthub/pages/habitat/HabitatProjectsPage.js +15 -12
  20. package/dist/ecoimpacthub/pages/habitat/HabitatProjectsPage.js.map +1 -1
  21. package/dist/ecoimpacthub/pages/habitat/LifecycleProgress.js +168 -0
  22. package/dist/ecoimpacthub/pages/habitat/LifecycleProgress.js.map +1 -0
  23. package/dist/ecoimpacthub/pages/monitoring/MonitoringPage.js +30 -17
  24. package/dist/ecoimpacthub/pages/monitoring/MonitoringPage.js.map +1 -1
  25. package/dist/ecoimpacthub/pages/observations/ObservationsPage.js +236 -219
  26. package/dist/ecoimpacthub/pages/observations/ObservationsPage.js.map +1 -1
  27. package/dist/ecoimpacthub/pages/reports/ReportDetailPage.js +248 -212
  28. package/dist/ecoimpacthub/pages/reports/ReportDetailPage.js.map +1 -1
  29. package/dist/ecoimpacthub/pages/reports/ReportsPage.js +119 -118
  30. package/dist/ecoimpacthub/pages/reports/ReportsPage.js.map +1 -1
  31. package/dist/ecoimpacthub/pages/sites/SiteDetailPage.js +498 -370
  32. package/dist/ecoimpacthub/pages/sites/SiteDetailPage.js.map +1 -1
  33. package/dist/ecoimpacthub/pages/sites/SitesPage.js +109 -99
  34. package/dist/ecoimpacthub/pages/sites/SitesPage.js.map +1 -1
  35. package/dist/ecoimpacthub/pages/sites/siteTypeVisuals.js +64 -0
  36. package/dist/ecoimpacthub/pages/sites/siteTypeVisuals.js.map +1 -0
  37. package/dist/ecoimpacthub/pages/species/SpeciesDetailPage.js +275 -259
  38. package/dist/ecoimpacthub/pages/species/SpeciesDetailPage.js.map +1 -1
  39. package/dist/ecoimpacthub/pages/species/SpeciesPage.js +235 -177
  40. package/dist/ecoimpacthub/pages/species/SpeciesPage.js.map +1 -1
  41. package/dist/node_modules/recharts/es6/cartesian/CartesianGrid.js +305 -0
  42. package/dist/node_modules/recharts/es6/cartesian/CartesianGrid.js.map +1 -0
  43. package/dist/node_modules/recharts/es6/context/chartLayoutContext.js +44 -33
  44. package/dist/node_modules/recharts/es6/context/chartLayoutContext.js.map +1 -1
  45. package/dist/node_modules/recharts/es6/util/ChartUtils.js +31 -23
  46. package/dist/node_modules/recharts/es6/util/ChartUtils.js.map +1 -1
  47. package/package.json +1 -1
@@ -1,20 +1,22 @@
1
1
  import { useEcoImpactHub as e } from "../../context/EcoImpactHubContext.js";
2
2
  import { PageLayout as t } from "../../components/PageLayout.js";
3
- import { formatDate as n, formatDateTime as r, formatEnumLabel as i, formatNumber as a } from "../../utils/formatters.js";
4
- import { StatusBadge as o } from "../../components/StatusBadge.js";
5
- import { ErrorView as ee, LoadingView as s, Section as c } from "../../components/StateViews.js";
6
- import { EmptyState as l } from "../../components/EmptyState.js";
3
+ import { formatDate as n, formatDateTime as ee, formatEnumLabel as r, formatNumber as i } from "../../utils/formatters.js";
4
+ import { ErrorView as te, LoadingView as ne, Section as re } from "../../components/StateViews.js";
5
+ import { EmptyState as a } from "../../components/EmptyState.js";
7
6
  import "../../context/index.js";
8
- import { useEcoHabitatProject as u, useEcoLogRestorationActivity as d, useEcoTransitionHabitatProject as f } from "../../hooks/useEcoImpactHubApi.js";
7
+ import { useEcoHabitatProject as ie, useEcoLogRestorationActivity as o, useEcoSites as ae, useEcoTransitionHabitatProject as oe } from "../../hooks/useEcoImpactHubApi.js";
9
8
  import "../../hooks/index.js";
10
- import { DataTable as te } from "../../components/DataTable.js";
11
- import { useState as p } from "react";
12
- import { ArrowLeft as m, Plus as h, Sprout as g } from "lucide-react";
13
- import { useParams as _ } from "react-router-dom";
14
- import { Fragment as ne, jsx as v, jsxs as y } from "react/jsx-runtime";
15
- import { Button as b, GlassCard as x, Input as S, Label as C, ResponsiveDialog as re, ResponsiveDialogContent as w, ResponsiveDialogDescription as T, ResponsiveDialogFooter as E, ResponsiveDialogHeader as D, ResponsiveDialogTitle as O, Select as k, SelectContent as A, SelectItem as j, SelectTrigger as M, SelectValue as N, Textarea as P } from "@burdenoff/fe-libs/ui";
9
+ import { DataTable as se } from "../../components/DataTable.js";
10
+ import { EcoTags as ce } from "../../components/EcoTags.js";
11
+ import { ActivityTypeBadge as s, LifecycleBadge as c } from "../badges.js";
12
+ import { LifecycleProgress as le } from "./LifecycleProgress.js";
13
+ import { useMemo as l, useState as u } from "react";
14
+ import { ArrowLeft as ue, ArrowRight as d, Plus as f, Sprout as de } from "lucide-react";
15
+ import { useParams as fe } from "react-router-dom";
16
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
17
+ import { Button as h, GlassCard as g, Input as _, Label as v, ResponsiveDialog as y, ResponsiveDialogContent as b, ResponsiveDialogDescription as x, ResponsiveDialogFooter as S, ResponsiveDialogHeader as C, ResponsiveDialogTitle as w, Select as T, SelectContent as E, SelectItem as D, SelectTrigger as O, SelectValue as k, Textarea as A } from "@burdenoff/fe-libs/ui";
16
18
  //#region src/ecoimpacthub/pages/habitat/HabitatProjectDetailPage.tsx
17
- var F = {
19
+ var j = {
18
20
  PLANNED: [
19
21
  "IN_PROGRESS",
20
22
  "ON_HOLD",
@@ -30,7 +32,7 @@ var F = {
30
32
  ON_HOLD: ["IN_PROGRESS", "CANCELLED"],
31
33
  COMPLETED: [],
32
34
  CANCELLED: []
33
- }, I = [
35
+ }, M = [
34
36
  "PLANTING",
35
37
  "INVASIVE_REMOVAL",
36
38
  "REWILDING",
@@ -38,185 +40,212 @@ var F = {
38
40
  "SOIL_REMEDIATION",
39
41
  "COMMUNITY_ENGAGEMENT",
40
42
  "SURVEY"
41
- ], L = () => {
43
+ ], N = () => {
42
44
  let e = /* @__PURE__ */ new Date();
43
45
  return (/* @__PURE__ */ new Date(e.getTime() - e.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16);
44
- }, R = () => ({
46
+ }, P = () => ({
45
47
  type: "PLANTING",
46
48
  summary: "",
47
49
  details: "",
48
50
  quantity: "",
49
51
  unit: "",
50
- performedAt: L()
52
+ performedAt: N()
51
53
  });
52
- function z() {
53
- let { id: L } = _(), { navigateTo: z } = e(), { data: B, isLoading: V, isError: H, refetch: U } = u(L), W = f(), G = d(), [K, q] = p(!1), [J, Y] = p(R), [X, Z] = p(null);
54
- if (V) return /* @__PURE__ */ v(t, {
54
+ function F({ label: e, children: t }) {
55
+ return /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("dt", {
56
+ className: "text-xs text-text-tertiary",
57
+ children: e
58
+ }), /* @__PURE__ */ p("dd", {
59
+ className: "mt-1 text-sm text-text-primary",
60
+ children: t
61
+ })] });
62
+ }
63
+ function I() {
64
+ let { id: N } = fe(), { navigateTo: I } = e(), { data: L, isLoading: R, isError: z, refetch: B } = ie(N), V = ae({ pagination: {
65
+ limit: 100,
66
+ offset: 0
67
+ } }), H = oe(), U = o(), [pe, W] = u(!1), [G, K] = u(P), [q, J] = u(null), Y = L?.siteId ?? null, X = V.data?.items, Z = l(() => Y ? X?.find((e) => e.id === Y)?.name ?? null : null, [Y, X]);
68
+ if (R) return /* @__PURE__ */ p(t, {
55
69
  title: "Habitat project",
56
- children: /* @__PURE__ */ v(s, {})
70
+ children: /* @__PURE__ */ p(ne, {})
57
71
  });
58
- if (H || !B) return /* @__PURE__ */ v(t, {
72
+ if (z || !L) return /* @__PURE__ */ p(t, {
59
73
  title: "Habitat project",
60
- children: /* @__PURE__ */ v(ee, {
74
+ children: /* @__PURE__ */ p(te, {
61
75
  message: "This project could not be loaded.",
62
- onRetry: () => U()
76
+ onRetry: () => B()
63
77
  })
64
78
  });
65
- let Q = B.activities ?? [], $ = F[B.status], ie = async (e) => {
66
- if (L) {
67
- Z(null);
79
+ let Q = L.activities ?? [], $ = j[L.status], me = [Z, [n(L.startDate), n(L.endDate)].join(" – ")].filter((e) => e && e !== "— – —").join(" · "), he = async (e) => {
80
+ if (N) {
81
+ J(null);
68
82
  try {
69
- await W.mutateAsync({
70
- id: L,
83
+ await H.mutateAsync({
84
+ id: N,
71
85
  status: e
72
86
  });
73
87
  } catch (e) {
74
- Z(e instanceof Error ? e.message : "Failed to update project status.");
88
+ J(e instanceof Error ? e.message : "Failed to update project status.");
75
89
  }
76
90
  }
77
91
  };
78
- return /* @__PURE__ */ y(t, {
79
- title: B.name,
80
- description: i(B.status),
81
- actions: /* @__PURE__ */ y(ne, { children: [/* @__PURE__ */ v(o, { status: B.status }), /* @__PURE__ */ y(b, {
92
+ return /* @__PURE__ */ m(t, {
93
+ title: /* @__PURE__ */ m("span", {
94
+ className: "flex flex-wrap items-center gap-x-3 gap-y-2",
95
+ children: [/* @__PURE__ */ p("span", {
96
+ className: "text-text-primary",
97
+ children: L.name
98
+ }), /* @__PURE__ */ p(c, { status: L.status })]
99
+ }),
100
+ description: me || void 0,
101
+ actions: /* @__PURE__ */ m(h, {
82
102
  variant: "ghost",
83
- onClick: () => z("habitat"),
84
- children: [/* @__PURE__ */ v(m, { className: "mr-1.5 h-4 w-4" }), " Back"]
85
- })] }),
103
+ onClick: () => I("habitat"),
104
+ children: [/* @__PURE__ */ p(ue, { className: "mr-1.5 h-4 w-4" }), " Back"]
105
+ }),
86
106
  children: [
87
- /* @__PURE__ */ y("div", {
88
- className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
89
- children: [/* @__PURE__ */ y(x, {
90
- treatment: "glass",
91
- className: "p-6 lg:col-span-2",
92
- children: [/* @__PURE__ */ y("dl", {
93
- className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3",
107
+ /* @__PURE__ */ m("div", {
108
+ className: "grid grid-cols-1 gap-4 lg:grid-cols-4",
109
+ children: [
110
+ /* @__PURE__ */ m(g, {
111
+ treatment: "glass",
112
+ className: "p-6 lg:col-span-2",
94
113
  children: [
95
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", {
96
- className: "text-xs text-text-tertiary",
97
- children: "Status"
98
- }), /* @__PURE__ */ v("dd", {
99
- className: "mt-1",
100
- children: /* @__PURE__ */ v(o, { status: B.status })
101
- })] }),
102
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", {
103
- className: "text-xs text-text-tertiary",
104
- children: "Target area"
105
- }), /* @__PURE__ */ v("dd", {
106
- className: "mt-0.5 text-sm text-text-primary tabular-nums",
107
- children: B.targetHectares == null ? "—" : `${a(B.targetHectares)} ha`
108
- })] }),
109
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", {
110
- className: "text-xs text-text-tertiary",
111
- children: "Budget"
112
- }), /* @__PURE__ */ y("dd", {
113
- className: "mt-0.5 text-sm text-text-primary tabular-nums",
114
+ /* @__PURE__ */ m("dl", {
115
+ className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3",
114
116
  children: [
115
- a(B.budgetAmount),
116
- " ",
117
- B.currency
117
+ /* @__PURE__ */ p(F, {
118
+ label: "Status",
119
+ children: /* @__PURE__ */ p(c, { status: L.status })
120
+ }),
121
+ /* @__PURE__ */ p(F, {
122
+ label: "Target area",
123
+ children: /* @__PURE__ */ p("span", {
124
+ className: "tabular-nums",
125
+ children: L.targetHectares == null ? "—" : `${i(L.targetHectares)} ha`
126
+ })
127
+ }),
128
+ /* @__PURE__ */ p(F, {
129
+ label: "Budget",
130
+ children: /* @__PURE__ */ p("span", {
131
+ className: "tabular-nums",
132
+ children: L.budgetAmount > 0 ? `${i(L.budgetAmount)} ${L.currency}` : "—"
133
+ })
134
+ }),
135
+ /* @__PURE__ */ p(F, {
136
+ label: "Start",
137
+ children: n(L.startDate)
138
+ }),
139
+ /* @__PURE__ */ p(F, {
140
+ label: "End",
141
+ children: n(L.endDate)
142
+ }),
143
+ /* @__PURE__ */ p(F, {
144
+ label: L.completedAt ? "Completed" : "Site",
145
+ children: L.completedAt ? n(L.completedAt) : Z ?? "—"
146
+ }),
147
+ L.completedAt && /* @__PURE__ */ p(F, {
148
+ label: "Site",
149
+ children: Z ?? "—"
150
+ })
118
151
  ]
119
- })] }),
120
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", {
121
- className: "text-xs text-text-tertiary",
122
- children: "Start"
123
- }), /* @__PURE__ */ v("dd", {
124
- className: "mt-0.5 text-sm text-text-primary",
125
- children: n(B.startDate)
126
- })] }),
127
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", {
128
- className: "text-xs text-text-tertiary",
129
- children: "End"
130
- }), /* @__PURE__ */ v("dd", {
131
- className: "mt-0.5 text-sm text-text-primary",
132
- children: n(B.endDate)
133
- })] }),
134
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", {
135
- className: "text-xs text-text-tertiary",
136
- children: "Completed"
137
- }), /* @__PURE__ */ v("dd", {
138
- className: "mt-0.5 text-sm text-text-primary",
139
- children: n(B.completedAt)
140
- })] }),
141
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("dt", {
142
- className: "text-xs text-text-tertiary",
143
- children: "Site"
144
- }), /* @__PURE__ */ v("dd", {
145
- className: "mt-0.5 text-sm text-text-primary",
146
- children: B.siteId ?? "—"
147
- })] })
152
+ }),
153
+ L.description && /* @__PURE__ */ p("p", {
154
+ className: "mt-5 rounded-lg bg-bg-sunken/60 p-3 text-sm text-text-secondary",
155
+ children: L.description
156
+ }),
157
+ /* @__PURE__ */ p("div", {
158
+ className: "mt-5 border-t border-border-seam pt-4",
159
+ children: /* @__PURE__ */ p(ce, {
160
+ entityType: "ecoimpacthub-habitat",
161
+ entityId: L.id
162
+ })
163
+ })
148
164
  ]
149
- }), B.description && /* @__PURE__ */ v("p", {
150
- className: "mt-5 rounded-lg bg-bg-sunken/60 p-3 text-sm text-text-secondary",
151
- children: B.description
152
- })]
153
- }), /* @__PURE__ */ y("div", {
154
- className: "flex flex-col gap-4",
155
- children: [/* @__PURE__ */ y(x, {
165
+ }),
166
+ /* @__PURE__ */ m(g, {
156
167
  treatment: "glass",
157
- className: "flex flex-col gap-3 p-6",
158
- children: [/* @__PURE__ */ v("p", {
159
- className: "text-xs text-text-tertiary",
160
- children: "Quick actions"
161
- }), /* @__PURE__ */ y(b, {
162
- onClick: () => q(!0),
163
- children: [/* @__PURE__ */ v(h, { className: "mr-1.5 h-4 w-4" }), " Log activity"]
168
+ className: "flex flex-col p-6",
169
+ children: [/* @__PURE__ */ p("p", {
170
+ className: "mb-2 text-xs font-medium uppercase tracking-wide text-text-tertiary",
171
+ children: "Lifecycle progress"
172
+ }), /* @__PURE__ */ p("div", {
173
+ className: "flex flex-1 items-center justify-center",
174
+ children: /* @__PURE__ */ p(le, { status: L.status })
164
175
  })]
165
- }), /* @__PURE__ */ y(x, {
176
+ }),
177
+ /* @__PURE__ */ m(g, {
166
178
  treatment: "glass",
167
179
  className: "flex flex-col gap-3 p-6",
168
- children: [/* @__PURE__ */ v("p", {
169
- className: "text-xs text-text-tertiary",
170
- children: "Advance project"
171
- }), $.length === 0 ? /* @__PURE__ */ y("p", {
172
- className: "text-sm text-text-secondary",
173
- children: [
174
- "This project is ",
175
- i(B.status).toLowerCase(),
176
- " — no further transitions."
177
- ]
178
- }) : $.map((e) => /* @__PURE__ */ v(b, {
179
- variant: "outline",
180
- onClick: () => ie(e),
181
- disabled: W.isPending,
182
- children: i(e)
183
- }, e))]
184
- })]
185
- })]
180
+ children: [
181
+ /* @__PURE__ */ p("p", {
182
+ className: "text-xs font-medium uppercase tracking-wide text-text-tertiary",
183
+ children: "Advance project"
184
+ }),
185
+ $.length === 0 ? /* @__PURE__ */ m("p", {
186
+ className: "text-sm text-text-secondary",
187
+ children: [
188
+ "This project is ",
189
+ r(L.status).toLowerCase(),
190
+ " — no further transitions."
191
+ ]
192
+ }) : $.map((e) => /* @__PURE__ */ m(h, {
193
+ variant: "outline",
194
+ onClick: () => he(e),
195
+ disabled: H.isPending,
196
+ className: "justify-between",
197
+ children: [r(e), /* @__PURE__ */ p(d, { className: "h-4 w-4 opacity-60" })]
198
+ }, e)),
199
+ /* @__PURE__ */ m(h, {
200
+ className: "mt-auto",
201
+ onClick: () => W(!0),
202
+ children: [/* @__PURE__ */ p(f, { className: "mr-1.5 h-4 w-4" }), " Log activity"]
203
+ })
204
+ ]
205
+ })
206
+ ]
186
207
  }),
187
- X && /* @__PURE__ */ v("p", {
208
+ q && /* @__PURE__ */ p("p", {
188
209
  className: "mt-4 text-sm text-status-error-text",
189
- children: X
210
+ children: q
190
211
  }),
191
- /* @__PURE__ */ v(c, {
212
+ /* @__PURE__ */ p(re, {
192
213
  title: "Restoration activities",
193
214
  description: "Work logged against this project — planting, removals, surveys & engagement.",
194
- action: /* @__PURE__ */ y(b, {
215
+ action: /* @__PURE__ */ m(h, {
195
216
  size: "sm",
196
- onClick: () => q(!0),
197
- children: [/* @__PURE__ */ v(h, { className: "mr-1.5 h-4 w-4" }), " Log activity"]
217
+ onClick: () => W(!0),
218
+ children: [/* @__PURE__ */ p(f, { className: "mr-1.5 h-4 w-4" }), " Log activity"]
198
219
  }),
199
- children: Q.length === 0 ? /* @__PURE__ */ v(l, {
220
+ children: Q.length === 0 ? /* @__PURE__ */ p(a, {
200
221
  illustration: "empty-data",
201
- icon: /* @__PURE__ */ v(g, { className: "h-10 w-10" }),
222
+ icon: /* @__PURE__ */ p(de, { className: "h-10 w-10" }),
202
223
  title: "No activities yet",
203
- description: "Log restoration work to build this project's field record."
204
- }) : /* @__PURE__ */ v(te, {
224
+ description: "Log restoration work to build this project's field record.",
225
+ action: /* @__PURE__ */ m(h, {
226
+ size: "sm",
227
+ onClick: () => W(!0),
228
+ children: [/* @__PURE__ */ p(f, { className: "mr-1.5 h-4 w-4" }), " Log activity"]
229
+ })
230
+ }) : /* @__PURE__ */ p(se, {
205
231
  columns: [
206
232
  {
207
233
  key: "type",
208
234
  header: "Type",
209
- render: (e) => /* @__PURE__ */ v("span", {
210
- className: "font-medium text-text-primary",
211
- children: i(e.type)
212
- })
235
+ render: (e) => /* @__PURE__ */ p(s, { type: e.type })
213
236
  },
214
237
  {
215
238
  key: "summary",
216
239
  header: "Summary",
217
- render: (e) => /* @__PURE__ */ v("span", {
218
- className: "text-text-secondary",
219
- children: e.summary
240
+ render: (e) => /* @__PURE__ */ m("div", {
241
+ className: "min-w-0",
242
+ children: [/* @__PURE__ */ p("p", {
243
+ className: "text-text-primary",
244
+ children: e.summary
245
+ }), e.details && /* @__PURE__ */ p("p", {
246
+ className: "mt-0.5 max-w-md truncate text-xs text-text-tertiary",
247
+ children: e.details
248
+ })]
220
249
  })
221
250
  },
222
251
  {
@@ -225,12 +254,12 @@ function z() {
225
254
  align: "right",
226
255
  hideOnMobile: !0,
227
256
  sortValue: (e) => e.quantity ?? 0,
228
- render: (e) => e.quantity == null ? /* @__PURE__ */ v("span", {
257
+ render: (e) => e.quantity == null ? /* @__PURE__ */ p("span", {
229
258
  className: "text-text-tertiary",
230
259
  children: "—"
231
- }) : /* @__PURE__ */ y("span", {
260
+ }) : /* @__PURE__ */ m("span", {
232
261
  className: "tabular-nums text-text-secondary",
233
- children: [a(e.quantity), e.unit ? ` ${e.unit}` : ""]
262
+ children: [i(e.quantity), e.unit ? ` ${e.unit}` : ""]
234
263
  })
235
264
  },
236
265
  {
@@ -238,124 +267,129 @@ function z() {
238
267
  header: "Performed",
239
268
  align: "right",
240
269
  hideOnMobile: !0,
241
- render: (e) => /* @__PURE__ */ v("span", {
270
+ sortValue: (e) => e.performedAt,
271
+ render: (e) => /* @__PURE__ */ p("span", {
242
272
  className: "text-text-tertiary",
243
- children: r(e.performedAt)
273
+ children: ee(e.performedAt)
244
274
  })
245
275
  }
246
276
  ],
247
277
  rows: Q,
248
- rowKey: (e) => e.id
278
+ rowKey: (e) => e.id,
279
+ defaultSort: {
280
+ key: "performedAt",
281
+ dir: "desc"
282
+ }
249
283
  })
250
284
  }),
251
- /* @__PURE__ */ v(re, {
252
- open: K,
253
- onOpenChange: q,
254
- children: /* @__PURE__ */ y(w, { children: [
255
- /* @__PURE__ */ y(D, { children: [/* @__PURE__ */ v(O, { children: "Log restoration activity" }), /* @__PURE__ */ y(T, { children: [
285
+ /* @__PURE__ */ p(y, {
286
+ open: pe,
287
+ onOpenChange: W,
288
+ children: /* @__PURE__ */ m(b, { children: [
289
+ /* @__PURE__ */ m(C, { children: [/* @__PURE__ */ p(w, { children: "Log restoration activity" }), /* @__PURE__ */ m(x, { children: [
256
290
  "Record a piece of work performed for ",
257
- B.name,
291
+ L.name,
258
292
  "."
259
293
  ] })] }),
260
- /* @__PURE__ */ y("div", {
294
+ /* @__PURE__ */ m("div", {
261
295
  className: "grid gap-4 py-2",
262
296
  children: [
263
- /* @__PURE__ */ y("div", {
297
+ /* @__PURE__ */ m("div", {
264
298
  className: "grid gap-2 sm:grid-cols-2",
265
- children: [/* @__PURE__ */ y("div", {
299
+ children: [/* @__PURE__ */ m("div", {
266
300
  className: "grid gap-1.5",
267
- children: [/* @__PURE__ */ v(C, {
301
+ children: [/* @__PURE__ */ p(v, {
268
302
  htmlFor: "actType",
269
303
  children: "Type"
270
- }), /* @__PURE__ */ y(k, {
271
- value: J.type,
272
- onValueChange: (e) => Y({
273
- ...J,
304
+ }), /* @__PURE__ */ m(T, {
305
+ value: G.type,
306
+ onValueChange: (e) => K({
307
+ ...G,
274
308
  type: e
275
309
  }),
276
- children: [/* @__PURE__ */ v(M, {
310
+ children: [/* @__PURE__ */ p(O, {
277
311
  id: "actType",
278
- children: /* @__PURE__ */ v(N, {})
279
- }), /* @__PURE__ */ v(A, { children: I.map((e) => /* @__PURE__ */ v(j, {
312
+ children: /* @__PURE__ */ p(k, {})
313
+ }), /* @__PURE__ */ p(E, { children: M.map((e) => /* @__PURE__ */ p(D, {
280
314
  value: e,
281
- children: i(e)
315
+ children: r(e)
282
316
  }, e)) })]
283
317
  })]
284
- }), /* @__PURE__ */ y("div", {
318
+ }), /* @__PURE__ */ m("div", {
285
319
  className: "grid gap-1.5",
286
- children: [/* @__PURE__ */ v(C, {
320
+ children: [/* @__PURE__ */ p(v, {
287
321
  htmlFor: "actPerformedAt",
288
322
  children: "Performed at"
289
- }), /* @__PURE__ */ v(S, {
323
+ }), /* @__PURE__ */ p(_, {
290
324
  id: "actPerformedAt",
291
325
  type: "datetime-local",
292
- value: J.performedAt,
293
- onChange: (e) => Y({
294
- ...J,
326
+ value: G.performedAt,
327
+ onChange: (e) => K({
328
+ ...G,
295
329
  performedAt: e.target.value
296
330
  })
297
331
  })]
298
332
  })]
299
333
  }),
300
- /* @__PURE__ */ y("div", {
334
+ /* @__PURE__ */ m("div", {
301
335
  className: "grid gap-1.5",
302
- children: [/* @__PURE__ */ v(C, {
336
+ children: [/* @__PURE__ */ p(v, {
303
337
  htmlFor: "actSummary",
304
338
  children: "Summary *"
305
- }), /* @__PURE__ */ v(S, {
339
+ }), /* @__PURE__ */ p(_, {
306
340
  id: "actSummary",
307
- value: J.summary,
308
- onChange: (e) => Y({
309
- ...J,
341
+ value: G.summary,
342
+ onChange: (e) => K({
343
+ ...G,
310
344
  summary: e.target.value
311
345
  }),
312
346
  placeholder: "Planted 500 mangrove saplings"
313
347
  })]
314
348
  }),
315
- /* @__PURE__ */ y("div", {
349
+ /* @__PURE__ */ m("div", {
316
350
  className: "grid gap-1.5",
317
- children: [/* @__PURE__ */ v(C, {
351
+ children: [/* @__PURE__ */ p(v, {
318
352
  htmlFor: "actDetails",
319
353
  children: "Details"
320
- }), /* @__PURE__ */ v(P, {
354
+ }), /* @__PURE__ */ p(A, {
321
355
  id: "actDetails",
322
- value: J.details,
323
- onChange: (e) => Y({
324
- ...J,
356
+ value: G.details,
357
+ onChange: (e) => K({
358
+ ...G,
325
359
  details: e.target.value
326
360
  }),
327
361
  placeholder: "Optional notes about the work.",
328
362
  rows: 2
329
363
  })]
330
364
  }),
331
- /* @__PURE__ */ y("div", {
365
+ /* @__PURE__ */ m("div", {
332
366
  className: "grid gap-2 sm:grid-cols-2",
333
- children: [/* @__PURE__ */ y("div", {
367
+ children: [/* @__PURE__ */ m("div", {
334
368
  className: "grid gap-1.5",
335
- children: [/* @__PURE__ */ v(C, {
369
+ children: [/* @__PURE__ */ p(v, {
336
370
  htmlFor: "actQuantity",
337
371
  children: "Quantity"
338
- }), /* @__PURE__ */ v(S, {
372
+ }), /* @__PURE__ */ p(_, {
339
373
  id: "actQuantity",
340
374
  type: "number",
341
375
  step: "any",
342
- value: J.quantity,
343
- onChange: (e) => Y({
344
- ...J,
376
+ value: G.quantity,
377
+ onChange: (e) => K({
378
+ ...G,
345
379
  quantity: e.target.value
346
380
  }),
347
381
  placeholder: "500"
348
382
  })]
349
- }), /* @__PURE__ */ y("div", {
383
+ }), /* @__PURE__ */ m("div", {
350
384
  className: "grid gap-1.5",
351
- children: [/* @__PURE__ */ v(C, {
385
+ children: [/* @__PURE__ */ p(v, {
352
386
  htmlFor: "actUnit",
353
387
  children: "Unit"
354
- }), /* @__PURE__ */ v(S, {
388
+ }), /* @__PURE__ */ p(_, {
355
389
  id: "actUnit",
356
- value: J.unit,
357
- onChange: (e) => Y({
358
- ...J,
390
+ value: G.unit,
391
+ onChange: (e) => K({
392
+ ...G,
359
393
  unit: e.target.value
360
394
  }),
361
395
  placeholder: "saplings"
@@ -364,33 +398,33 @@ function z() {
364
398
  })
365
399
  ]
366
400
  }),
367
- /* @__PURE__ */ y(E, { children: [/* @__PURE__ */ v(b, {
401
+ /* @__PURE__ */ m(S, { children: [/* @__PURE__ */ p(h, {
368
402
  variant: "outline",
369
- onClick: () => q(!1),
403
+ onClick: () => W(!1),
370
404
  children: "Cancel"
371
- }), /* @__PURE__ */ v(b, {
405
+ }), /* @__PURE__ */ p(h, {
372
406
  onClick: async () => {
373
- if (!L || !J.summary.trim()) {
374
- Z("Activity summary is required.");
407
+ if (!N || !G.summary.trim()) {
408
+ J("Activity summary is required.");
375
409
  return;
376
410
  }
377
- Z(null);
411
+ J(null);
378
412
  try {
379
- await G.mutateAsync({
380
- projectId: L,
381
- type: J.type,
382
- summary: J.summary.trim(),
383
- details: J.details.trim() || null,
384
- quantity: J.quantity ? Number(J.quantity) : null,
385
- unit: J.unit.trim() || null,
386
- performedAt: J.performedAt ? new Date(J.performedAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString()
387
- }), q(!1), Y(R());
413
+ await U.mutateAsync({
414
+ projectId: N,
415
+ type: G.type,
416
+ summary: G.summary.trim(),
417
+ details: G.details.trim() || null,
418
+ quantity: G.quantity ? Number(G.quantity) : null,
419
+ unit: G.unit.trim() || null,
420
+ performedAt: G.performedAt ? new Date(G.performedAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString()
421
+ }), W(!1), K(P());
388
422
  } catch (e) {
389
- Z(e instanceof Error ? e.message : "Failed to log activity.");
423
+ J(e instanceof Error ? e.message : "Failed to log activity.");
390
424
  }
391
425
  },
392
- disabled: G.isPending,
393
- children: G.isPending ? "Logging…" : "Log activity"
426
+ disabled: U.isPending,
427
+ children: U.isPending ? "Logging…" : "Log activity"
394
428
  })] })
395
429
  ] })
396
430
  })
@@ -398,6 +432,6 @@ function z() {
398
432
  });
399
433
  }
400
434
  //#endregion
401
- export { z as HabitatProjectDetailPage };
435
+ export { I as HabitatProjectDetailPage };
402
436
 
403
437
  //# sourceMappingURL=HabitatProjectDetailPage.js.map