@burdenoff/microfe-theglobalfuel 2026.705.2 → 2026.705.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/theglobalfuel/TheGlobalFuelRoot.js +54 -46
- package/dist/theglobalfuel/TheGlobalFuelRoot.js.map +1 -1
- package/dist/theglobalfuel/TheGlobalFuelRoutes.js +10 -6
- package/dist/theglobalfuel/TheGlobalFuelRoutes.js.map +1 -1
- package/dist/theglobalfuel/components/DataTable.js +126 -58
- package/dist/theglobalfuel/components/DataTable.js.map +1 -1
- package/dist/theglobalfuel/components/EmptyState.js +4 -4
- package/dist/theglobalfuel/components/EmptyState.js.map +1 -1
- package/dist/theglobalfuel/components/MetricsCard.js +2 -2
- package/dist/theglobalfuel/components/MetricsCard.js.map +1 -1
- package/dist/theglobalfuel/components/WorldMap.js +115 -0
- package/dist/theglobalfuel/components/WorldMap.js.map +1 -0
- package/dist/theglobalfuel/components/index.js +9 -0
- package/dist/theglobalfuel/components/viz/AllocationBar.js +68 -0
- package/dist/theglobalfuel/components/viz/AllocationBar.js.map +1 -0
- package/dist/theglobalfuel/components/viz/AreaChart.js +102 -0
- package/dist/theglobalfuel/components/viz/AreaChart.js.map +1 -0
- package/dist/theglobalfuel/components/viz/AvatarStack.js +2 -0
- package/dist/theglobalfuel/components/viz/BarChart.js +4 -0
- package/dist/theglobalfuel/components/viz/CertificateCard.js +4 -0
- package/dist/theglobalfuel/components/viz/DonutChart.js +109 -0
- package/dist/theglobalfuel/components/viz/DonutChart.js.map +1 -0
- package/dist/theglobalfuel/components/viz/HBarFunnel.js +3 -0
- package/dist/theglobalfuel/components/viz/Heatmap.js +3 -0
- package/dist/theglobalfuel/components/viz/KanbanBoard.js +2 -0
- package/dist/theglobalfuel/components/viz/LineChart.js +4 -0
- package/dist/theglobalfuel/components/viz/OrgTree.js +2 -0
- package/dist/theglobalfuel/components/viz/PathSteps.js +68 -0
- package/dist/theglobalfuel/components/viz/PathSteps.js.map +1 -0
- package/dist/theglobalfuel/components/viz/ProgressRing.js +6 -0
- package/dist/theglobalfuel/components/viz/ProgressRing.js.map +1 -0
- package/dist/theglobalfuel/components/viz/RatingStars.js +3 -0
- package/dist/theglobalfuel/components/viz/SegmentedTabs.js +3 -0
- package/dist/theglobalfuel/components/viz/SkillBar.js +3 -0
- package/dist/theglobalfuel/components/viz/Sparkline.js +74 -0
- package/dist/theglobalfuel/components/viz/Sparkline.js.map +1 -0
- package/dist/theglobalfuel/components/viz/StatCard.js +3 -0
- package/dist/theglobalfuel/components/viz/StepProgress.js +64 -0
- package/dist/theglobalfuel/components/viz/StepProgress.js.map +1 -0
- package/dist/theglobalfuel/components/viz/Timeline.js +66 -0
- package/dist/theglobalfuel/components/viz/Timeline.js.map +1 -0
- package/dist/theglobalfuel/components/viz/index.js +23 -0
- package/dist/theglobalfuel/components/viz/lib/Avatar.js +1 -0
- package/dist/theglobalfuel/components/viz/lib/CartesianFrame.js +119 -0
- package/dist/theglobalfuel/components/viz/lib/CartesianFrame.js.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/ResponsiveSvg.js +35 -0
- package/dist/theglobalfuel/components/viz/lib/ResponsiveSvg.js.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/format.js +17 -0
- package/dist/theglobalfuel/components/viz/lib/format.js.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/geometry.js +61 -0
- package/dist/theglobalfuel/components/viz/lib/geometry.js.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/hooks.js +39 -0
- package/dist/theglobalfuel/components/viz/lib/hooks.js.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/palette.js +27 -0
- package/dist/theglobalfuel/components/viz/lib/palette.js.map +1 -0
- package/dist/theglobalfuel/hooks/useCursorPager.js +6 -15
- package/dist/theglobalfuel/hooks/useCursorPager.js.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +431 -316
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetsPage.js +99 -99
- package/dist/theglobalfuel/pages/assets/AssetsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/compliance/CompliancePage.js +250 -250
- package/dist/theglobalfuel/pages/compliance/CompliancePage.js.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractsPage.js +2 -2
- package/dist/theglobalfuel/pages/contracts/ContractsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +525 -227
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -1
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +255 -206
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/inventory/InventoryPage.js +60 -60
- package/dist/theglobalfuel/pages/inventory/InventoryPage.js.map +1 -1
- package/dist/theglobalfuel/pages/production/ProductionPage.js +2 -2
- package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
- package/dist/theglobalfuel/pages/provenance/ProvenancePage.js +465 -0
- package/dist/theglobalfuel/pages/provenance/ProvenancePage.js.map +1 -0
- package/dist/theglobalfuel/pages/reserves/ReservesPage.js +152 -152
- package/dist/theglobalfuel/pages/reserves/ReservesPage.js.map +1 -1
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +356 -227
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,24 +4,26 @@ import { formatDate as n, formatEnumLabel as r, formatPercent as i, formatRelati
|
|
|
4
4
|
import { StatusBadge as te } from "../../components/StatusBadge.js";
|
|
5
5
|
import { MiniBar as s } from "../../components/MiniBar.js";
|
|
6
6
|
import { DataTable as c } from "../../components/DataTable.js";
|
|
7
|
-
import { ErrorView as
|
|
8
|
-
import { EmptyState as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { ErrorView as ne, LoadingView as re } from "../../components/StateViews.js";
|
|
8
|
+
import { EmptyState as ie } from "../../components/EmptyState.js";
|
|
9
|
+
import { DonutChart as ae } from "../../components/viz/DonutChart.js";
|
|
10
|
+
import { useTheAssets as oe, useTheEmissionRecords as l, useTheRecordEmission as se, useTheVerifyEmission as ce } from "../../hooks/useTheGlobalFuelApi.js";
|
|
11
|
+
import { useCursorPager as le } from "../../hooks/useCursorPager.js";
|
|
12
|
+
import { useNotify as ue } from "../../hooks/useNotify.js";
|
|
12
13
|
import "../../hooks/index.js";
|
|
13
|
-
import { FilterTabs as
|
|
14
|
-
import { Pagination as
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
14
|
+
import { FilterTabs as de } from "../../components/FilterTabs.js";
|
|
15
|
+
import { Pagination as fe } from "../../components/Pagination.js";
|
|
16
|
+
import "../../components/index.js";
|
|
17
|
+
import { useMemo as u, useState as d } from "react";
|
|
18
|
+
import { CheckCircle2 as pe, Circle as me, Cloud as f, Factory as he, Flame as ge, Plus as p, Truck as _e, Zap as ve } from "lucide-react";
|
|
19
|
+
import { Fragment as ye, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
20
|
+
import { Button as g, Input as _, Label as v, ResponsiveDialog as be, ResponsiveDialogContent as xe, ResponsiveDialogDescription as Se, ResponsiveDialogFooter as Ce, ResponsiveDialogHeader as y, ResponsiveDialogTitle as we, Select as b, SelectContent as x, SelectItem as S, SelectTrigger as C, SelectValue as w, Textarea as Te } from "@burdenoff/fe-libs/ui";
|
|
19
21
|
//#region src/theglobalfuel/pages/emissions/EmissionsPage.tsx
|
|
20
|
-
var
|
|
22
|
+
var T = [
|
|
21
23
|
"SCOPE_1",
|
|
22
24
|
"SCOPE_2",
|
|
23
25
|
"SCOPE_3"
|
|
24
|
-
],
|
|
26
|
+
], E = [
|
|
25
27
|
{
|
|
26
28
|
value: "ALL",
|
|
27
29
|
label: "All scopes"
|
|
@@ -38,69 +40,87 @@ var A = [
|
|
|
38
40
|
value: "SCOPE_3",
|
|
39
41
|
label: "Scope 3"
|
|
40
42
|
}
|
|
41
|
-
],
|
|
43
|
+
], D = {
|
|
42
44
|
SCOPE_1: "bg-status-error-text",
|
|
43
45
|
SCOPE_2: "bg-status-warning-text",
|
|
44
46
|
SCOPE_3: "bg-accent"
|
|
45
|
-
},
|
|
47
|
+
}, O = {
|
|
48
|
+
SCOPE_1: "Scope 1",
|
|
49
|
+
SCOPE_2: "Scope 2",
|
|
50
|
+
SCOPE_3: "Scope 3"
|
|
51
|
+
}, Ee = {
|
|
52
|
+
SCOPE_1: "var(--color-status-error-text)",
|
|
53
|
+
SCOPE_2: "var(--color-status-warning-text)",
|
|
54
|
+
SCOPE_3: "var(--color-accent-blue)"
|
|
55
|
+
}, De = (e) => new Intl.NumberFormat("en", {
|
|
56
|
+
notation: "compact",
|
|
57
|
+
maximumFractionDigits: 1
|
|
58
|
+
}).format(e), k = 25, A = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), j = () => ({
|
|
46
59
|
assetId: "",
|
|
47
60
|
scope: "SCOPE_1",
|
|
48
61
|
co2eTonnes: "",
|
|
49
|
-
periodStart:
|
|
50
|
-
periodEnd:
|
|
62
|
+
periodStart: A(),
|
|
63
|
+
periodEnd: A(),
|
|
51
64
|
source: "",
|
|
52
65
|
methodology: "",
|
|
53
66
|
notes: ""
|
|
54
|
-
}),
|
|
67
|
+
}), M = (e, t, n) => {
|
|
55
68
|
if (t <= 0) return;
|
|
56
69
|
let r = e / t * 100;
|
|
57
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ h("div", {
|
|
58
71
|
className: "space-y-2",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
72
|
+
children: [/* @__PURE__ */ m(s, {
|
|
60
73
|
value: r,
|
|
61
|
-
barClassName:
|
|
74
|
+
barClassName: D[n],
|
|
62
75
|
height: 4
|
|
63
|
-
}), /* @__PURE__ */
|
|
76
|
+
}), /* @__PURE__ */ h("p", {
|
|
64
77
|
className: "text-xs tabular-nums text-text-tertiary",
|
|
65
78
|
children: [i(r), " of total"]
|
|
66
79
|
})]
|
|
67
80
|
});
|
|
68
81
|
};
|
|
69
|
-
function
|
|
70
|
-
let i =
|
|
82
|
+
function N() {
|
|
83
|
+
let i = ue(), [s, D] = d("ALL"), [A, N] = d("ALL"), P = le(), [Oe, F] = d(!1), [I, L] = d(j), [R, z] = d(null), [B, V] = d(null), H = oe({ pagination: { limit: 100 } }), ke = u(() => {
|
|
71
84
|
let e = {};
|
|
72
|
-
for (let t of
|
|
85
|
+
for (let t of H.data?.items ?? []) e[t.id] = t.name;
|
|
73
86
|
return e;
|
|
74
|
-
}, [
|
|
87
|
+
}, [H.data]), U = H.data?.items ?? [], { data: W, isLoading: Ae, isError: je, refetch: Me } = l({
|
|
75
88
|
scope: s === "ALL" ? void 0 : s,
|
|
76
|
-
assetId:
|
|
89
|
+
assetId: A === "ALL" ? void 0 : A,
|
|
77
90
|
pagination: {
|
|
78
|
-
limit:
|
|
79
|
-
|
|
91
|
+
limit: k,
|
|
92
|
+
offset: P.page * k
|
|
80
93
|
}
|
|
81
|
-
}),
|
|
94
|
+
}), G = se(), Ne = ce(), K = u(() => W?.items ?? [], [W]), q = l({
|
|
95
|
+
assetId: A === "ALL" ? void 0 : A,
|
|
96
|
+
pagination: { limit: 200 }
|
|
97
|
+
}), J = u(() => q.data?.items ?? [], [q.data]), Y = J.length, { total: X, byScope: Z } = u(() => {
|
|
82
98
|
let e = {
|
|
83
99
|
SCOPE_1: 0,
|
|
84
100
|
SCOPE_2: 0,
|
|
85
101
|
SCOPE_3: 0
|
|
86
102
|
}, t = 0;
|
|
87
|
-
for (let n of
|
|
103
|
+
for (let n of J) t += n.co2eTonnes, e[n.scope] += n.co2eTonnes;
|
|
88
104
|
return {
|
|
89
105
|
total: t,
|
|
90
106
|
byScope: e
|
|
91
107
|
};
|
|
92
|
-
}, [
|
|
108
|
+
}, [J]), Q = u(() => T.filter((e) => Z[e] > 0).map((e) => ({
|
|
109
|
+
label: O[e],
|
|
110
|
+
value: Z[e],
|
|
111
|
+
color: Ee[e]
|
|
112
|
+
})), [Z]), Pe = [
|
|
93
113
|
{
|
|
94
114
|
key: "scope",
|
|
95
115
|
header: "Scope",
|
|
96
|
-
render: (e) => /* @__PURE__ */
|
|
116
|
+
render: (e) => /* @__PURE__ */ m(te, { status: e.scope })
|
|
97
117
|
},
|
|
98
118
|
{
|
|
99
119
|
key: "asset",
|
|
100
120
|
header: "Asset",
|
|
101
|
-
render: (e) => /* @__PURE__ */
|
|
121
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
102
122
|
className: "text-text-secondary",
|
|
103
|
-
children: e.assetId ?
|
|
123
|
+
children: e.assetId ? ke[e.assetId] ?? `${e.assetId.slice(0, 8)}…` : "—"
|
|
104
124
|
})
|
|
105
125
|
},
|
|
106
126
|
{
|
|
@@ -108,7 +128,7 @@ function L() {
|
|
|
108
128
|
header: "CO₂e",
|
|
109
129
|
align: "right",
|
|
110
130
|
sortValue: (e) => e.co2eTonnes,
|
|
111
|
-
render: (e) => /* @__PURE__ */
|
|
131
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
112
132
|
className: "tabular-nums font-medium text-text-primary",
|
|
113
133
|
children: a(e.co2eTonnes)
|
|
114
134
|
})
|
|
@@ -118,7 +138,7 @@ function L() {
|
|
|
118
138
|
header: "Period",
|
|
119
139
|
hideOnMobile: !0,
|
|
120
140
|
sortValue: (e) => new Date(e.periodStart).getTime(),
|
|
121
|
-
render: (e) => /* @__PURE__ */
|
|
141
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
122
142
|
className: "text-text-secondary",
|
|
123
143
|
children: [
|
|
124
144
|
n(e.periodStart),
|
|
@@ -131,7 +151,7 @@ function L() {
|
|
|
131
151
|
key: "source",
|
|
132
152
|
header: "Source",
|
|
133
153
|
hideOnMobile: !0,
|
|
134
|
-
render: (e) => /* @__PURE__ */
|
|
154
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
135
155
|
className: "text-text-secondary",
|
|
136
156
|
children: e.source ?? "—"
|
|
137
157
|
})
|
|
@@ -139,22 +159,22 @@ function L() {
|
|
|
139
159
|
{
|
|
140
160
|
key: "verified",
|
|
141
161
|
header: "Verified",
|
|
142
|
-
render: (e) => e.verified ? /* @__PURE__ */
|
|
162
|
+
render: (e) => e.verified ? /* @__PURE__ */ h("span", {
|
|
143
163
|
className: "inline-flex items-center gap-1.5 text-status-success-text",
|
|
144
164
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ m(pe, { className: "h-4 w-4" }),
|
|
166
|
+
/* @__PURE__ */ m("span", {
|
|
147
167
|
className: "text-xs font-medium",
|
|
148
168
|
children: "Verified"
|
|
149
169
|
}),
|
|
150
|
-
e.verifiedAt && /* @__PURE__ */
|
|
170
|
+
e.verifiedAt && /* @__PURE__ */ m("span", {
|
|
151
171
|
className: "text-xs font-normal tabular-nums text-text-tertiary",
|
|
152
172
|
children: n(e.verifiedAt)
|
|
153
173
|
})
|
|
154
174
|
]
|
|
155
|
-
}) : /* @__PURE__ */
|
|
175
|
+
}) : /* @__PURE__ */ h("span", {
|
|
156
176
|
className: "inline-flex items-center gap-1.5 text-text-tertiary",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
177
|
+
children: [/* @__PURE__ */ m(me, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ m("span", {
|
|
158
178
|
className: "text-xs",
|
|
159
179
|
children: "Unverified"
|
|
160
180
|
})]
|
|
@@ -165,7 +185,7 @@ function L() {
|
|
|
165
185
|
header: "Logged",
|
|
166
186
|
align: "right",
|
|
167
187
|
hideOnMobile: !0,
|
|
168
|
-
render: (e) => /* @__PURE__ */
|
|
188
|
+
render: (e) => /* @__PURE__ */ m("span", {
|
|
169
189
|
className: "text-text-tertiary",
|
|
170
190
|
children: ee(e.createdAt)
|
|
171
191
|
})
|
|
@@ -174,323 +194,352 @@ function L() {
|
|
|
174
194
|
key: "verify",
|
|
175
195
|
header: "",
|
|
176
196
|
align: "right",
|
|
177
|
-
render: (e) => e.verified ? null : /* @__PURE__ */
|
|
197
|
+
render: (e) => e.verified ? null : /* @__PURE__ */ m(g, {
|
|
178
198
|
size: "sm",
|
|
179
199
|
variant: "outline",
|
|
180
200
|
onClick: () => {
|
|
181
|
-
|
|
201
|
+
V(e.id), Ne.mutate(e.id, {
|
|
182
202
|
onSuccess: () => i.success("Emission verified"),
|
|
183
203
|
onError: (e) => i.fromError(e),
|
|
184
|
-
onSettled: () =>
|
|
204
|
+
onSettled: () => V(null)
|
|
185
205
|
});
|
|
186
206
|
},
|
|
187
|
-
disabled:
|
|
188
|
-
children:
|
|
207
|
+
disabled: B === e.id,
|
|
208
|
+
children: B === e.id ? "Verifying…" : "Verify"
|
|
189
209
|
})
|
|
190
210
|
}
|
|
191
211
|
], $ = () => {
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
let e = Number(
|
|
195
|
-
if (!
|
|
212
|
+
L(j()), z(null), F(!0);
|
|
213
|
+
}, Fe = async () => {
|
|
214
|
+
let e = Number(I.co2eTonnes);
|
|
215
|
+
if (!I.co2eTonnes || Number.isNaN(e) || e <= 0) {
|
|
196
216
|
let e = "CO₂e (tonnes) must be greater than zero.";
|
|
197
|
-
|
|
217
|
+
z(e), i.error(e);
|
|
198
218
|
return;
|
|
199
219
|
}
|
|
200
|
-
if (!
|
|
201
|
-
|
|
220
|
+
if (!I.periodStart || !I.periodEnd) {
|
|
221
|
+
z("Period start and end are required.");
|
|
202
222
|
return;
|
|
203
223
|
}
|
|
204
|
-
let t = o(
|
|
224
|
+
let t = o(I.periodStart), n = o(I.periodEnd);
|
|
205
225
|
if (!t || !n) {
|
|
206
|
-
|
|
226
|
+
z("Period start and end are required.");
|
|
207
227
|
return;
|
|
208
228
|
}
|
|
209
229
|
if (new Date(n).getTime() < new Date(t).getTime()) {
|
|
210
|
-
|
|
230
|
+
z("Period end must be on or after the period start.");
|
|
211
231
|
return;
|
|
212
232
|
}
|
|
213
|
-
|
|
233
|
+
z(null);
|
|
214
234
|
try {
|
|
215
|
-
await
|
|
216
|
-
assetId:
|
|
217
|
-
scope:
|
|
235
|
+
await G.mutateAsync({
|
|
236
|
+
assetId: I.assetId || null,
|
|
237
|
+
scope: I.scope,
|
|
218
238
|
co2eTonnes: e,
|
|
219
239
|
periodStart: t,
|
|
220
240
|
periodEnd: n,
|
|
221
|
-
source:
|
|
222
|
-
methodology:
|
|
223
|
-
notes:
|
|
224
|
-
}), i.success("Emission recorded"),
|
|
241
|
+
source: I.source.trim() || null,
|
|
242
|
+
methodology: I.methodology.trim() || null,
|
|
243
|
+
notes: I.notes.trim() || null
|
|
244
|
+
}), i.success("Emission recorded"), F(!1), L(j());
|
|
225
245
|
} catch (e) {
|
|
226
|
-
i.fromError(e),
|
|
246
|
+
i.fromError(e), z(e instanceof Error ? e.message : "Failed to record emission.");
|
|
227
247
|
}
|
|
228
248
|
};
|
|
229
|
-
return /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ h(e, {
|
|
230
250
|
title: "Emissions",
|
|
231
251
|
description: "ESG greenhouse-gas ledger across every asset — GHG Protocol Scope 1 / 2 / 3, with third-party verification.",
|
|
232
|
-
actions: /* @__PURE__ */
|
|
252
|
+
actions: /* @__PURE__ */ h(g, {
|
|
233
253
|
onClick: $,
|
|
234
|
-
children: [/* @__PURE__ */
|
|
254
|
+
children: [/* @__PURE__ */ m(p, { className: "mr-1.5 h-4 w-4" }), " Record emission"]
|
|
235
255
|
}),
|
|
236
256
|
children: [
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
className: "grid grid-cols-1 gap-4
|
|
239
|
-
children: [
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
/* @__PURE__ */ h("div", {
|
|
258
|
+
className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
|
|
259
|
+
children: [/* @__PURE__ */ h("div", {
|
|
260
|
+
className: "flex flex-col rounded-[var(--radius-card)] border border-border-subtle bg-bg-surface p-5 shadow-elevation-1",
|
|
261
|
+
children: [/* @__PURE__ */ h("div", {
|
|
262
|
+
className: "mb-1 flex items-center justify-between gap-2",
|
|
263
|
+
children: [/* @__PURE__ */ m("h3", {
|
|
264
|
+
className: "text-sm font-semibold text-text-secondary",
|
|
265
|
+
children: "Emissions by scope"
|
|
266
|
+
}), /* @__PURE__ */ m(f, {
|
|
267
|
+
className: "h-4 w-4 shrink-0 text-text-muted",
|
|
268
|
+
"aria-hidden": "true"
|
|
269
|
+
})]
|
|
270
|
+
}), q.isLoading ? /* @__PURE__ */ m("p", {
|
|
271
|
+
className: "flex flex-1 items-center py-8 text-sm text-text-tertiary",
|
|
272
|
+
children: "Loading breakdown…"
|
|
273
|
+
}) : Q.length > 0 ? /* @__PURE__ */ m(ae, {
|
|
274
|
+
className: "mt-3",
|
|
275
|
+
segments: Q,
|
|
276
|
+
size: 148,
|
|
277
|
+
thickness: .32,
|
|
278
|
+
centerLabel: De(X),
|
|
279
|
+
centerCaption: "t CO₂e",
|
|
280
|
+
valueFormatter: a
|
|
281
|
+
}) : /* @__PURE__ */ m("p", {
|
|
282
|
+
className: "flex flex-1 items-center py-8 text-sm text-text-tertiary",
|
|
283
|
+
children: "No emissions recorded yet."
|
|
284
|
+
})]
|
|
285
|
+
}), /* @__PURE__ */ h("div", {
|
|
286
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:col-span-2",
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ m(t, {
|
|
289
|
+
icon: /* @__PURE__ */ m(he, { className: "h-5 w-5" }),
|
|
290
|
+
value: Y > 0 ? a(X) : "—",
|
|
291
|
+
label: "Total CO₂e",
|
|
292
|
+
featured: !0,
|
|
293
|
+
footer: /* @__PURE__ */ h("p", {
|
|
294
|
+
className: "text-xs tabular-nums text-text-tertiary",
|
|
295
|
+
children: [
|
|
296
|
+
Y,
|
|
297
|
+
" record",
|
|
298
|
+
Y === 1 ? "" : "s",
|
|
299
|
+
" · Scope 1 · 2 · 3"
|
|
300
|
+
]
|
|
301
|
+
})
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ m(t, {
|
|
304
|
+
icon: /* @__PURE__ */ m(ge, { className: "h-5 w-5" }),
|
|
305
|
+
value: Y > 0 ? a(Z.SCOPE_1) : "—",
|
|
306
|
+
label: "Scope 1 · Direct",
|
|
307
|
+
footer: M(Z.SCOPE_1, X, "SCOPE_1")
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ m(t, {
|
|
310
|
+
icon: /* @__PURE__ */ m(ve, { className: "h-5 w-5" }),
|
|
311
|
+
value: Y > 0 ? a(Z.SCOPE_2) : "—",
|
|
312
|
+
label: "Scope 2 · Purchased energy",
|
|
313
|
+
footer: M(Z.SCOPE_2, X, "SCOPE_2")
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ m(t, {
|
|
316
|
+
icon: /* @__PURE__ */ m(_e, { className: "h-5 w-5" }),
|
|
317
|
+
value: Y > 0 ? a(Z.SCOPE_3) : "—",
|
|
318
|
+
label: "Scope 3 · Value chain",
|
|
319
|
+
footer: M(Z.SCOPE_3, X, "SCOPE_3")
|
|
253
320
|
})
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
icon: /* @__PURE__ */ y(_, { className: "h-5 w-5" }),
|
|
257
|
-
value: X.length > 0 ? a(Q.SCOPE_1) : "—",
|
|
258
|
-
label: "Scope 1 · Direct",
|
|
259
|
-
footer: I(Q.SCOPE_1, Z, "SCOPE_1")
|
|
260
|
-
}),
|
|
261
|
-
/* @__PURE__ */ y(t, {
|
|
262
|
-
icon: /* @__PURE__ */ y(fe, { className: "h-5 w-5" }),
|
|
263
|
-
value: X.length > 0 ? a(Q.SCOPE_2) : "—",
|
|
264
|
-
label: "Scope 2 · Purchased energy",
|
|
265
|
-
footer: I(Q.SCOPE_2, Z, "SCOPE_2")
|
|
266
|
-
}),
|
|
267
|
-
/* @__PURE__ */ y(t, {
|
|
268
|
-
icon: /* @__PURE__ */ y(de, { className: "h-5 w-5" }),
|
|
269
|
-
value: X.length > 0 ? a(Q.SCOPE_3) : "—",
|
|
270
|
-
label: "Scope 3 · Value chain",
|
|
271
|
-
footer: I(Q.SCOPE_3, Z, "SCOPE_3")
|
|
272
|
-
})
|
|
273
|
-
]
|
|
321
|
+
]
|
|
322
|
+
})]
|
|
274
323
|
}),
|
|
275
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ h("div", {
|
|
276
325
|
className: "mt-6 mb-5 flex flex-wrap items-center gap-3",
|
|
277
|
-
children: [/* @__PURE__ */
|
|
278
|
-
options:
|
|
326
|
+
children: [/* @__PURE__ */ m(de, {
|
|
327
|
+
options: E,
|
|
279
328
|
value: s,
|
|
280
329
|
onChange: (e) => {
|
|
281
|
-
|
|
330
|
+
D(e), P.reset();
|
|
282
331
|
}
|
|
283
|
-
}), /* @__PURE__ */ b
|
|
284
|
-
value:
|
|
332
|
+
}), /* @__PURE__ */ h(b, {
|
|
333
|
+
value: A,
|
|
285
334
|
onValueChange: (e) => {
|
|
286
|
-
|
|
335
|
+
N(e), P.reset();
|
|
287
336
|
},
|
|
288
|
-
children: [/* @__PURE__ */
|
|
337
|
+
children: [/* @__PURE__ */ m(C, {
|
|
289
338
|
className: "w-56",
|
|
290
339
|
"aria-label": "Filter by asset",
|
|
291
|
-
children: /* @__PURE__ */
|
|
292
|
-
}), /* @__PURE__ */
|
|
340
|
+
children: /* @__PURE__ */ m(w, { placeholder: "All assets" })
|
|
341
|
+
}), /* @__PURE__ */ h(x, { children: [/* @__PURE__ */ m(S, {
|
|
293
342
|
value: "ALL",
|
|
294
343
|
children: "All assets"
|
|
295
|
-
}),
|
|
344
|
+
}), U.map((e) => /* @__PURE__ */ m(S, {
|
|
296
345
|
value: e.id,
|
|
297
346
|
children: e.name
|
|
298
347
|
}, e.id))] })]
|
|
299
348
|
})]
|
|
300
349
|
}),
|
|
301
|
-
|
|
350
|
+
Ae ? /* @__PURE__ */ m(re, { label: "Loading emission records…" }) : je ? /* @__PURE__ */ m(ne, {
|
|
302
351
|
message: "Couldn't load emission records.",
|
|
303
|
-
onRetry: () =>
|
|
304
|
-
}) :
|
|
352
|
+
onRetry: () => Me()
|
|
353
|
+
}) : K.length === 0 ? /* @__PURE__ */ m(ie, {
|
|
305
354
|
illustration: "empty-data",
|
|
306
|
-
icon: /* @__PURE__ */
|
|
355
|
+
icon: /* @__PURE__ */ m(f, { className: "h-10 w-10" }),
|
|
307
356
|
title: "No emissions recorded",
|
|
308
|
-
description: s === "ALL" &&
|
|
309
|
-
action: /* @__PURE__ */
|
|
357
|
+
description: s === "ALL" && A === "ALL" ? "Record a CO₂e figure to start building your Scope 1–3 emissions ledger." : "No emission records match these filters.",
|
|
358
|
+
action: /* @__PURE__ */ h(g, {
|
|
310
359
|
onClick: $,
|
|
311
|
-
children: [/* @__PURE__ */
|
|
360
|
+
children: [/* @__PURE__ */ m(p, { className: "mr-1.5 h-4 w-4" }), " Record emission"]
|
|
312
361
|
})
|
|
313
|
-
}) : /* @__PURE__ */
|
|
314
|
-
columns:
|
|
315
|
-
rows:
|
|
362
|
+
}) : /* @__PURE__ */ h(ye, { children: [/* @__PURE__ */ m(c, {
|
|
363
|
+
columns: Pe,
|
|
364
|
+
rows: K,
|
|
316
365
|
rowKey: (e) => e.id,
|
|
317
366
|
defaultSort: {
|
|
318
367
|
key: "period",
|
|
319
368
|
dir: "desc"
|
|
320
369
|
}
|
|
321
|
-
}), /* @__PURE__ */
|
|
322
|
-
page:
|
|
323
|
-
pageSize:
|
|
324
|
-
itemCount:
|
|
325
|
-
hasMore:
|
|
326
|
-
onPageChange:
|
|
370
|
+
}), /* @__PURE__ */ m(fe, {
|
|
371
|
+
page: P.page,
|
|
372
|
+
pageSize: k,
|
|
373
|
+
itemCount: K.length,
|
|
374
|
+
hasMore: W?.pageInfo?.hasMore ?? !1,
|
|
375
|
+
onPageChange: P.onPageChange
|
|
327
376
|
})] }),
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
open:
|
|
377
|
+
/* @__PURE__ */ m(be, {
|
|
378
|
+
open: Oe,
|
|
330
379
|
onOpenChange: (e) => {
|
|
331
|
-
|
|
380
|
+
F(e), e || (L(j()), z(null));
|
|
332
381
|
},
|
|
333
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ h(xe, { children: [/* @__PURE__ */ h(y, { children: [/* @__PURE__ */ m(we, { children: "Record emission" }), /* @__PURE__ */ m(Se, { children: "Log a CO₂e figure for a reporting period — optionally attributed to an asset." })] }), /* @__PURE__ */ h("form", {
|
|
334
383
|
onSubmit: (e) => {
|
|
335
|
-
e.preventDefault(),
|
|
384
|
+
e.preventDefault(), Fe();
|
|
336
385
|
},
|
|
337
|
-
children: [/* @__PURE__ */
|
|
386
|
+
children: [/* @__PURE__ */ h("div", {
|
|
338
387
|
className: "grid gap-4 py-2",
|
|
339
388
|
children: [
|
|
340
|
-
/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ h("div", {
|
|
341
390
|
className: "grid gap-2 sm:grid-cols-2",
|
|
342
|
-
children: [/* @__PURE__ */
|
|
391
|
+
children: [/* @__PURE__ */ h("div", {
|
|
343
392
|
className: "grid gap-1.5",
|
|
344
|
-
children: [/* @__PURE__ */
|
|
393
|
+
children: [/* @__PURE__ */ m(v, {
|
|
345
394
|
htmlFor: "emScope",
|
|
346
395
|
children: "Scope"
|
|
347
|
-
}), /* @__PURE__ */ b
|
|
348
|
-
value:
|
|
349
|
-
onValueChange: (e) =>
|
|
350
|
-
...
|
|
396
|
+
}), /* @__PURE__ */ h(b, {
|
|
397
|
+
value: I.scope,
|
|
398
|
+
onValueChange: (e) => L({
|
|
399
|
+
...I,
|
|
351
400
|
scope: e
|
|
352
401
|
}),
|
|
353
|
-
children: [/* @__PURE__ */
|
|
402
|
+
children: [/* @__PURE__ */ m(C, {
|
|
354
403
|
id: "emScope",
|
|
355
|
-
children: /* @__PURE__ */
|
|
356
|
-
}), /* @__PURE__ */
|
|
404
|
+
children: /* @__PURE__ */ m(w, {})
|
|
405
|
+
}), /* @__PURE__ */ m(x, { children: T.map((e) => /* @__PURE__ */ m(S, {
|
|
357
406
|
value: e,
|
|
358
407
|
children: r(e)
|
|
359
408
|
}, e)) })]
|
|
360
409
|
})]
|
|
361
|
-
}), /* @__PURE__ */
|
|
410
|
+
}), /* @__PURE__ */ h("div", {
|
|
362
411
|
className: "grid gap-1.5",
|
|
363
|
-
children: [/* @__PURE__ */
|
|
412
|
+
children: [/* @__PURE__ */ m(v, {
|
|
364
413
|
htmlFor: "emCo2e",
|
|
365
414
|
children: "CO₂e (tonnes) *"
|
|
366
|
-
}), /* @__PURE__ */
|
|
415
|
+
}), /* @__PURE__ */ m(_, {
|
|
367
416
|
id: "emCo2e",
|
|
368
417
|
type: "number",
|
|
369
418
|
min: "0",
|
|
370
419
|
step: "any",
|
|
371
|
-
value:
|
|
372
|
-
onChange: (e) =>
|
|
373
|
-
...
|
|
420
|
+
value: I.co2eTonnes,
|
|
421
|
+
onChange: (e) => L({
|
|
422
|
+
...I,
|
|
374
423
|
co2eTonnes: e.target.value
|
|
375
424
|
}),
|
|
376
425
|
placeholder: "1250"
|
|
377
426
|
})]
|
|
378
427
|
})]
|
|
379
428
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ h("div", {
|
|
381
430
|
className: "grid gap-1.5",
|
|
382
|
-
children: [/* @__PURE__ */
|
|
431
|
+
children: [/* @__PURE__ */ m(v, {
|
|
383
432
|
htmlFor: "emAsset",
|
|
384
433
|
children: "Asset"
|
|
385
|
-
}), /* @__PURE__ */ b
|
|
386
|
-
value:
|
|
387
|
-
onValueChange: (e) =>
|
|
388
|
-
...
|
|
434
|
+
}), /* @__PURE__ */ h(b, {
|
|
435
|
+
value: I.assetId,
|
|
436
|
+
onValueChange: (e) => L({
|
|
437
|
+
...I,
|
|
389
438
|
assetId: e
|
|
390
439
|
}),
|
|
391
|
-
children: [/* @__PURE__ */
|
|
440
|
+
children: [/* @__PURE__ */ m(C, {
|
|
392
441
|
id: "emAsset",
|
|
393
|
-
children: /* @__PURE__ */
|
|
394
|
-
}), /* @__PURE__ */
|
|
442
|
+
children: /* @__PURE__ */ m(w, { placeholder: "Optional — org-wide if unset" })
|
|
443
|
+
}), /* @__PURE__ */ m(x, { children: U.map((e) => /* @__PURE__ */ m(S, {
|
|
395
444
|
value: e.id,
|
|
396
445
|
children: e.name
|
|
397
446
|
}, e.id)) })]
|
|
398
447
|
})]
|
|
399
448
|
}),
|
|
400
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ h("div", {
|
|
401
450
|
className: "grid gap-2 sm:grid-cols-2",
|
|
402
|
-
children: [/* @__PURE__ */
|
|
451
|
+
children: [/* @__PURE__ */ h("div", {
|
|
403
452
|
className: "grid gap-1.5",
|
|
404
|
-
children: [/* @__PURE__ */
|
|
453
|
+
children: [/* @__PURE__ */ m(v, {
|
|
405
454
|
htmlFor: "emStart",
|
|
406
455
|
children: "Period start *"
|
|
407
|
-
}), /* @__PURE__ */
|
|
456
|
+
}), /* @__PURE__ */ m(_, {
|
|
408
457
|
id: "emStart",
|
|
409
458
|
type: "date",
|
|
410
|
-
value:
|
|
411
|
-
onChange: (e) =>
|
|
412
|
-
...
|
|
459
|
+
value: I.periodStart,
|
|
460
|
+
onChange: (e) => L({
|
|
461
|
+
...I,
|
|
413
462
|
periodStart: e.target.value
|
|
414
463
|
})
|
|
415
464
|
})]
|
|
416
|
-
}), /* @__PURE__ */
|
|
465
|
+
}), /* @__PURE__ */ h("div", {
|
|
417
466
|
className: "grid gap-1.5",
|
|
418
|
-
children: [/* @__PURE__ */
|
|
467
|
+
children: [/* @__PURE__ */ m(v, {
|
|
419
468
|
htmlFor: "emEnd",
|
|
420
469
|
children: "Period end *"
|
|
421
|
-
}), /* @__PURE__ */
|
|
470
|
+
}), /* @__PURE__ */ m(_, {
|
|
422
471
|
id: "emEnd",
|
|
423
472
|
type: "date",
|
|
424
|
-
value:
|
|
425
|
-
onChange: (e) =>
|
|
426
|
-
...
|
|
473
|
+
value: I.periodEnd,
|
|
474
|
+
onChange: (e) => L({
|
|
475
|
+
...I,
|
|
427
476
|
periodEnd: e.target.value
|
|
428
477
|
})
|
|
429
478
|
})]
|
|
430
479
|
})]
|
|
431
480
|
}),
|
|
432
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ h("div", {
|
|
433
482
|
className: "grid gap-2 sm:grid-cols-2",
|
|
434
|
-
children: [/* @__PURE__ */
|
|
483
|
+
children: [/* @__PURE__ */ h("div", {
|
|
435
484
|
className: "grid gap-1.5",
|
|
436
|
-
children: [/* @__PURE__ */
|
|
485
|
+
children: [/* @__PURE__ */ m(v, {
|
|
437
486
|
htmlFor: "emSource",
|
|
438
487
|
children: "Source"
|
|
439
|
-
}), /* @__PURE__ */
|
|
488
|
+
}), /* @__PURE__ */ m(_, {
|
|
440
489
|
id: "emSource",
|
|
441
|
-
value:
|
|
442
|
-
onChange: (e) =>
|
|
443
|
-
...
|
|
490
|
+
value: I.source,
|
|
491
|
+
onChange: (e) => L({
|
|
492
|
+
...I,
|
|
444
493
|
source: e.target.value
|
|
445
494
|
}),
|
|
446
495
|
placeholder: "Flaring, grid electricity…"
|
|
447
496
|
})]
|
|
448
|
-
}), /* @__PURE__ */
|
|
497
|
+
}), /* @__PURE__ */ h("div", {
|
|
449
498
|
className: "grid gap-1.5",
|
|
450
|
-
children: [/* @__PURE__ */
|
|
499
|
+
children: [/* @__PURE__ */ m(v, {
|
|
451
500
|
htmlFor: "emMethod",
|
|
452
501
|
children: "Methodology"
|
|
453
|
-
}), /* @__PURE__ */
|
|
502
|
+
}), /* @__PURE__ */ m(_, {
|
|
454
503
|
id: "emMethod",
|
|
455
|
-
value:
|
|
456
|
-
onChange: (e) =>
|
|
457
|
-
...
|
|
504
|
+
value: I.methodology,
|
|
505
|
+
onChange: (e) => L({
|
|
506
|
+
...I,
|
|
458
507
|
methodology: e.target.value
|
|
459
508
|
}),
|
|
460
509
|
placeholder: "GHG Protocol / IPCC / API"
|
|
461
510
|
})]
|
|
462
511
|
})]
|
|
463
512
|
}),
|
|
464
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ h("div", {
|
|
465
514
|
className: "grid gap-1.5",
|
|
466
|
-
children: [/* @__PURE__ */
|
|
515
|
+
children: [/* @__PURE__ */ m(v, {
|
|
467
516
|
htmlFor: "emNotes",
|
|
468
517
|
children: "Notes"
|
|
469
|
-
}), /* @__PURE__ */
|
|
518
|
+
}), /* @__PURE__ */ m(Te, {
|
|
470
519
|
id: "emNotes",
|
|
471
520
|
rows: 2,
|
|
472
|
-
value:
|
|
473
|
-
onChange: (e) =>
|
|
474
|
-
...
|
|
521
|
+
value: I.notes,
|
|
522
|
+
onChange: (e) => L({
|
|
523
|
+
...I,
|
|
475
524
|
notes: e.target.value
|
|
476
525
|
}),
|
|
477
526
|
placeholder: "Optional context about this figure."
|
|
478
527
|
})]
|
|
479
528
|
}),
|
|
480
|
-
|
|
529
|
+
R && /* @__PURE__ */ m("p", {
|
|
481
530
|
className: "text-sm text-status-error-text",
|
|
482
|
-
children:
|
|
531
|
+
children: R
|
|
483
532
|
})
|
|
484
533
|
]
|
|
485
|
-
}), /* @__PURE__ */
|
|
534
|
+
}), /* @__PURE__ */ h(Ce, { children: [/* @__PURE__ */ m(g, {
|
|
486
535
|
type: "button",
|
|
487
536
|
variant: "outline",
|
|
488
|
-
onClick: () =>
|
|
537
|
+
onClick: () => F(!1),
|
|
489
538
|
children: "Cancel"
|
|
490
|
-
}), /* @__PURE__ */
|
|
539
|
+
}), /* @__PURE__ */ m(g, {
|
|
491
540
|
type: "submit",
|
|
492
|
-
disabled:
|
|
493
|
-
children:
|
|
541
|
+
disabled: G.isPending,
|
|
542
|
+
children: G.isPending ? "Recording…" : "Record emission"
|
|
494
543
|
})] })]
|
|
495
544
|
})] })
|
|
496
545
|
})
|
|
@@ -498,6 +547,6 @@ function L() {
|
|
|
498
547
|
});
|
|
499
548
|
}
|
|
500
549
|
//#endregion
|
|
501
|
-
export {
|
|
550
|
+
export { N as EmissionsPage };
|
|
502
551
|
|
|
503
552
|
//# sourceMappingURL=EmissionsPage.js.map
|