@burdenoff/microfe-ecoimpacthub 2026.704.2 → 2026.704.4
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/ecoimpacthub/components/EcoDiscussion.js +109 -0
- package/dist/ecoimpacthub/components/EcoDiscussion.js.map +1 -0
- package/dist/ecoimpacthub/components/EcoTags.js +149 -0
- package/dist/ecoimpacthub/components/EcoTags.js.map +1 -0
- package/dist/ecoimpacthub/components/EvidenceUpload.js +93 -0
- package/dist/ecoimpacthub/components/EvidenceUpload.js.map +1 -0
- package/dist/ecoimpacthub/components/FileLink.js +36 -0
- package/dist/ecoimpacthub/components/FileLink.js.map +1 -0
- package/dist/ecoimpacthub/components/PageLayout.js +2 -2
- package/dist/ecoimpacthub/components/PageLayout.js.map +1 -1
- package/dist/ecoimpacthub/hooks/index.js +3 -0
- package/dist/ecoimpacthub/hooks/useEcoComments.js +45 -0
- package/dist/ecoimpacthub/hooks/useEcoComments.js.map +1 -0
- package/dist/ecoimpacthub/hooks/useEcoFiles.js +81 -0
- package/dist/ecoimpacthub/hooks/useEcoFiles.js.map +1 -0
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.js +169 -166
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.js.map +1 -1
- package/dist/ecoimpacthub/hooks/useEcoTags.js +89 -0
- package/dist/ecoimpacthub/hooks/useEcoTags.js.map +1 -0
- package/dist/ecoimpacthub/pages/carbon/CarbonPage.js +4 -0
- package/dist/ecoimpacthub/pages/carbon/CarbonPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/observations/ObservationsPage.js +124 -101
- package/dist/ecoimpacthub/pages/observations/ObservationsPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/reports/ReportDetailPage.js +153 -126
- package/dist/ecoimpacthub/pages/reports/ReportDetailPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/sites/SiteDetailPage.js +241 -230
- package/dist/ecoimpacthub/pages/sites/SiteDetailPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/species/SpeciesDetailPage.js +260 -225
- package/dist/ecoimpacthub/pages/species/SpeciesDetailPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { useEcoImpactHub as e } from "../../context/EcoImpactHubContext.js";
|
|
2
2
|
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
|
-
import { formatCoords as
|
|
4
|
-
import { StatusBadge as
|
|
5
|
-
import { ErrorView as
|
|
6
|
-
import { EmptyState as
|
|
3
|
+
import { formatCoords 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";
|
|
7
7
|
import "../../context/index.js";
|
|
8
|
-
import { useEcoArchiveSite as
|
|
8
|
+
import { useEcoArchiveSite as te, useEcoCreateSensor as ne, useEcoCreateThreshold as re, useEcoMeasurements as ie, useEcoRecordMeasurement as ae, useEcoSetSensorStatus as oe, useEcoSetThresholdActive as se, useEcoSite as ce } from "../../hooks/useEcoImpactHubApi.js";
|
|
9
9
|
import "../../hooks/index.js";
|
|
10
|
-
import { DataTable as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { DataTable as u } from "../../components/DataTable.js";
|
|
11
|
+
import { EcoTags as le } from "../../components/EcoTags.js";
|
|
12
|
+
import { useState as d } from "react";
|
|
13
|
+
import { Activity as ue, Archive as de, ArrowLeft as fe, Gauge as pe, Plus as f, Radio as p } from "lucide-react";
|
|
13
14
|
import { useParams as me } from "react-router-dom";
|
|
14
|
-
import { Fragment as he, jsx as
|
|
15
|
-
import { Button as
|
|
15
|
+
import { Fragment as he, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
16
|
+
import { Button as g, GlassCard as _, Input as v, Label as y, ResponsiveDialog as b, ResponsiveDialogContent as x, ResponsiveDialogDescription as S, ResponsiveDialogFooter as C, ResponsiveDialogHeader as w, ResponsiveDialogTitle as T, Select as E, SelectContent as D, SelectItem as O, SelectTrigger as k, SelectValue as A } from "@burdenoff/fe-libs/ui";
|
|
16
17
|
//#region src/ecoimpacthub/pages/sites/SiteDetailPage.tsx
|
|
17
18
|
var ge = [
|
|
18
19
|
"AIR_QUALITY",
|
|
@@ -39,19 +40,19 @@ var ge = [
|
|
|
39
40
|
"WARNING",
|
|
40
41
|
"CRITICAL"
|
|
41
42
|
];
|
|
42
|
-
function
|
|
43
|
-
let { id:
|
|
44
|
-
siteId:
|
|
43
|
+
function j() {
|
|
44
|
+
let { id: j } = me(), { navigateTo: M } = e(), { data: N, isLoading: be, isError: xe, refetch: Se } = ce(j), P = ie({
|
|
45
|
+
siteId: j,
|
|
45
46
|
pagination: {
|
|
46
47
|
limit: 10,
|
|
47
48
|
offset: 0
|
|
48
49
|
}
|
|
49
|
-
}),
|
|
50
|
+
}), F = ne(), I = oe(), L = re(), Ce = se(), R = ae(), z = te(), [we, B] = d(!1), [V, H] = d({
|
|
50
51
|
name: "",
|
|
51
52
|
kind: "AIR_QUALITY",
|
|
52
53
|
unit: "",
|
|
53
54
|
hardwareId: ""
|
|
54
|
-
}), [
|
|
55
|
+
}), [Te, U] = d(!1), [W, G] = d({
|
|
55
56
|
parameter: "",
|
|
56
57
|
unit: "",
|
|
57
58
|
direction: "ABOVE",
|
|
@@ -59,117 +60,127 @@ function A() {
|
|
|
59
60
|
limitValue: "",
|
|
60
61
|
minValue: "",
|
|
61
62
|
maxValue: ""
|
|
62
|
-
}), [
|
|
63
|
+
}), [Ee, K] = d(!1), [q, J] = d({
|
|
63
64
|
parameter: "",
|
|
64
65
|
value: "",
|
|
65
66
|
unit: "",
|
|
66
67
|
sensorId: ""
|
|
67
|
-
}), [Y, X] =
|
|
68
|
-
if (
|
|
68
|
+
}), [Y, X] = d(null);
|
|
69
|
+
if (be) return /* @__PURE__ */ m(t, {
|
|
69
70
|
title: "Site",
|
|
70
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ m(s, {})
|
|
71
72
|
});
|
|
72
|
-
if (
|
|
73
|
+
if (xe || !N) return /* @__PURE__ */ m(t, {
|
|
73
74
|
title: "Site",
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
+
children: /* @__PURE__ */ m(ee, {
|
|
75
76
|
message: "This site could not be loaded.",
|
|
76
|
-
onRetry: () =>
|
|
77
|
+
onRetry: () => Se()
|
|
77
78
|
})
|
|
78
79
|
});
|
|
79
|
-
let Z =
|
|
80
|
-
return /* @__PURE__ */
|
|
81
|
-
title:
|
|
82
|
-
description: [
|
|
83
|
-
actions: /* @__PURE__ */
|
|
80
|
+
let Z = N.sensors ?? [], Q = N.thresholds ?? [], $ = P.data?.items ?? [];
|
|
81
|
+
return /* @__PURE__ */ h(t, {
|
|
82
|
+
title: N.name,
|
|
83
|
+
description: [N.code, i(N.type)].filter(Boolean).join(" · "),
|
|
84
|
+
actions: /* @__PURE__ */ h(he, { children: [/* @__PURE__ */ m(o, { status: N.status }), /* @__PURE__ */ h(g, {
|
|
84
85
|
variant: "ghost",
|
|
85
|
-
onClick: () =>
|
|
86
|
-
children: [/* @__PURE__ */
|
|
86
|
+
onClick: () => M("sites"),
|
|
87
|
+
children: [/* @__PURE__ */ m(fe, { className: "mr-1.5 h-4 w-4" }), " Back"]
|
|
87
88
|
})] }),
|
|
88
89
|
children: [
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ h("div", {
|
|
90
91
|
className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
|
|
91
|
-
children: [/* @__PURE__ */
|
|
92
|
+
children: [/* @__PURE__ */ h(_, {
|
|
92
93
|
treatment: "glass",
|
|
93
94
|
className: "p-6 lg:col-span-2",
|
|
94
|
-
children: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ h("dl", {
|
|
97
|
+
className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3",
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
100
|
+
className: "text-xs text-text-tertiary",
|
|
101
|
+
children: "Type"
|
|
102
|
+
}), /* @__PURE__ */ m("dd", {
|
|
103
|
+
className: "mt-0.5 text-sm text-text-primary",
|
|
104
|
+
children: i(N.type)
|
|
105
|
+
})] }),
|
|
106
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
107
|
+
className: "text-xs text-text-tertiary",
|
|
108
|
+
children: "Region"
|
|
109
|
+
}), /* @__PURE__ */ m("dd", {
|
|
110
|
+
className: "mt-0.5 text-sm text-text-primary",
|
|
111
|
+
children: [N.region, N.country].filter(Boolean).join(", ") || "—"
|
|
112
|
+
})] }),
|
|
113
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
114
|
+
className: "text-xs text-text-tertiary",
|
|
115
|
+
children: "Area"
|
|
116
|
+
}), /* @__PURE__ */ m("dd", {
|
|
117
|
+
className: "mt-0.5 text-sm text-text-primary tabular-nums",
|
|
118
|
+
children: N.areaHectares == null ? "—" : `${a(N.areaHectares)} ha`
|
|
119
|
+
})] }),
|
|
120
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
121
|
+
className: "text-xs text-text-tertiary",
|
|
122
|
+
children: "Coordinates"
|
|
123
|
+
}), /* @__PURE__ */ m("dd", {
|
|
124
|
+
className: "mt-0.5 text-sm text-text-primary tabular-nums",
|
|
125
|
+
children: n(N.latitude, N.longitude)
|
|
126
|
+
})] }),
|
|
127
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
128
|
+
className: "text-xs text-text-tertiary",
|
|
129
|
+
children: "Sensors"
|
|
130
|
+
}), /* @__PURE__ */ m("dd", {
|
|
131
|
+
className: "mt-0.5 text-sm text-text-primary tabular-nums",
|
|
132
|
+
children: Z.length
|
|
133
|
+
})] }),
|
|
134
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
135
|
+
className: "text-xs text-text-tertiary",
|
|
136
|
+
children: "Thresholds"
|
|
137
|
+
}), /* @__PURE__ */ m("dd", {
|
|
138
|
+
className: "mt-0.5 text-sm text-text-primary tabular-nums",
|
|
139
|
+
children: Q.length
|
|
140
|
+
})] })
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
N.description && /* @__PURE__ */ m("p", {
|
|
144
|
+
className: "mt-5 rounded-lg bg-bg-sunken/60 p-3 text-sm text-text-secondary",
|
|
145
|
+
children: N.description
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ m("div", {
|
|
148
|
+
className: "mt-5 border-t border-border-seam pt-4",
|
|
149
|
+
children: /* @__PURE__ */ m(le, {
|
|
150
|
+
entityType: "ecoimpacthub-site",
|
|
151
|
+
entityId: N.id
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
}), /* @__PURE__ */ h(_, {
|
|
145
156
|
treatment: "glass",
|
|
146
157
|
className: "flex flex-col gap-3 p-6",
|
|
147
158
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ m("p", {
|
|
149
160
|
className: "text-xs text-text-tertiary",
|
|
150
161
|
children: "Quick actions"
|
|
151
162
|
}),
|
|
152
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ h(g, {
|
|
153
164
|
onClick: () => K(!0),
|
|
154
|
-
children: [/* @__PURE__ */
|
|
165
|
+
children: [/* @__PURE__ */ m(ue, { className: "mr-1.5 h-4 w-4" }), " Record measurement"]
|
|
155
166
|
}),
|
|
156
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ h(g, {
|
|
157
168
|
variant: "outline",
|
|
158
169
|
onClick: () => B(!0),
|
|
159
|
-
children: [/* @__PURE__ */ p
|
|
170
|
+
children: [/* @__PURE__ */ m(p, { className: "mr-1.5 h-4 w-4" }), " Add sensor"]
|
|
160
171
|
}),
|
|
161
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ h(g, {
|
|
162
173
|
variant: "outline",
|
|
163
174
|
onClick: () => U(!0),
|
|
164
|
-
children: [/* @__PURE__ */
|
|
175
|
+
children: [/* @__PURE__ */ m(pe, { className: "mr-1.5 h-4 w-4" }), " Add threshold"]
|
|
165
176
|
}),
|
|
166
|
-
|
|
177
|
+
N.status !== "ARCHIVED" && /* @__PURE__ */ h(g, {
|
|
167
178
|
variant: "ghost",
|
|
168
179
|
onClick: async () => {
|
|
169
|
-
if (
|
|
180
|
+
if (j) {
|
|
170
181
|
X(null);
|
|
171
182
|
try {
|
|
172
|
-
await z.mutateAsync(
|
|
183
|
+
await z.mutateAsync(j), M("sites");
|
|
173
184
|
} catch (e) {
|
|
174
185
|
X(e instanceof Error ? e.message : "Failed to archive site.");
|
|
175
186
|
}
|
|
@@ -177,45 +188,45 @@ function A() {
|
|
|
177
188
|
},
|
|
178
189
|
disabled: z.isPending,
|
|
179
190
|
className: "text-status-error-text hover:text-status-error-text",
|
|
180
|
-
children: [/* @__PURE__ */
|
|
191
|
+
children: [/* @__PURE__ */ m(de, { className: "mr-1.5 h-4 w-4" }), " Archive site"]
|
|
181
192
|
})
|
|
182
193
|
]
|
|
183
194
|
})]
|
|
184
195
|
}),
|
|
185
|
-
Y && /* @__PURE__ */
|
|
196
|
+
Y && /* @__PURE__ */ m("p", {
|
|
186
197
|
className: "mt-4 text-sm text-status-error-text",
|
|
187
198
|
children: Y
|
|
188
199
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ m(c, {
|
|
190
201
|
title: "Sensors",
|
|
191
202
|
description: "Instruments streaming or recording readings for this site.",
|
|
192
|
-
action: /* @__PURE__ */
|
|
203
|
+
action: /* @__PURE__ */ h(g, {
|
|
193
204
|
size: "sm",
|
|
194
205
|
onClick: () => B(!0),
|
|
195
|
-
children: [/* @__PURE__ */
|
|
206
|
+
children: [/* @__PURE__ */ m(f, { className: "mr-1.5 h-4 w-4" }), " Add sensor"]
|
|
196
207
|
}),
|
|
197
|
-
children: Z.length === 0 ? /* @__PURE__ */
|
|
208
|
+
children: Z.length === 0 ? /* @__PURE__ */ m(l, {
|
|
198
209
|
illustration: "empty-data",
|
|
199
210
|
title: "No sensors",
|
|
200
211
|
description: "Add a sensor to begin monitoring."
|
|
201
|
-
}) : /* @__PURE__ */
|
|
212
|
+
}) : /* @__PURE__ */ m(u, {
|
|
202
213
|
columns: [
|
|
203
214
|
{
|
|
204
215
|
key: "name",
|
|
205
216
|
header: "Sensor",
|
|
206
|
-
render: (e) => /* @__PURE__ */
|
|
217
|
+
render: (e) => /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
|
|
207
218
|
className: "font-medium text-text-primary",
|
|
208
219
|
children: e.name
|
|
209
|
-
}), /* @__PURE__ */
|
|
220
|
+
}), /* @__PURE__ */ m("p", {
|
|
210
221
|
className: "text-xs text-text-tertiary",
|
|
211
|
-
children:
|
|
222
|
+
children: i(e.kind)
|
|
212
223
|
})] })
|
|
213
224
|
},
|
|
214
225
|
{
|
|
215
226
|
key: "unit",
|
|
216
227
|
header: "Unit",
|
|
217
228
|
hideOnMobile: !0,
|
|
218
|
-
render: (e) => /* @__PURE__ */
|
|
229
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
219
230
|
className: "text-text-secondary",
|
|
220
231
|
children: e.unit ?? "—"
|
|
221
232
|
})
|
|
@@ -223,24 +234,24 @@ function A() {
|
|
|
223
234
|
{
|
|
224
235
|
key: "status",
|
|
225
236
|
header: "Status",
|
|
226
|
-
render: (e) => /* @__PURE__ */
|
|
237
|
+
render: (e) => /* @__PURE__ */ m(o, { status: e.status })
|
|
227
238
|
},
|
|
228
239
|
{
|
|
229
240
|
key: "action",
|
|
230
241
|
header: "",
|
|
231
242
|
align: "right",
|
|
232
|
-
render: (e) => /* @__PURE__ */
|
|
243
|
+
render: (e) => /* @__PURE__ */ h(E, {
|
|
233
244
|
value: e.status,
|
|
234
|
-
onValueChange: (t) =>
|
|
245
|
+
onValueChange: (t) => I.mutate({
|
|
235
246
|
id: e.id,
|
|
236
247
|
status: t
|
|
237
248
|
}),
|
|
238
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ m(k, {
|
|
239
250
|
className: "h-8 w-36",
|
|
240
|
-
children: /* @__PURE__ */
|
|
241
|
-
}), /* @__PURE__ */
|
|
251
|
+
children: /* @__PURE__ */ m(A, {})
|
|
252
|
+
}), /* @__PURE__ */ m(D, { children: _e.map((e) => /* @__PURE__ */ m(O, {
|
|
242
253
|
value: e,
|
|
243
|
-
children:
|
|
254
|
+
children: i(e)
|
|
244
255
|
}, e)) })]
|
|
245
256
|
})
|
|
246
257
|
}
|
|
@@ -249,24 +260,24 @@ function A() {
|
|
|
249
260
|
rowKey: (e) => e.id
|
|
250
261
|
})
|
|
251
262
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ m(c, {
|
|
253
264
|
title: "Alert thresholds",
|
|
254
265
|
description: "Rules that flag measurements as breaches when values drift out of range.",
|
|
255
|
-
action: /* @__PURE__ */
|
|
266
|
+
action: /* @__PURE__ */ h(g, {
|
|
256
267
|
size: "sm",
|
|
257
268
|
onClick: () => U(!0),
|
|
258
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ m(f, { className: "mr-1.5 h-4 w-4" }), " Add threshold"]
|
|
259
270
|
}),
|
|
260
|
-
children: Q.length === 0 ? /* @__PURE__ */
|
|
271
|
+
children: Q.length === 0 ? /* @__PURE__ */ m(l, {
|
|
261
272
|
illustration: "empty-data",
|
|
262
273
|
title: "No thresholds",
|
|
263
274
|
description: "Define a threshold to flag breaches."
|
|
264
|
-
}) : /* @__PURE__ */
|
|
275
|
+
}) : /* @__PURE__ */ m(u, {
|
|
265
276
|
columns: [
|
|
266
277
|
{
|
|
267
278
|
key: "parameter",
|
|
268
279
|
header: "Parameter",
|
|
269
|
-
render: (e) => /* @__PURE__ */
|
|
280
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
270
281
|
className: "font-medium text-text-primary",
|
|
271
282
|
children: e.parameter
|
|
272
283
|
})
|
|
@@ -274,24 +285,24 @@ function A() {
|
|
|
274
285
|
{
|
|
275
286
|
key: "rule",
|
|
276
287
|
header: "Rule",
|
|
277
|
-
render: (e) => /* @__PURE__ */
|
|
288
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
278
289
|
className: "text-text-secondary",
|
|
279
|
-
children: e.direction === "OUTSIDE_RANGE" ? `${
|
|
290
|
+
children: e.direction === "OUTSIDE_RANGE" ? `${a(e.minValue)}–${a(e.maxValue)} ${e.unit}` : `${i(e.direction)} ${a(e.limitValue)} ${e.unit}`
|
|
280
291
|
})
|
|
281
292
|
},
|
|
282
293
|
{
|
|
283
294
|
key: "severity",
|
|
284
295
|
header: "Severity",
|
|
285
|
-
render: (e) => /* @__PURE__ */
|
|
296
|
+
render: (e) => /* @__PURE__ */ m(o, { status: e.severity })
|
|
286
297
|
},
|
|
287
298
|
{
|
|
288
299
|
key: "active",
|
|
289
300
|
header: "Active",
|
|
290
301
|
align: "right",
|
|
291
|
-
render: (e) => /* @__PURE__ */
|
|
302
|
+
render: (e) => /* @__PURE__ */ m(g, {
|
|
292
303
|
size: "sm",
|
|
293
304
|
variant: e.isActive ? "outline" : "ghost",
|
|
294
|
-
onClick: () =>
|
|
305
|
+
onClick: () => Ce.mutate({
|
|
295
306
|
id: e.id,
|
|
296
307
|
isActive: !e.isActive
|
|
297
308
|
}),
|
|
@@ -303,19 +314,19 @@ function A() {
|
|
|
303
314
|
rowKey: (e) => e.id
|
|
304
315
|
})
|
|
305
316
|
}),
|
|
306
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ m(c, {
|
|
307
318
|
title: "Recent measurements",
|
|
308
319
|
description: "The latest readings recorded at this site.",
|
|
309
|
-
children: $.length === 0 ? /* @__PURE__ */
|
|
320
|
+
children: $.length === 0 ? /* @__PURE__ */ m(l, {
|
|
310
321
|
illustration: "empty-data",
|
|
311
322
|
title: "No measurements yet",
|
|
312
323
|
description: "Record a measurement to see it here."
|
|
313
|
-
}) : /* @__PURE__ */
|
|
324
|
+
}) : /* @__PURE__ */ m(u, {
|
|
314
325
|
columns: [
|
|
315
326
|
{
|
|
316
327
|
key: "parameter",
|
|
317
328
|
header: "Parameter",
|
|
318
|
-
render: (e) => /* @__PURE__ */
|
|
329
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
319
330
|
className: "font-medium text-text-primary",
|
|
320
331
|
children: e.parameter
|
|
321
332
|
})
|
|
@@ -324,10 +335,10 @@ function A() {
|
|
|
324
335
|
key: "value",
|
|
325
336
|
header: "Value",
|
|
326
337
|
align: "right",
|
|
327
|
-
render: (e) => /* @__PURE__ */
|
|
338
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
328
339
|
className: "tabular-nums text-text-primary",
|
|
329
340
|
children: [
|
|
330
|
-
|
|
341
|
+
a(e.value),
|
|
331
342
|
" ",
|
|
332
343
|
e.unit
|
|
333
344
|
]
|
|
@@ -337,24 +348,24 @@ function A() {
|
|
|
337
348
|
key: "source",
|
|
338
349
|
header: "Source",
|
|
339
350
|
hideOnMobile: !0,
|
|
340
|
-
render: (e) => /* @__PURE__ */
|
|
351
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
341
352
|
className: "text-text-secondary",
|
|
342
|
-
children:
|
|
353
|
+
children: i(e.source)
|
|
343
354
|
})
|
|
344
355
|
},
|
|
345
356
|
{
|
|
346
357
|
key: "breach",
|
|
347
358
|
header: "Status",
|
|
348
|
-
render: (e) => e.isBreach ? /* @__PURE__ */
|
|
359
|
+
render: (e) => e.isBreach ? /* @__PURE__ */ m(o, { status: "BREACH" }) : /* @__PURE__ */ m(o, { status: "OK" })
|
|
349
360
|
},
|
|
350
361
|
{
|
|
351
362
|
key: "recorded",
|
|
352
363
|
header: "Recorded",
|
|
353
364
|
align: "right",
|
|
354
365
|
hideOnMobile: !0,
|
|
355
|
-
render: (e) => /* @__PURE__ */
|
|
366
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
356
367
|
className: "text-text-tertiary",
|
|
357
|
-
children:
|
|
368
|
+
children: r(e.recordedAt)
|
|
358
369
|
})
|
|
359
370
|
}
|
|
360
371
|
],
|
|
@@ -362,24 +373,24 @@ function A() {
|
|
|
362
373
|
rowKey: (e) => e.id
|
|
363
374
|
})
|
|
364
375
|
}),
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
open:
|
|
376
|
+
/* @__PURE__ */ m(b, {
|
|
377
|
+
open: we,
|
|
367
378
|
onOpenChange: B,
|
|
368
|
-
children: /* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */
|
|
379
|
+
children: /* @__PURE__ */ h(x, { children: [
|
|
380
|
+
/* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(T, { children: "Add sensor" }), /* @__PURE__ */ h(S, { children: [
|
|
370
381
|
"Register a sensor at ",
|
|
371
|
-
|
|
382
|
+
N.name,
|
|
372
383
|
"."
|
|
373
384
|
] })] }),
|
|
374
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ h("div", {
|
|
375
386
|
className: "grid gap-4 py-2",
|
|
376
387
|
children: [
|
|
377
|
-
/* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ h("div", {
|
|
378
389
|
className: "grid gap-1.5",
|
|
379
|
-
children: [/* @__PURE__ */
|
|
390
|
+
children: [/* @__PURE__ */ m(y, {
|
|
380
391
|
htmlFor: "sensorName",
|
|
381
392
|
children: "Name *"
|
|
382
|
-
}), /* @__PURE__ */
|
|
393
|
+
}), /* @__PURE__ */ m(v, {
|
|
383
394
|
id: "sensorName",
|
|
384
395
|
value: V.name,
|
|
385
396
|
onChange: (e) => H({
|
|
@@ -389,33 +400,33 @@ function A() {
|
|
|
389
400
|
placeholder: "North gate PM2.5"
|
|
390
401
|
})]
|
|
391
402
|
}),
|
|
392
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ h("div", {
|
|
393
404
|
className: "grid gap-2 sm:grid-cols-2",
|
|
394
|
-
children: [/* @__PURE__ */
|
|
405
|
+
children: [/* @__PURE__ */ h("div", {
|
|
395
406
|
className: "grid gap-1.5",
|
|
396
|
-
children: [/* @__PURE__ */
|
|
407
|
+
children: [/* @__PURE__ */ m(y, {
|
|
397
408
|
htmlFor: "sensorKind",
|
|
398
409
|
children: "Kind"
|
|
399
|
-
}), /* @__PURE__ */
|
|
410
|
+
}), /* @__PURE__ */ h(E, {
|
|
400
411
|
value: V.kind,
|
|
401
412
|
onValueChange: (e) => H({
|
|
402
413
|
...V,
|
|
403
414
|
kind: e
|
|
404
415
|
}),
|
|
405
|
-
children: [/* @__PURE__ */
|
|
416
|
+
children: [/* @__PURE__ */ m(k, {
|
|
406
417
|
id: "sensorKind",
|
|
407
|
-
children: /* @__PURE__ */
|
|
408
|
-
}), /* @__PURE__ */
|
|
418
|
+
children: /* @__PURE__ */ m(A, {})
|
|
419
|
+
}), /* @__PURE__ */ m(D, { children: ge.map((e) => /* @__PURE__ */ m(O, {
|
|
409
420
|
value: e,
|
|
410
|
-
children:
|
|
421
|
+
children: i(e)
|
|
411
422
|
}, e)) })]
|
|
412
423
|
})]
|
|
413
|
-
}), /* @__PURE__ */
|
|
424
|
+
}), /* @__PURE__ */ h("div", {
|
|
414
425
|
className: "grid gap-1.5",
|
|
415
|
-
children: [/* @__PURE__ */
|
|
426
|
+
children: [/* @__PURE__ */ m(y, {
|
|
416
427
|
htmlFor: "sensorUnit",
|
|
417
428
|
children: "Unit"
|
|
418
|
-
}), /* @__PURE__ */
|
|
429
|
+
}), /* @__PURE__ */ m(v, {
|
|
419
430
|
id: "sensorUnit",
|
|
420
431
|
value: V.unit,
|
|
421
432
|
onChange: (e) => H({
|
|
@@ -426,12 +437,12 @@ function A() {
|
|
|
426
437
|
})]
|
|
427
438
|
})]
|
|
428
439
|
}),
|
|
429
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ h("div", {
|
|
430
441
|
className: "grid gap-1.5",
|
|
431
|
-
children: [/* @__PURE__ */
|
|
442
|
+
children: [/* @__PURE__ */ m(y, {
|
|
432
443
|
htmlFor: "sensorHw",
|
|
433
444
|
children: "Hardware ID"
|
|
434
|
-
}), /* @__PURE__ */
|
|
445
|
+
}), /* @__PURE__ */ m(v, {
|
|
435
446
|
id: "sensorHw",
|
|
436
447
|
value: V.hardwareId,
|
|
437
448
|
onChange: (e) => H({
|
|
@@ -443,21 +454,21 @@ function A() {
|
|
|
443
454
|
})
|
|
444
455
|
]
|
|
445
456
|
}),
|
|
446
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(g, {
|
|
447
458
|
variant: "outline",
|
|
448
459
|
onClick: () => B(!1),
|
|
449
460
|
children: "Cancel"
|
|
450
|
-
}), /* @__PURE__ */
|
|
461
|
+
}), /* @__PURE__ */ m(g, {
|
|
451
462
|
onClick: async () => {
|
|
452
|
-
if (!
|
|
463
|
+
if (!j || !V.name.trim()) {
|
|
453
464
|
X("Sensor name is required.");
|
|
454
465
|
return;
|
|
455
466
|
}
|
|
456
467
|
X(null);
|
|
457
468
|
try {
|
|
458
|
-
await
|
|
469
|
+
await F.mutateAsync({
|
|
459
470
|
name: V.name.trim(),
|
|
460
|
-
siteId:
|
|
471
|
+
siteId: j,
|
|
461
472
|
kind: V.kind,
|
|
462
473
|
unit: V.unit.trim() || null,
|
|
463
474
|
hardwareId: V.hardwareId.trim() || null
|
|
@@ -471,27 +482,27 @@ function A() {
|
|
|
471
482
|
X(e instanceof Error ? e.message : "Failed to add sensor.");
|
|
472
483
|
}
|
|
473
484
|
},
|
|
474
|
-
disabled:
|
|
475
|
-
children:
|
|
485
|
+
disabled: F.isPending,
|
|
486
|
+
children: F.isPending ? "Adding…" : "Add sensor"
|
|
476
487
|
})] })
|
|
477
488
|
] })
|
|
478
489
|
}),
|
|
479
|
-
/* @__PURE__ */
|
|
480
|
-
open:
|
|
490
|
+
/* @__PURE__ */ m(b, {
|
|
491
|
+
open: Te,
|
|
481
492
|
onOpenChange: U,
|
|
482
|
-
children: /* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */
|
|
484
|
-
/* @__PURE__ */
|
|
493
|
+
children: /* @__PURE__ */ h(x, { children: [
|
|
494
|
+
/* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(T, { children: "Add alert threshold" }), /* @__PURE__ */ m(S, { children: "Flag readings that drift out of an acceptable range." })] }),
|
|
495
|
+
/* @__PURE__ */ h("div", {
|
|
485
496
|
className: "grid gap-4 py-2",
|
|
486
497
|
children: [
|
|
487
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ h("div", {
|
|
488
499
|
className: "grid gap-2 sm:grid-cols-2",
|
|
489
|
-
children: [/* @__PURE__ */
|
|
500
|
+
children: [/* @__PURE__ */ h("div", {
|
|
490
501
|
className: "grid gap-1.5",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
502
|
+
children: [/* @__PURE__ */ m(y, {
|
|
492
503
|
htmlFor: "thParam",
|
|
493
504
|
children: "Parameter *"
|
|
494
|
-
}), /* @__PURE__ */
|
|
505
|
+
}), /* @__PURE__ */ m(v, {
|
|
495
506
|
id: "thParam",
|
|
496
507
|
value: W.parameter,
|
|
497
508
|
onChange: (e) => G({
|
|
@@ -500,12 +511,12 @@ function A() {
|
|
|
500
511
|
}),
|
|
501
512
|
placeholder: "PM2.5"
|
|
502
513
|
})]
|
|
503
|
-
}), /* @__PURE__ */
|
|
514
|
+
}), /* @__PURE__ */ h("div", {
|
|
504
515
|
className: "grid gap-1.5",
|
|
505
|
-
children: [/* @__PURE__ */
|
|
516
|
+
children: [/* @__PURE__ */ m(y, {
|
|
506
517
|
htmlFor: "thUnit",
|
|
507
518
|
children: "Unit *"
|
|
508
|
-
}), /* @__PURE__ */
|
|
519
|
+
}), /* @__PURE__ */ m(v, {
|
|
509
520
|
id: "thUnit",
|
|
510
521
|
value: W.unit,
|
|
511
522
|
onChange: (e) => G({
|
|
@@ -516,56 +527,56 @@ function A() {
|
|
|
516
527
|
})]
|
|
517
528
|
})]
|
|
518
529
|
}),
|
|
519
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ h("div", {
|
|
520
531
|
className: "grid gap-2 sm:grid-cols-2",
|
|
521
|
-
children: [/* @__PURE__ */
|
|
532
|
+
children: [/* @__PURE__ */ h("div", {
|
|
522
533
|
className: "grid gap-1.5",
|
|
523
|
-
children: [/* @__PURE__ */
|
|
534
|
+
children: [/* @__PURE__ */ m(y, {
|
|
524
535
|
htmlFor: "thDir",
|
|
525
536
|
children: "Direction"
|
|
526
|
-
}), /* @__PURE__ */
|
|
537
|
+
}), /* @__PURE__ */ h(E, {
|
|
527
538
|
value: W.direction,
|
|
528
539
|
onValueChange: (e) => G({
|
|
529
540
|
...W,
|
|
530
541
|
direction: e
|
|
531
542
|
}),
|
|
532
|
-
children: [/* @__PURE__ */
|
|
543
|
+
children: [/* @__PURE__ */ m(k, {
|
|
533
544
|
id: "thDir",
|
|
534
|
-
children: /* @__PURE__ */
|
|
535
|
-
}), /* @__PURE__ */
|
|
545
|
+
children: /* @__PURE__ */ m(A, {})
|
|
546
|
+
}), /* @__PURE__ */ m(D, { children: ve.map((e) => /* @__PURE__ */ m(O, {
|
|
536
547
|
value: e,
|
|
537
|
-
children:
|
|
548
|
+
children: i(e)
|
|
538
549
|
}, e)) })]
|
|
539
550
|
})]
|
|
540
|
-
}), /* @__PURE__ */
|
|
551
|
+
}), /* @__PURE__ */ h("div", {
|
|
541
552
|
className: "grid gap-1.5",
|
|
542
|
-
children: [/* @__PURE__ */
|
|
553
|
+
children: [/* @__PURE__ */ m(y, {
|
|
543
554
|
htmlFor: "thSev",
|
|
544
555
|
children: "Severity"
|
|
545
|
-
}), /* @__PURE__ */
|
|
556
|
+
}), /* @__PURE__ */ h(E, {
|
|
546
557
|
value: W.severity,
|
|
547
558
|
onValueChange: (e) => G({
|
|
548
559
|
...W,
|
|
549
560
|
severity: e
|
|
550
561
|
}),
|
|
551
|
-
children: [/* @__PURE__ */
|
|
562
|
+
children: [/* @__PURE__ */ m(k, {
|
|
552
563
|
id: "thSev",
|
|
553
|
-
children: /* @__PURE__ */
|
|
554
|
-
}), /* @__PURE__ */
|
|
564
|
+
children: /* @__PURE__ */ m(A, {})
|
|
565
|
+
}), /* @__PURE__ */ m(D, { children: ye.map((e) => /* @__PURE__ */ m(O, {
|
|
555
566
|
value: e,
|
|
556
|
-
children:
|
|
567
|
+
children: i(e)
|
|
557
568
|
}, e)) })]
|
|
558
569
|
})]
|
|
559
570
|
})]
|
|
560
571
|
}),
|
|
561
|
-
W.direction === "OUTSIDE_RANGE" ? /* @__PURE__ */
|
|
572
|
+
W.direction === "OUTSIDE_RANGE" ? /* @__PURE__ */ h("div", {
|
|
562
573
|
className: "grid gap-2 sm:grid-cols-2",
|
|
563
|
-
children: [/* @__PURE__ */
|
|
574
|
+
children: [/* @__PURE__ */ h("div", {
|
|
564
575
|
className: "grid gap-1.5",
|
|
565
|
-
children: [/* @__PURE__ */
|
|
576
|
+
children: [/* @__PURE__ */ m(y, {
|
|
566
577
|
htmlFor: "thMin",
|
|
567
578
|
children: "Min value"
|
|
568
|
-
}), /* @__PURE__ */
|
|
579
|
+
}), /* @__PURE__ */ m(v, {
|
|
569
580
|
id: "thMin",
|
|
570
581
|
type: "number",
|
|
571
582
|
step: "any",
|
|
@@ -575,12 +586,12 @@ function A() {
|
|
|
575
586
|
minValue: e.target.value
|
|
576
587
|
})
|
|
577
588
|
})]
|
|
578
|
-
}), /* @__PURE__ */
|
|
589
|
+
}), /* @__PURE__ */ h("div", {
|
|
579
590
|
className: "grid gap-1.5",
|
|
580
|
-
children: [/* @__PURE__ */
|
|
591
|
+
children: [/* @__PURE__ */ m(y, {
|
|
581
592
|
htmlFor: "thMax",
|
|
582
593
|
children: "Max value"
|
|
583
|
-
}), /* @__PURE__ */
|
|
594
|
+
}), /* @__PURE__ */ m(v, {
|
|
584
595
|
id: "thMax",
|
|
585
596
|
type: "number",
|
|
586
597
|
step: "any",
|
|
@@ -591,12 +602,12 @@ function A() {
|
|
|
591
602
|
})
|
|
592
603
|
})]
|
|
593
604
|
})]
|
|
594
|
-
}) : /* @__PURE__ */
|
|
605
|
+
}) : /* @__PURE__ */ h("div", {
|
|
595
606
|
className: "grid gap-1.5",
|
|
596
|
-
children: [/* @__PURE__ */
|
|
607
|
+
children: [/* @__PURE__ */ m(y, {
|
|
597
608
|
htmlFor: "thLimit",
|
|
598
609
|
children: "Limit value"
|
|
599
|
-
}), /* @__PURE__ */
|
|
610
|
+
}), /* @__PURE__ */ m(v, {
|
|
600
611
|
id: "thLimit",
|
|
601
612
|
type: "number",
|
|
602
613
|
step: "any",
|
|
@@ -610,20 +621,20 @@ function A() {
|
|
|
610
621
|
})
|
|
611
622
|
]
|
|
612
623
|
}),
|
|
613
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(g, {
|
|
614
625
|
variant: "outline",
|
|
615
626
|
onClick: () => U(!1),
|
|
616
627
|
children: "Cancel"
|
|
617
|
-
}), /* @__PURE__ */
|
|
628
|
+
}), /* @__PURE__ */ m(g, {
|
|
618
629
|
onClick: async () => {
|
|
619
|
-
if (!
|
|
630
|
+
if (!j || !W.parameter.trim() || !W.unit.trim()) {
|
|
620
631
|
X("Parameter and unit are required.");
|
|
621
632
|
return;
|
|
622
633
|
}
|
|
623
634
|
X(null);
|
|
624
635
|
try {
|
|
625
636
|
await L.mutateAsync({
|
|
626
|
-
siteId:
|
|
637
|
+
siteId: j,
|
|
627
638
|
parameter: W.parameter.trim(),
|
|
628
639
|
unit: W.unit.trim(),
|
|
629
640
|
direction: W.direction,
|
|
@@ -649,22 +660,22 @@ function A() {
|
|
|
649
660
|
})] })
|
|
650
661
|
] })
|
|
651
662
|
}),
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
open:
|
|
663
|
+
/* @__PURE__ */ m(b, {
|
|
664
|
+
open: Ee,
|
|
654
665
|
onOpenChange: K,
|
|
655
|
-
children: /* @__PURE__ */
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
666
|
+
children: /* @__PURE__ */ h(x, { children: [
|
|
667
|
+
/* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(T, { children: "Record measurement" }), /* @__PURE__ */ m(S, { children: "Log a reading. It is checked against active thresholds and flagged if it breaches." })] }),
|
|
668
|
+
/* @__PURE__ */ h("div", {
|
|
658
669
|
className: "grid gap-4 py-2",
|
|
659
|
-
children: [/* @__PURE__ */
|
|
670
|
+
children: [/* @__PURE__ */ h("div", {
|
|
660
671
|
className: "grid gap-2 sm:grid-cols-3",
|
|
661
672
|
children: [
|
|
662
|
-
/* @__PURE__ */
|
|
673
|
+
/* @__PURE__ */ h("div", {
|
|
663
674
|
className: "grid gap-1.5 sm:col-span-1",
|
|
664
|
-
children: [/* @__PURE__ */
|
|
675
|
+
children: [/* @__PURE__ */ m(y, {
|
|
665
676
|
htmlFor: "mParam",
|
|
666
677
|
children: "Parameter *"
|
|
667
|
-
}), /* @__PURE__ */
|
|
678
|
+
}), /* @__PURE__ */ m(v, {
|
|
668
679
|
id: "mParam",
|
|
669
680
|
value: q.parameter,
|
|
670
681
|
onChange: (e) => J({
|
|
@@ -674,12 +685,12 @@ function A() {
|
|
|
674
685
|
placeholder: "PM2.5"
|
|
675
686
|
})]
|
|
676
687
|
}),
|
|
677
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ h("div", {
|
|
678
689
|
className: "grid gap-1.5",
|
|
679
|
-
children: [/* @__PURE__ */
|
|
690
|
+
children: [/* @__PURE__ */ m(y, {
|
|
680
691
|
htmlFor: "mValue",
|
|
681
692
|
children: "Value *"
|
|
682
|
-
}), /* @__PURE__ */
|
|
693
|
+
}), /* @__PURE__ */ m(v, {
|
|
683
694
|
id: "mValue",
|
|
684
695
|
type: "number",
|
|
685
696
|
step: "any",
|
|
@@ -691,12 +702,12 @@ function A() {
|
|
|
691
702
|
placeholder: "42"
|
|
692
703
|
})]
|
|
693
704
|
}),
|
|
694
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ h("div", {
|
|
695
706
|
className: "grid gap-1.5",
|
|
696
|
-
children: [/* @__PURE__ */
|
|
707
|
+
children: [/* @__PURE__ */ m(y, {
|
|
697
708
|
htmlFor: "mUnit",
|
|
698
709
|
children: "Unit *"
|
|
699
|
-
}), /* @__PURE__ */
|
|
710
|
+
}), /* @__PURE__ */ m(v, {
|
|
700
711
|
id: "mUnit",
|
|
701
712
|
value: q.unit,
|
|
702
713
|
onChange: (e) => J({
|
|
@@ -707,41 +718,41 @@ function A() {
|
|
|
707
718
|
})]
|
|
708
719
|
})
|
|
709
720
|
]
|
|
710
|
-
}), Z.length > 0 && /* @__PURE__ */
|
|
721
|
+
}), Z.length > 0 && /* @__PURE__ */ h("div", {
|
|
711
722
|
className: "grid gap-1.5",
|
|
712
|
-
children: [/* @__PURE__ */
|
|
723
|
+
children: [/* @__PURE__ */ m(y, {
|
|
713
724
|
htmlFor: "mSensor",
|
|
714
725
|
children: "Sensor (optional)"
|
|
715
|
-
}), /* @__PURE__ */
|
|
726
|
+
}), /* @__PURE__ */ h(E, {
|
|
716
727
|
value: q.sensorId,
|
|
717
728
|
onValueChange: (e) => J({
|
|
718
729
|
...q,
|
|
719
730
|
sensorId: e
|
|
720
731
|
}),
|
|
721
|
-
children: [/* @__PURE__ */
|
|
732
|
+
children: [/* @__PURE__ */ m(k, {
|
|
722
733
|
id: "mSensor",
|
|
723
|
-
children: /* @__PURE__ */
|
|
724
|
-
}), /* @__PURE__ */
|
|
734
|
+
children: /* @__PURE__ */ m(A, { placeholder: "Manual entry" })
|
|
735
|
+
}), /* @__PURE__ */ m(D, { children: Z.map((e) => /* @__PURE__ */ m(O, {
|
|
725
736
|
value: e.id,
|
|
726
737
|
children: e.name
|
|
727
738
|
}, e.id)) })]
|
|
728
739
|
})]
|
|
729
740
|
})]
|
|
730
741
|
}),
|
|
731
|
-
/* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(g, {
|
|
732
743
|
variant: "outline",
|
|
733
744
|
onClick: () => K(!1),
|
|
734
745
|
children: "Cancel"
|
|
735
|
-
}), /* @__PURE__ */
|
|
746
|
+
}), /* @__PURE__ */ m(g, {
|
|
736
747
|
onClick: async () => {
|
|
737
|
-
if (!
|
|
748
|
+
if (!j || !q.parameter.trim() || !q.unit.trim() || !q.value) {
|
|
738
749
|
X("Parameter, value and unit are required.");
|
|
739
750
|
return;
|
|
740
751
|
}
|
|
741
752
|
X(null);
|
|
742
753
|
try {
|
|
743
754
|
await R.mutateAsync({
|
|
744
|
-
siteId:
|
|
755
|
+
siteId: j,
|
|
745
756
|
parameter: q.parameter.trim(),
|
|
746
757
|
value: Number(q.value),
|
|
747
758
|
unit: q.unit.trim(),
|
|
@@ -753,7 +764,7 @@ function A() {
|
|
|
753
764
|
value: "",
|
|
754
765
|
unit: "",
|
|
755
766
|
sensorId: ""
|
|
756
|
-
}),
|
|
767
|
+
}), P.refetch();
|
|
757
768
|
} catch (e) {
|
|
758
769
|
X(e instanceof Error ? e.message : "Failed to record measurement.");
|
|
759
770
|
}
|
|
@@ -767,6 +778,6 @@ function A() {
|
|
|
767
778
|
});
|
|
768
779
|
}
|
|
769
780
|
//#endregion
|
|
770
|
-
export {
|
|
781
|
+
export { j as SiteDetailPage };
|
|
771
782
|
|
|
772
783
|
//# sourceMappingURL=SiteDetailPage.js.map
|