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