@burdenoff/microfe-assethandler 2026.826.1 → 2026.826.3
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/assethandler/pages/EsgDashboardPage.d.ts +43 -0
- package/dist/assethandler/pages/EsgDashboardPage.d.ts.map +1 -1
- package/dist/assethandler/pages/EsgDashboardPage.js +263 -165
- package/dist/assethandler/pages/EsgDashboardPage.js.map +1 -1
- package/dist/assethandler/pages/MaintenanceMaintenancePlansPage.d.ts.map +1 -1
- package/dist/assethandler/pages/MaintenanceMaintenancePlansPage.js +1 -1
- package/dist/assethandler/pages/MaintenanceMaintenancePlansPage.js.map +1 -1
- package/package.json +2 -2
- package/dist/generated/global-operations.d.ts +0 -2
- package/dist/generated/global-operations.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts +0 -23527
- package/dist/generated/global-types.d.ts.map +0 -1
|
@@ -9,13 +9,13 @@ import { ChartCard as l } from "../components/ChartCard.js";
|
|
|
9
9
|
import { SectionHeader as u } from "../components/SectionHeader.js";
|
|
10
10
|
import "../components/index.js";
|
|
11
11
|
import { useMemo as d, useState as f } from "react";
|
|
12
|
-
import {
|
|
13
|
-
import { gql as
|
|
14
|
-
import { useMutation as
|
|
15
|
-
import { Fragment as
|
|
16
|
-
import { Button as
|
|
12
|
+
import { Archive as p, Leaf as m, Minus as h, Pencil as g, Plus as _, TrendingDown as v, TrendingUp as y } from "lucide-react";
|
|
13
|
+
import { gql as b } from "@apollo/client";
|
|
14
|
+
import { useMutation as x, useQuery as S } from "@apollo/client/react";
|
|
15
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
16
|
+
import { Button as E, GlassCard as D, IllustratedEmptyState as O, Input as k, Label as A, PagePurpose as j, ResponsiveDialog as M, ResponsiveDialogContent as N, ResponsiveDialogDescription as P, ResponsiveDialogFooter as F, ResponsiveDialogHeader as I, ResponsiveDialogTitle as L, Select as R, SelectContent as z, SelectItem as B, SelectTrigger as V, SelectValue as H } from "@burdenoff/fe-libs/ui";
|
|
17
17
|
//#region src/assethandler/pages/EsgDashboardPage.tsx
|
|
18
|
-
var
|
|
18
|
+
var U = b`
|
|
19
19
|
query AssetHandlerEsgMetrics {
|
|
20
20
|
esgMetrics {
|
|
21
21
|
id
|
|
@@ -30,162 +30,202 @@ var V = v`
|
|
|
30
30
|
periodEnd
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
34
|
-
mutation
|
|
35
|
-
|
|
33
|
+
`, W = b`
|
|
34
|
+
mutation AssetHandlerCreateEsgMetric($input: CreateEsgMetricInput!) {
|
|
35
|
+
createEsgMetric(input: $input) {
|
|
36
36
|
id
|
|
37
37
|
metricName
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
`,
|
|
40
|
+
`, G = b`
|
|
41
|
+
mutation AssetHandlerUpdateEsgMetric($id: ID!, $input: UpdateEsgMetricInput!) {
|
|
42
|
+
updateEsgMetric(id: $id, input: $input) {
|
|
43
|
+
id
|
|
44
|
+
metricName
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`, K = b`
|
|
48
|
+
mutation AssetHandlerArchiveEsgMetric($id: ID!) {
|
|
49
|
+
archiveEsgMetric(id: $id)
|
|
50
|
+
}
|
|
51
|
+
`, q = [
|
|
41
52
|
"environment",
|
|
42
53
|
"social",
|
|
43
54
|
"governance"
|
|
44
|
-
],
|
|
55
|
+
], J = [
|
|
45
56
|
"improving",
|
|
46
57
|
"stable",
|
|
47
58
|
"declining"
|
|
48
|
-
],
|
|
59
|
+
], Y = {
|
|
49
60
|
improving: {
|
|
50
61
|
label: "Improving",
|
|
51
|
-
icon:
|
|
62
|
+
icon: y,
|
|
52
63
|
tone: "positive",
|
|
53
64
|
dir: "up"
|
|
54
65
|
},
|
|
55
66
|
declining: {
|
|
56
67
|
label: "Declining",
|
|
57
|
-
icon:
|
|
68
|
+
icon: v,
|
|
58
69
|
tone: "negative",
|
|
59
70
|
dir: "down"
|
|
60
71
|
},
|
|
61
72
|
stable: {
|
|
62
73
|
label: "Stable",
|
|
63
|
-
icon:
|
|
74
|
+
icon: h,
|
|
64
75
|
tone: "neutral",
|
|
65
76
|
dir: "neutral"
|
|
66
77
|
}
|
|
67
|
-
},
|
|
78
|
+
}, X = {
|
|
68
79
|
positive: "bg-status-success-bg-subtle text-status-success-text",
|
|
69
80
|
negative: "bg-status-error-bg-subtle text-status-error-text",
|
|
70
81
|
neutral: "bg-bg-sunken text-text-secondary"
|
|
71
|
-
},
|
|
72
|
-
function
|
|
82
|
+
}, Z = (e) => e.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
83
|
+
function ee(e, t) {
|
|
84
|
+
let n = {
|
|
85
|
+
metricName: t.metricName.trim(),
|
|
86
|
+
category: t.category,
|
|
87
|
+
unit: t.unit.trim(),
|
|
88
|
+
value: t.value,
|
|
89
|
+
target: t.target,
|
|
90
|
+
trend: t.trend
|
|
91
|
+
};
|
|
92
|
+
return e ? {
|
|
93
|
+
kind: "update",
|
|
94
|
+
variables: {
|
|
95
|
+
id: e,
|
|
96
|
+
input: n
|
|
97
|
+
}
|
|
98
|
+
} : {
|
|
99
|
+
kind: "create",
|
|
100
|
+
variables: { input: {
|
|
101
|
+
...n,
|
|
102
|
+
metricKey: Z(t.metricName),
|
|
103
|
+
periodStart: new Date(t.periodStart).toISOString(),
|
|
104
|
+
periodEnd: new Date(t.periodEnd).toISOString()
|
|
105
|
+
} }
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function Q() {
|
|
73
109
|
let e = /* @__PURE__ */ new Date();
|
|
74
110
|
return new Date(e.getFullYear(), e.getMonth(), 1).toISOString().slice(0, 10);
|
|
75
111
|
}
|
|
76
|
-
function
|
|
112
|
+
function te() {
|
|
77
113
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
78
114
|
}
|
|
79
|
-
function
|
|
80
|
-
let t =
|
|
81
|
-
return /* @__PURE__ */
|
|
82
|
-
className: n("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",
|
|
83
|
-
children: [/* @__PURE__ */
|
|
115
|
+
function ne({ trend: e }) {
|
|
116
|
+
let t = Y[e ?? "stable"] ?? Y.stable, r = t.icon;
|
|
117
|
+
return /* @__PURE__ */ T("span", {
|
|
118
|
+
className: n("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium", X[t.tone]),
|
|
119
|
+
children: [/* @__PURE__ */ w(r, { className: "h-3 w-3" }), t.label]
|
|
84
120
|
});
|
|
85
121
|
}
|
|
86
|
-
function
|
|
87
|
-
let [
|
|
122
|
+
function re({ open: e, metric: t, onOpenChange: n, onSaved: i }) {
|
|
123
|
+
let [a, o] = f(t?.metricName ?? ""), [s, c] = f(t?.category ?? "environment"), [l, u] = f(t?.unit ?? ""), [d, p] = f(t ? String(t.value) : ""), [m, h] = f(t?.target == null ? "" : String(t.target)), [g, _] = f(t?.trend ?? "stable"), [v, y] = f(t?.periodStart.slice(0, 10) ?? Q()), [b, S] = f(t?.periodEnd.slice(0, 10) ?? te()), C = { onError: (e) => r.error("Could not save metric", e.message) }, [D, { loading: O }] = x(W, {
|
|
124
|
+
...C,
|
|
88
125
|
onCompleted: (e) => {
|
|
89
|
-
r.success("Metric saved", `${e.
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
126
|
+
r.success("Metric saved", `${e.createEsgMetric.metricName} was recorded.`), n(!1), i();
|
|
127
|
+
}
|
|
128
|
+
}), [j, { loading: U }] = x(G, {
|
|
129
|
+
...C,
|
|
130
|
+
onCompleted: (e) => {
|
|
131
|
+
r.success("Metric updated", `${e.updateEsgMetric.metricName} was updated.`), n(!1), i();
|
|
132
|
+
}
|
|
133
|
+
}), K = O || U;
|
|
134
|
+
return /* @__PURE__ */ w(M, {
|
|
94
135
|
open: e,
|
|
95
|
-
onOpenChange:
|
|
96
|
-
children: /* @__PURE__ */
|
|
136
|
+
onOpenChange: n,
|
|
137
|
+
children: /* @__PURE__ */ T(N, {
|
|
97
138
|
className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl",
|
|
98
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ T(I, { children: [/* @__PURE__ */ w(L, { children: t ? "Edit Metric" : "Save Metric" }), /* @__PURE__ */ w(P, { children: t ? "Update this metric’s values. Its source identity and reporting period stay unchanged." : "Record an ESG metric to track progress toward your sustainability targets." })] }), /* @__PURE__ */ T("form", {
|
|
99
140
|
className: "space-y-3",
|
|
100
141
|
onSubmit: (e) => {
|
|
101
142
|
e.preventDefault();
|
|
102
|
-
let
|
|
103
|
-
if (!
|
|
143
|
+
let n = Number(d);
|
|
144
|
+
if (!a.trim() || !l.trim()) {
|
|
104
145
|
r.warning("Missing details", "Metric name and unit are required.");
|
|
105
146
|
return;
|
|
106
147
|
}
|
|
107
|
-
if (!Number.isFinite(
|
|
148
|
+
if (!Number.isFinite(n) || d.trim() === "") {
|
|
108
149
|
r.warning("Invalid value", "Enter a numeric metric value.");
|
|
109
150
|
return;
|
|
110
151
|
}
|
|
111
|
-
if (!
|
|
152
|
+
if (!v || !b) {
|
|
112
153
|
r.warning("Missing period", "Period start and end are required.");
|
|
113
154
|
return;
|
|
114
155
|
}
|
|
115
|
-
let
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} } });
|
|
156
|
+
let i = m.trim() === "" ? null : Number(m), o = ee(t?.id ?? null, {
|
|
157
|
+
metricName: a,
|
|
158
|
+
category: s,
|
|
159
|
+
unit: l,
|
|
160
|
+
value: n,
|
|
161
|
+
target: i != null && Number.isFinite(i) ? i : null,
|
|
162
|
+
trend: g,
|
|
163
|
+
periodStart: v,
|
|
164
|
+
periodEnd: b
|
|
165
|
+
});
|
|
166
|
+
o.kind === "update" ? j(o) : D(o);
|
|
127
167
|
},
|
|
128
168
|
children: [
|
|
129
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ T("div", {
|
|
130
170
|
className: "grid gap-3 md:grid-cols-3",
|
|
131
171
|
children: [
|
|
132
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ T("div", {
|
|
133
173
|
className: "space-y-2",
|
|
134
|
-
children: [/* @__PURE__ */
|
|
174
|
+
children: [/* @__PURE__ */ w(A, { children: "Metric Name *" }), /* @__PURE__ */ w(k, {
|
|
135
175
|
placeholder: "e.g., Scope 2 carbon emissions",
|
|
136
|
-
value:
|
|
137
|
-
onChange: (e) =>
|
|
176
|
+
value: a,
|
|
177
|
+
onChange: (e) => o(e.target.value)
|
|
138
178
|
})]
|
|
139
179
|
}),
|
|
140
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ T("div", {
|
|
141
181
|
className: "space-y-2",
|
|
142
|
-
children: [/* @__PURE__ */
|
|
143
|
-
value:
|
|
144
|
-
onValueChange: (e) =>
|
|
145
|
-
children: [/* @__PURE__ */
|
|
182
|
+
children: [/* @__PURE__ */ w(A, { children: "Category" }), /* @__PURE__ */ T(R, {
|
|
183
|
+
value: s,
|
|
184
|
+
onValueChange: (e) => c(e),
|
|
185
|
+
children: [/* @__PURE__ */ w(V, { children: /* @__PURE__ */ w(H, {}) }), /* @__PURE__ */ w(z, { children: q.map((e) => /* @__PURE__ */ w(B, {
|
|
146
186
|
value: e,
|
|
147
187
|
className: "capitalize",
|
|
148
188
|
children: e
|
|
149
189
|
}, e)) })]
|
|
150
190
|
})]
|
|
151
191
|
}),
|
|
152
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ T("div", {
|
|
153
193
|
className: "space-y-2",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
194
|
+
children: [/* @__PURE__ */ w(A, { children: "Unit *" }), /* @__PURE__ */ w(k, {
|
|
155
195
|
placeholder: "e.g., tCO2e",
|
|
156
|
-
value:
|
|
157
|
-
onChange: (e) =>
|
|
196
|
+
value: l,
|
|
197
|
+
onChange: (e) => u(e.target.value)
|
|
158
198
|
})]
|
|
159
199
|
})
|
|
160
200
|
]
|
|
161
201
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ T("div", {
|
|
163
203
|
className: "grid gap-3 md:grid-cols-3",
|
|
164
204
|
children: [
|
|
165
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ T("div", {
|
|
166
206
|
className: "space-y-2",
|
|
167
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ w(A, { children: "Value *" }), /* @__PURE__ */ w(k, {
|
|
168
208
|
type: "number",
|
|
169
209
|
step: "any",
|
|
170
|
-
value:
|
|
171
|
-
onChange: (e) =>
|
|
210
|
+
value: d,
|
|
211
|
+
onChange: (e) => p(e.target.value)
|
|
172
212
|
})]
|
|
173
213
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ T("div", {
|
|
175
215
|
className: "space-y-2",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
216
|
+
children: [/* @__PURE__ */ w(A, { children: "Target" }), /* @__PURE__ */ w(k, {
|
|
177
217
|
type: "number",
|
|
178
218
|
step: "any",
|
|
179
|
-
value:
|
|
180
|
-
onChange: (e) =>
|
|
219
|
+
value: m,
|
|
220
|
+
onChange: (e) => h(e.target.value)
|
|
181
221
|
})]
|
|
182
222
|
}),
|
|
183
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ T("div", {
|
|
184
224
|
className: "space-y-2",
|
|
185
|
-
children: [/* @__PURE__ */
|
|
186
|
-
value:
|
|
187
|
-
onValueChange: (e) =>
|
|
188
|
-
children: [/* @__PURE__ */
|
|
225
|
+
children: [/* @__PURE__ */ w(A, { children: "Trend" }), /* @__PURE__ */ T(R, {
|
|
226
|
+
value: g,
|
|
227
|
+
onValueChange: (e) => _(e),
|
|
228
|
+
children: [/* @__PURE__ */ w(V, { children: /* @__PURE__ */ w(H, {}) }), /* @__PURE__ */ w(z, { children: J.map((e) => /* @__PURE__ */ w(B, {
|
|
189
229
|
value: e,
|
|
190
230
|
className: "capitalize",
|
|
191
231
|
children: e
|
|
@@ -194,111 +234,146 @@ function Z({ open: e, onOpenChange: t, onSaved: n }) {
|
|
|
194
234
|
})
|
|
195
235
|
]
|
|
196
236
|
}),
|
|
197
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ T("div", {
|
|
198
238
|
className: "grid gap-3 md:grid-cols-2",
|
|
199
|
-
children: [/* @__PURE__ */
|
|
239
|
+
children: [/* @__PURE__ */ T("div", {
|
|
200
240
|
className: "space-y-2",
|
|
201
|
-
children: [/* @__PURE__ */
|
|
241
|
+
children: [/* @__PURE__ */ w(A, { children: "Period Start *" }), /* @__PURE__ */ w(k, {
|
|
202
242
|
type: "date",
|
|
203
|
-
value:
|
|
204
|
-
onChange: (e) =>
|
|
243
|
+
value: v,
|
|
244
|
+
onChange: (e) => y(e.target.value),
|
|
245
|
+
disabled: t != null
|
|
205
246
|
})]
|
|
206
|
-
}), /* @__PURE__ */
|
|
247
|
+
}), /* @__PURE__ */ T("div", {
|
|
207
248
|
className: "space-y-2",
|
|
208
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ w(A, { children: "Period End *" }), /* @__PURE__ */ w(k, {
|
|
209
250
|
type: "date",
|
|
210
251
|
value: b,
|
|
211
|
-
onChange: (e) =>
|
|
252
|
+
onChange: (e) => S(e.target.value),
|
|
253
|
+
disabled: t != null
|
|
212
254
|
})]
|
|
213
255
|
})]
|
|
214
256
|
}),
|
|
215
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ T(F, { children: [/* @__PURE__ */ w(E, {
|
|
216
258
|
type: "button",
|
|
217
259
|
variant: "outline",
|
|
218
|
-
onClick: () =>
|
|
219
|
-
disabled:
|
|
260
|
+
onClick: () => n(!1),
|
|
261
|
+
disabled: K,
|
|
220
262
|
children: "Cancel"
|
|
221
|
-
}), /* @__PURE__ */
|
|
263
|
+
}), /* @__PURE__ */ w(E, {
|
|
222
264
|
type: "submit",
|
|
223
|
-
disabled:
|
|
224
|
-
children:
|
|
265
|
+
disabled: K,
|
|
266
|
+
children: K ? "Saving…" : t ? "Update Metric" : "Save Metric"
|
|
225
267
|
})] })
|
|
226
268
|
]
|
|
227
269
|
})]
|
|
228
270
|
})
|
|
229
271
|
});
|
|
230
272
|
}
|
|
231
|
-
function
|
|
232
|
-
let [
|
|
233
|
-
|
|
273
|
+
function $() {
|
|
274
|
+
let [h, v] = f(!1), [y, b] = f(null), [k, A] = f(null), [R, z] = f("ALL"), { data: B, loading: V, refetch: H } = S(U, { fetchPolicy: "cache-and-network" }), W = d(() => B?.esgMetrics ?? [], [B?.esgMetrics]), [G, { loading: J }] = x(K, {
|
|
275
|
+
onCompleted: () => {
|
|
276
|
+
r.success("Metric archived", "The metric was removed from the active ESG dashboard."), A(null), H();
|
|
277
|
+
},
|
|
278
|
+
onError: (e) => r.error("Could not archive metric", e.message)
|
|
279
|
+
}), X = d(() => W.slice(0, 4), [W]), Z = d(() => R === "ALL" ? W : W.filter((e) => e.category === R), [W, R]), ee = d(() => {
|
|
280
|
+
let e = W.reduce((e, t) => (e[t.category] = (e[t.category] ?? 0) + 1, e), {});
|
|
234
281
|
return Object.entries(e).map(([e, n], r) => ({
|
|
235
282
|
name: e.charAt(0).toUpperCase() + e.slice(1),
|
|
236
283
|
value: n,
|
|
237
284
|
color: t(r)
|
|
238
285
|
}));
|
|
239
|
-
}, [
|
|
286
|
+
}, [W]), Q = d(() => W.filter((e) => e.target != null).slice(0, 8).map((e) => ({
|
|
240
287
|
name: e.metricName,
|
|
241
288
|
value: e.value,
|
|
242
289
|
target: e.target
|
|
243
|
-
})), [
|
|
244
|
-
let e = { ALL:
|
|
245
|
-
for (let t of
|
|
290
|
+
})), [W]), te = d(() => {
|
|
291
|
+
let e = { ALL: W.length };
|
|
292
|
+
for (let t of W) e[t.category] = (e[t.category] ?? 0) + 1;
|
|
246
293
|
return e;
|
|
247
|
-
}, [
|
|
294
|
+
}, [W]), $ = s(Z, {
|
|
248
295
|
pageSize: 8,
|
|
249
|
-
resetKey:
|
|
296
|
+
resetKey: R
|
|
250
297
|
});
|
|
251
|
-
return /* @__PURE__ */
|
|
298
|
+
return /* @__PURE__ */ T("div", {
|
|
252
299
|
className: "space-y-5 p-4 sm:p-6",
|
|
253
300
|
children: [
|
|
254
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ w(u, {
|
|
255
302
|
hero: !0,
|
|
256
|
-
icon:
|
|
303
|
+
icon: m,
|
|
257
304
|
title: "ESG Dashboard",
|
|
258
305
|
description: "Measure the environmental and governance impact of your estate against targets.",
|
|
259
|
-
actions: /* @__PURE__ */
|
|
306
|
+
actions: /* @__PURE__ */ T(E, {
|
|
260
307
|
className: "w-full sm:w-auto",
|
|
261
|
-
onClick: () =>
|
|
262
|
-
|
|
308
|
+
onClick: () => {
|
|
309
|
+
b(null), v(!0);
|
|
310
|
+
},
|
|
311
|
+
children: [/* @__PURE__ */ w(_, { className: "mr-2 h-4 w-4" }), "Save Metric"]
|
|
263
312
|
})
|
|
264
313
|
}),
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
open:
|
|
268
|
-
|
|
269
|
-
|
|
314
|
+
/* @__PURE__ */ w(j, { children: "Track energy use, carbon emissions and responsible disposal against targets — and produce the evidence ESG reporting and audits require." }),
|
|
315
|
+
h ? /* @__PURE__ */ w(re, {
|
|
316
|
+
open: !0,
|
|
317
|
+
metric: y,
|
|
318
|
+
onOpenChange: (e) => {
|
|
319
|
+
v(e), e || b(null);
|
|
320
|
+
},
|
|
321
|
+
onSaved: () => void H()
|
|
322
|
+
}) : null,
|
|
323
|
+
/* @__PURE__ */ w(M, {
|
|
324
|
+
open: k != null,
|
|
325
|
+
onOpenChange: (e) => {
|
|
326
|
+
e || A(null);
|
|
327
|
+
},
|
|
328
|
+
children: /* @__PURE__ */ T(N, { children: [/* @__PURE__ */ T(I, { children: [/* @__PURE__ */ w(L, { children: "Archive metric" }), /* @__PURE__ */ T(P, { children: [
|
|
329
|
+
"Archive ",
|
|
330
|
+
k?.metricName ?? "this metric",
|
|
331
|
+
"? It will leave the active ESG dashboard. Archiving does not refund monthly usage."
|
|
332
|
+
] })] }), /* @__PURE__ */ T(F, { children: [/* @__PURE__ */ w(E, {
|
|
333
|
+
variant: "outline",
|
|
334
|
+
onClick: () => A(null),
|
|
335
|
+
disabled: J,
|
|
336
|
+
children: "Cancel"
|
|
337
|
+
}), /* @__PURE__ */ w(E, {
|
|
338
|
+
variant: "destructive",
|
|
339
|
+
disabled: J || k == null,
|
|
340
|
+
onClick: () => {
|
|
341
|
+
k && G({ variables: { id: k.id } });
|
|
342
|
+
},
|
|
343
|
+
children: J ? "Archiving…" : "Archive Metric"
|
|
344
|
+
})] })] })
|
|
270
345
|
}),
|
|
271
|
-
|
|
346
|
+
V && W.length === 0 ? /* @__PURE__ */ w("div", {
|
|
272
347
|
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
273
|
-
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */
|
|
348
|
+
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ w("div", { className: "h-28 rounded-xl bg-bg-sunken motion-safe:animate-vc-shimmer" }, t))
|
|
274
349
|
}) : null,
|
|
275
|
-
!
|
|
350
|
+
!V && W.length === 0 ? /* @__PURE__ */ w(O, {
|
|
276
351
|
illustration: "empty-data",
|
|
277
352
|
title: "No ESG metrics recorded yet",
|
|
278
353
|
description: "Save a metric to start tracking sustainability progress against your targets."
|
|
279
354
|
}) : null,
|
|
280
|
-
|
|
355
|
+
X.length > 0 ? /* @__PURE__ */ w("div", {
|
|
281
356
|
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
282
|
-
children:
|
|
283
|
-
let n =
|
|
284
|
-
return /* @__PURE__ */
|
|
357
|
+
children: X.map((t) => {
|
|
358
|
+
let n = Y[t.trend ?? "stable"] ?? Y.stable;
|
|
359
|
+
return /* @__PURE__ */ w(c, {
|
|
285
360
|
label: `${t.metricName} (${t.unit})`,
|
|
286
361
|
value: t.value,
|
|
287
362
|
format: e,
|
|
288
363
|
delta: n.label,
|
|
289
364
|
deltaDirection: n.dir,
|
|
290
365
|
deltaTone: n.tone,
|
|
291
|
-
icon:
|
|
366
|
+
icon: m
|
|
292
367
|
}, t.id);
|
|
293
368
|
})
|
|
294
369
|
}) : null,
|
|
295
|
-
|
|
370
|
+
W.length > 0 ? /* @__PURE__ */ T("div", {
|
|
296
371
|
className: "grid gap-4 lg:grid-cols-2",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
372
|
+
children: [/* @__PURE__ */ w(l, {
|
|
298
373
|
title: "Value vs. target",
|
|
299
374
|
subtitle: "Metrics measured against their targets",
|
|
300
|
-
children:
|
|
301
|
-
data:
|
|
375
|
+
children: Q.length > 0 ? /* @__PURE__ */ w(i, {
|
|
376
|
+
data: Q,
|
|
302
377
|
xKey: "name",
|
|
303
378
|
series: [{
|
|
304
379
|
key: "value",
|
|
@@ -311,86 +386,109 @@ function Q() {
|
|
|
311
386
|
height: 240,
|
|
312
387
|
categoryWidth: 150,
|
|
313
388
|
ariaLabel: "Metric value versus target"
|
|
314
|
-
}) : /* @__PURE__ */
|
|
389
|
+
}) : /* @__PURE__ */ w("div", {
|
|
315
390
|
className: "flex h-[240px] items-center justify-center text-sm text-text-secondary",
|
|
316
391
|
children: "Set a target on a metric to compare value against target."
|
|
317
392
|
})
|
|
318
|
-
}), /* @__PURE__ */
|
|
393
|
+
}), /* @__PURE__ */ w(l, {
|
|
319
394
|
title: "By category",
|
|
320
395
|
subtitle: "Metrics across E / S / G",
|
|
321
|
-
children: /* @__PURE__ */
|
|
322
|
-
data:
|
|
396
|
+
children: /* @__PURE__ */ w(a, {
|
|
397
|
+
data: ee,
|
|
323
398
|
height: 240,
|
|
324
399
|
centerLabel: "Metrics",
|
|
325
|
-
centerValue:
|
|
400
|
+
centerValue: W.length,
|
|
326
401
|
ariaLabel: "Metrics by category"
|
|
327
402
|
})
|
|
328
403
|
})]
|
|
329
404
|
}) : null,
|
|
330
|
-
|
|
331
|
-
/* @__PURE__ */
|
|
405
|
+
W.length > 0 ? /* @__PURE__ */ T(C, { children: [
|
|
406
|
+
/* @__PURE__ */ w("div", {
|
|
332
407
|
className: "flex flex-wrap items-center gap-2",
|
|
333
|
-
children: ["ALL", ...
|
|
408
|
+
children: ["ALL", ...q].map((e) => /* @__PURE__ */ T("button", {
|
|
334
409
|
type: "button",
|
|
335
|
-
onClick: () =>
|
|
336
|
-
className: n("rounded-full px-3.5 py-1.5 text-sm font-medium capitalize transition-colors",
|
|
337
|
-
children: [e === "ALL" ? "All" : e, /* @__PURE__ */
|
|
410
|
+
onClick: () => z(e),
|
|
411
|
+
className: n("rounded-full px-3.5 py-1.5 text-sm font-medium capitalize transition-colors", R === e ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
|
|
412
|
+
children: [e === "ALL" ? "All" : e, /* @__PURE__ */ w("span", {
|
|
338
413
|
className: "ml-1.5 text-xs opacity-70 tabular-nums",
|
|
339
|
-
children:
|
|
414
|
+
children: te[e] ?? 0
|
|
340
415
|
})]
|
|
341
416
|
}, e))
|
|
342
417
|
}),
|
|
343
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ w("div", {
|
|
344
419
|
className: "grid gap-4 sm:grid-cols-2",
|
|
345
|
-
children:
|
|
420
|
+
children: $.pageItems.map((t) => {
|
|
346
421
|
let n = t.target && t.target > 0 ? Math.min(100, Math.round(t.value / t.target * 100)) : null;
|
|
347
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ w(D, {
|
|
348
423
|
treatment: "glass",
|
|
349
424
|
className: "border-border-seam",
|
|
350
|
-
children: /* @__PURE__ */
|
|
425
|
+
children: /* @__PURE__ */ T("div", {
|
|
351
426
|
className: "space-y-3 p-4",
|
|
352
427
|
children: [
|
|
353
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ T("div", {
|
|
354
429
|
className: "flex items-start justify-between gap-2",
|
|
355
|
-
children: [/* @__PURE__ */
|
|
430
|
+
children: [/* @__PURE__ */ T("div", {
|
|
356
431
|
className: "min-w-0",
|
|
357
|
-
children: [/* @__PURE__ */
|
|
432
|
+
children: [/* @__PURE__ */ w("p", {
|
|
358
433
|
className: "text-xs uppercase tracking-wide text-text-secondary",
|
|
359
434
|
children: t.category
|
|
360
|
-
}), /* @__PURE__ */
|
|
435
|
+
}), /* @__PURE__ */ w("h2", {
|
|
361
436
|
className: "mt-0.5 text-base font-semibold text-text-primary",
|
|
362
437
|
children: t.metricName
|
|
363
438
|
})]
|
|
364
|
-
}), /* @__PURE__ */
|
|
439
|
+
}), /* @__PURE__ */ T("div", {
|
|
440
|
+
className: "flex items-center gap-1",
|
|
441
|
+
children: [
|
|
442
|
+
/* @__PURE__ */ w(ne, { trend: t.trend }),
|
|
443
|
+
/* @__PURE__ */ w(E, {
|
|
444
|
+
type: "button",
|
|
445
|
+
variant: "ghost",
|
|
446
|
+
size: "icon",
|
|
447
|
+
"aria-label": `Edit ${t.metricName}`,
|
|
448
|
+
onClick: () => {
|
|
449
|
+
b(t), v(!0);
|
|
450
|
+
},
|
|
451
|
+
children: /* @__PURE__ */ w(g, { className: "h-4 w-4" })
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ w(E, {
|
|
454
|
+
type: "button",
|
|
455
|
+
variant: "ghost",
|
|
456
|
+
size: "icon",
|
|
457
|
+
"aria-label": `Archive ${t.metricName}`,
|
|
458
|
+
onClick: () => A(t),
|
|
459
|
+
children: /* @__PURE__ */ w(p, { className: "h-4 w-4" })
|
|
460
|
+
})
|
|
461
|
+
]
|
|
462
|
+
})]
|
|
365
463
|
}),
|
|
366
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ T("div", {
|
|
367
465
|
className: "flex items-baseline gap-2",
|
|
368
466
|
children: [
|
|
369
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ w("span", {
|
|
370
468
|
className: "text-2xl font-bold tabular-nums text-text-primary",
|
|
371
469
|
children: e(t.value)
|
|
372
470
|
}),
|
|
373
|
-
/* @__PURE__ */
|
|
471
|
+
/* @__PURE__ */ w("span", {
|
|
374
472
|
className: "text-sm text-text-secondary",
|
|
375
473
|
children: t.unit
|
|
376
474
|
}),
|
|
377
|
-
t.target == null ? null : /* @__PURE__ */
|
|
475
|
+
t.target == null ? null : /* @__PURE__ */ T("span", {
|
|
378
476
|
className: "text-xs text-text-muted",
|
|
379
477
|
children: ["target ", e(t.target)]
|
|
380
478
|
})
|
|
381
479
|
]
|
|
382
480
|
}),
|
|
383
|
-
n == null ? null : /* @__PURE__ */
|
|
481
|
+
n == null ? null : /* @__PURE__ */ T("div", {
|
|
384
482
|
className: "space-y-1",
|
|
385
|
-
children: [/* @__PURE__ */
|
|
483
|
+
children: [/* @__PURE__ */ T("div", {
|
|
386
484
|
className: "flex items-center justify-between text-xs text-text-secondary",
|
|
387
|
-
children: [/* @__PURE__ */
|
|
485
|
+
children: [/* @__PURE__ */ w("span", { children: "Progress to target" }), /* @__PURE__ */ T("span", {
|
|
388
486
|
className: "font-medium tabular-nums",
|
|
389
487
|
children: [n, "%"]
|
|
390
488
|
})]
|
|
391
|
-
}), /* @__PURE__ */
|
|
489
|
+
}), /* @__PURE__ */ w("div", {
|
|
392
490
|
className: "h-2 overflow-hidden rounded-full bg-bg-sunken",
|
|
393
|
-
children: /* @__PURE__ */
|
|
491
|
+
children: /* @__PURE__ */ w("div", {
|
|
394
492
|
className: "h-full rounded-full bg-action-primary-bg",
|
|
395
493
|
style: { width: `${n}%` }
|
|
396
494
|
})
|
|
@@ -401,16 +499,16 @@ function Q() {
|
|
|
401
499
|
}, t.id);
|
|
402
500
|
})
|
|
403
501
|
}),
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
page:
|
|
406
|
-
pageCount:
|
|
407
|
-
rangeStart:
|
|
408
|
-
rangeEnd:
|
|
409
|
-
totalItems:
|
|
410
|
-
canPrev:
|
|
411
|
-
canNext:
|
|
412
|
-
onPrev:
|
|
413
|
-
onNext:
|
|
502
|
+
/* @__PURE__ */ w(o, {
|
|
503
|
+
page: $.page,
|
|
504
|
+
pageCount: $.pageCount,
|
|
505
|
+
rangeStart: $.rangeStart,
|
|
506
|
+
rangeEnd: $.rangeEnd,
|
|
507
|
+
totalItems: $.totalItems,
|
|
508
|
+
canPrev: $.canPrev,
|
|
509
|
+
canNext: $.canNext,
|
|
510
|
+
onPrev: $.prevPage,
|
|
511
|
+
onNext: $.nextPage,
|
|
414
512
|
itemLabel: "metrics"
|
|
415
513
|
})
|
|
416
514
|
] }) : null
|
|
@@ -418,6 +516,6 @@ function Q() {
|
|
|
418
516
|
});
|
|
419
517
|
}
|
|
420
518
|
//#endregion
|
|
421
|
-
export {
|
|
519
|
+
export { $ as EsgDashboardPage };
|
|
422
520
|
|
|
423
521
|
//# sourceMappingURL=EsgDashboardPage.js.map
|