@burdenoff/microfe-ecoimpacthub 2026.1110.9 → 2026.1112.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/ecoimpacthub/EcoImpactHubRoot.js +74 -66
- package/dist/ecoimpacthub/EcoImpactHubRoot.js.map +1 -1
- package/dist/ecoimpacthub/EcoImpactHubRoutes.js +38 -34
- package/dist/ecoimpacthub/EcoImpactHubRoutes.js.map +1 -1
- package/dist/ecoimpacthub/components/StatusBadge.js +14 -1
- package/dist/ecoimpacthub/components/StatusBadge.js.map +1 -1
- package/dist/ecoimpacthub/hooks/index.js +10 -10
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.d.ts +87 -1
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.js +296 -113
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.js.map +1 -1
- package/dist/ecoimpacthub/pages/ehs/EhsPage.d.ts +15 -0
- package/dist/ecoimpacthub/pages/ehs/EhsPage.js +1504 -0
- package/dist/ecoimpacthub/pages/ehs/EhsPage.js.map +1 -0
- package/dist/ecoimpacthub/types/index.d.ts +173 -0
- package/package.json +1 -1
|
@@ -5,152 +5,160 @@ import { useCallback as r, useEffect as i } from "react";
|
|
|
5
5
|
import { QueryClient as a, QueryClientProvider as o } from "@tanstack/react-query";
|
|
6
6
|
import { FeatureFlagProvider as s } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
7
7
|
import { useI18n as c } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
8
|
-
import { Binoculars as l, BookOpen as u, Factory as d, FileCheck2 as f, FileText as p, Gauge as m, HandCoins as h, LayoutDashboard as g, MapPin as _, PawPrint as v, Recycle as y,
|
|
9
|
-
import { jsx as
|
|
8
|
+
import { Binoculars as l, BookOpen as u, Factory as d, FileCheck2 as f, FileText as p, Gauge as m, HandCoins as h, LayoutDashboard as g, MapPin as _, PawPrint as v, Recycle as y, ShieldCheck as b, Sun as x, Trees as S } from "lucide-react";
|
|
9
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
10
10
|
// src/ecoimpacthub/EcoImpactHubRoot.tsx
|
|
11
|
-
var
|
|
11
|
+
var w = new a({ defaultOptions: { queries: {
|
|
12
12
|
staleTime: 3e5,
|
|
13
13
|
retry: 1,
|
|
14
14
|
refetchOnWindowFocus: !1
|
|
15
|
-
} } }),
|
|
16
|
-
let { registerNavItems:
|
|
17
|
-
let n =
|
|
15
|
+
} } }), T = (a) => {
|
|
16
|
+
let { registerNavItems: T, registerFooterItems: E, basePath: D = "/" } = a, { t: O } = c(), k = r((e, t) => {
|
|
17
|
+
let n = O(e);
|
|
18
18
|
return n === e ? t : n;
|
|
19
|
-
}, [
|
|
19
|
+
}, [O]);
|
|
20
20
|
return i(() => {
|
|
21
|
-
if (!
|
|
21
|
+
if (!T) return;
|
|
22
22
|
let e = [
|
|
23
23
|
{
|
|
24
24
|
id: "ecoimpacthub-dashboard",
|
|
25
|
-
label:
|
|
26
|
-
path: n(
|
|
27
|
-
icon: /* @__PURE__ */
|
|
25
|
+
label: k("ecoimpacthub.nav.dashboard", "Dashboard"),
|
|
26
|
+
path: n(D, ""),
|
|
27
|
+
icon: /* @__PURE__ */ C(g, { size: 20 }),
|
|
28
28
|
order: 0,
|
|
29
29
|
group: "products"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
id: "ecoimpacthub-sites",
|
|
33
|
-
label:
|
|
34
|
-
path: n(
|
|
35
|
-
icon: /* @__PURE__ */
|
|
33
|
+
label: k("ecoimpacthub.nav.sites", "Sites"),
|
|
34
|
+
path: n(D, "sites"),
|
|
35
|
+
icon: /* @__PURE__ */ C(_, { size: 20 }),
|
|
36
36
|
order: 1,
|
|
37
37
|
group: "products"
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
id: "ecoimpacthub-monitoring",
|
|
41
|
-
label:
|
|
42
|
-
path: n(
|
|
43
|
-
icon: /* @__PURE__ */
|
|
41
|
+
label: k("ecoimpacthub.nav.monitoring", "Monitoring"),
|
|
42
|
+
path: n(D, "monitoring"),
|
|
43
|
+
icon: /* @__PURE__ */ C(m, { size: 20 }),
|
|
44
44
|
order: 2,
|
|
45
45
|
group: "products"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
id: "ecoimpacthub-
|
|
49
|
-
label:
|
|
50
|
-
path: n(
|
|
51
|
-
icon: /* @__PURE__ */
|
|
48
|
+
id: "ecoimpacthub-ehs",
|
|
49
|
+
label: k("ecoimpacthub.nav.ehs", "EHS Compliance"),
|
|
50
|
+
path: n(D, "ehs"),
|
|
51
|
+
icon: /* @__PURE__ */ C(b, { size: 20 }),
|
|
52
52
|
order: 3,
|
|
53
53
|
group: "products"
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
id: "ecoimpacthub-
|
|
57
|
-
label:
|
|
58
|
-
path: n(
|
|
59
|
-
icon: /* @__PURE__ */
|
|
56
|
+
id: "ecoimpacthub-species",
|
|
57
|
+
label: k("ecoimpacthub.nav.species", "Species"),
|
|
58
|
+
path: n(D, "species"),
|
|
59
|
+
icon: /* @__PURE__ */ C(v, { size: 20 }),
|
|
60
60
|
order: 4,
|
|
61
61
|
group: "products"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
id: "ecoimpacthub-
|
|
65
|
-
label:
|
|
66
|
-
path: n(
|
|
67
|
-
icon: /* @__PURE__ */
|
|
64
|
+
id: "ecoimpacthub-observations",
|
|
65
|
+
label: k("ecoimpacthub.nav.observations", "Observations"),
|
|
66
|
+
path: n(D, "observations"),
|
|
67
|
+
icon: /* @__PURE__ */ C(l, { size: 20 }),
|
|
68
68
|
order: 5,
|
|
69
69
|
group: "products"
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
id: "ecoimpacthub-
|
|
73
|
-
label:
|
|
74
|
-
path: n(
|
|
75
|
-
icon: /* @__PURE__ */ S
|
|
72
|
+
id: "ecoimpacthub-habitat",
|
|
73
|
+
label: k("ecoimpacthub.nav.habitat", "Habitat"),
|
|
74
|
+
path: n(D, "habitat"),
|
|
75
|
+
icon: /* @__PURE__ */ C(S, { size: 20 }),
|
|
76
76
|
order: 6,
|
|
77
77
|
group: "products"
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
|
-
id: "ecoimpacthub-
|
|
81
|
-
label:
|
|
82
|
-
path: n(
|
|
83
|
-
icon: /* @__PURE__ */
|
|
80
|
+
id: "ecoimpacthub-carbon",
|
|
81
|
+
label: k("ecoimpacthub.nav.carbon", "Carbon"),
|
|
82
|
+
path: n(D, "carbon"),
|
|
83
|
+
icon: /* @__PURE__ */ C(d, { size: 20 }),
|
|
84
84
|
order: 7,
|
|
85
85
|
group: "products"
|
|
86
86
|
},
|
|
87
|
+
{
|
|
88
|
+
id: "ecoimpacthub-circularity",
|
|
89
|
+
label: k("ecoimpacthub.nav.circularity", "Waste & Circularity"),
|
|
90
|
+
path: n(D, "circularity"),
|
|
91
|
+
icon: /* @__PURE__ */ C(y, { size: 20 }),
|
|
92
|
+
order: 8,
|
|
93
|
+
group: "products"
|
|
94
|
+
},
|
|
87
95
|
{
|
|
88
96
|
id: "ecoimpacthub-metrics",
|
|
89
|
-
label:
|
|
90
|
-
path: n(
|
|
91
|
-
icon: /* @__PURE__ */
|
|
92
|
-
order:
|
|
97
|
+
label: k("ecoimpacthub.nav.metrics", "Metrics"),
|
|
98
|
+
path: n(D, "metrics"),
|
|
99
|
+
icon: /* @__PURE__ */ C(u, { size: 20 }),
|
|
100
|
+
order: 8,
|
|
93
101
|
group: "products"
|
|
94
102
|
},
|
|
95
103
|
{
|
|
96
104
|
id: "ecoimpacthub-energy",
|
|
97
|
-
label:
|
|
98
|
-
path: n(
|
|
99
|
-
icon: /* @__PURE__ */
|
|
105
|
+
label: k("ecoimpacthub.nav.energy", "Energy"),
|
|
106
|
+
path: n(D, "energy"),
|
|
107
|
+
icon: /* @__PURE__ */ C(x, { size: 20 }),
|
|
100
108
|
order: 8,
|
|
101
109
|
group: "products"
|
|
102
110
|
},
|
|
103
111
|
{
|
|
104
112
|
id: "ecoimpacthub-reports",
|
|
105
|
-
label:
|
|
106
|
-
path: n(
|
|
107
|
-
icon: /* @__PURE__ */
|
|
108
|
-
order:
|
|
113
|
+
label: k("ecoimpacthub.nav.reports", "Reports"),
|
|
114
|
+
path: n(D, "reports"),
|
|
115
|
+
icon: /* @__PURE__ */ C(p, { size: 20 }),
|
|
116
|
+
order: 10,
|
|
109
117
|
group: "products"
|
|
110
118
|
},
|
|
111
119
|
{
|
|
112
120
|
id: "ecoimpacthub-compliance",
|
|
113
|
-
label:
|
|
114
|
-
path: n(
|
|
115
|
-
icon: /* @__PURE__ */
|
|
121
|
+
label: k("ecoimpacthub.nav.compliance", "Compliance"),
|
|
122
|
+
path: n(D, "compliance"),
|
|
123
|
+
icon: /* @__PURE__ */ C(f, { size: 20 }),
|
|
116
124
|
order: 9,
|
|
117
125
|
group: "products"
|
|
118
126
|
},
|
|
119
127
|
{
|
|
120
128
|
id: "ecoimpacthub-grants",
|
|
121
|
-
label:
|
|
122
|
-
path: n(
|
|
123
|
-
icon: /* @__PURE__ */
|
|
129
|
+
label: k("ecoimpacthub.nav.grants", "Grants"),
|
|
130
|
+
path: n(D, "grants"),
|
|
131
|
+
icon: /* @__PURE__ */ C(h, { size: 20 }),
|
|
124
132
|
order: 8,
|
|
125
133
|
group: "products"
|
|
126
134
|
}
|
|
127
135
|
];
|
|
128
|
-
return
|
|
136
|
+
return T(e);
|
|
129
137
|
}, [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
T,
|
|
139
|
+
D,
|
|
140
|
+
k
|
|
133
141
|
]), i(() => {
|
|
134
|
-
if (
|
|
142
|
+
if (E) return E([{
|
|
135
143
|
id: "ecoimpacthub-status",
|
|
136
|
-
label:
|
|
144
|
+
label: k("ecoimpacthub.footer.ready", "EcoImpactHub Ready"),
|
|
137
145
|
type: "status",
|
|
138
146
|
section: "left",
|
|
139
147
|
order: 10
|
|
140
148
|
}]);
|
|
141
|
-
}, [
|
|
142
|
-
client:
|
|
143
|
-
children: /* @__PURE__ */
|
|
149
|
+
}, [E, k]), /* @__PURE__ */ C(o, {
|
|
150
|
+
client: w,
|
|
151
|
+
children: /* @__PURE__ */ C(s, {
|
|
144
152
|
workspaceId: null,
|
|
145
153
|
gateway: "global",
|
|
146
154
|
defaultEnabled: !0,
|
|
147
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ C(e, {
|
|
148
156
|
...a,
|
|
149
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ C(t, {})
|
|
150
158
|
})
|
|
151
159
|
})
|
|
152
160
|
});
|
|
153
161
|
};
|
|
154
|
-
export {
|
|
162
|
+
export { T as EcoImpactHubRoot };
|
|
155
163
|
|
|
156
164
|
//# sourceMappingURL=EcoImpactHubRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EcoImpactHubRoot.js","names":["queryClient","QueryClient","EcoImpactHubRoot","props","translate","useI18n","t","useCallback","value","key","fallback","useEffect","registerNavItems","navItems","joinPath","basePath","LayoutDashboard","MapPin","Gauge","PawPrint","Binoculars","Trees","Factory","Recycle","BookOpen","Sun","FileText","FileCheck2","HandCoins","registerFooterItems","QueryClientProvider","FeatureFlagProvider","EcoImpactHubProvider","EcoImpactHubRoutes"],"sources":["../../src/ecoimpacthub/EcoImpactHubRoot.tsx"],"sourcesContent":["/**\n * EcoImpactHub Root Component\n * @module ecoimpacthub\n *\n * Host-contract entry point. Registers the product's sidebar nav (eleven sections\n * that map 1:1 to the wspace-ecoimpacthub-svc `eco*` backend) and mounts the\n * routed pages inside the shared QueryClient + FeatureFlag providers.\n */\n\nimport type { FC } from 'react';\nimport { useCallback, useEffect } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n LayoutDashboard,\n MapPin,\n Gauge,\n PawPrint,\n Binoculars,\n Trees,\n Factory,\n Recycle,\n BookOpen,\n Sun,\n FileCheck2,\n FileText,\n HandCoins,\n} from 'lucide-react';\nimport { EcoImpactHubProvider } from './context/EcoImpactHubContext';\nimport { EcoImpactHubRoutes } from './EcoImpactHubRoutes';\nimport { joinPath } from './utils/navigation';\nimport type { EcoImpactHubRootProps, NavItem } from './types';\n\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 5 * 60 * 1000,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n});\n\nexport const EcoImpactHubRoot: FC<EcoImpactHubRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const { t: translate } = useI18n();\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n\n // Register navigation items with the shell on mount. Ids/paths/orders match\n // the app-shell static NavRegistration block so the two are a single,\n // consistent source of truth.\n useEffect(() => {\n if (!registerNavItems) return;\n\n const navItems: NavItem[] = [\n {\n id: 'ecoimpacthub-dashboard',\n label: t('ecoimpacthub.nav.dashboard', 'Dashboard'),\n path: joinPath(basePath, ''),\n icon: <LayoutDashboard size={20} />,\n order: 0,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-sites',\n label: t('ecoimpacthub.nav.sites', 'Sites'),\n path: joinPath(basePath, 'sites'),\n icon: <MapPin size={20} />,\n order: 1,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-monitoring',\n label: t('ecoimpacthub.nav.monitoring', 'Monitoring'),\n path: joinPath(basePath, 'monitoring'),\n icon: <Gauge size={20} />,\n order: 2,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-species',\n label: t('ecoimpacthub.nav.species', 'Species'),\n path: joinPath(basePath, 'species'),\n icon: <PawPrint size={20} />,\n order:
|
|
1
|
+
{"version":3,"file":"EcoImpactHubRoot.js","names":["queryClient","QueryClient","EcoImpactHubRoot","props","translate","useI18n","t","useCallback","value","key","fallback","useEffect","registerNavItems","navItems","joinPath","basePath","LayoutDashboard","MapPin","Gauge","ShieldCheck","PawPrint","Binoculars","Trees","Factory","Recycle","BookOpen","Sun","FileText","FileCheck2","HandCoins","registerFooterItems","QueryClientProvider","FeatureFlagProvider","EcoImpactHubProvider","EcoImpactHubRoutes"],"sources":["../../src/ecoimpacthub/EcoImpactHubRoot.tsx"],"sourcesContent":["/**\n * EcoImpactHub Root Component\n * @module ecoimpacthub\n *\n * Host-contract entry point. Registers the product's sidebar nav (eleven sections\n * that map 1:1 to the wspace-ecoimpacthub-svc `eco*` backend) and mounts the\n * routed pages inside the shared QueryClient + FeatureFlag providers.\n */\n\nimport type { FC } from 'react';\nimport { useCallback, useEffect } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n LayoutDashboard,\n MapPin,\n Gauge,\n ShieldCheck,\n PawPrint,\n Binoculars,\n Trees,\n Factory,\n Recycle,\n BookOpen,\n Sun,\n FileCheck2,\n FileText,\n HandCoins,\n} from 'lucide-react';\nimport { EcoImpactHubProvider } from './context/EcoImpactHubContext';\nimport { EcoImpactHubRoutes } from './EcoImpactHubRoutes';\nimport { joinPath } from './utils/navigation';\nimport type { EcoImpactHubRootProps, NavItem } from './types';\n\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 5 * 60 * 1000,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n});\n\nexport const EcoImpactHubRoot: FC<EcoImpactHubRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const { t: translate } = useI18n();\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n\n // Register navigation items with the shell on mount. Ids/paths/orders match\n // the app-shell static NavRegistration block so the two are a single,\n // consistent source of truth.\n useEffect(() => {\n if (!registerNavItems) return;\n\n const navItems: NavItem[] = [\n {\n id: 'ecoimpacthub-dashboard',\n label: t('ecoimpacthub.nav.dashboard', 'Dashboard'),\n path: joinPath(basePath, ''),\n icon: <LayoutDashboard size={20} />,\n order: 0,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-sites',\n label: t('ecoimpacthub.nav.sites', 'Sites'),\n path: joinPath(basePath, 'sites'),\n icon: <MapPin size={20} />,\n order: 1,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-monitoring',\n label: t('ecoimpacthub.nav.monitoring', 'Monitoring'),\n path: joinPath(basePath, 'monitoring'),\n icon: <Gauge size={20} />,\n order: 2,\n group: 'products',\n },\n\n {\n id: 'ecoimpacthub-ehs',\n label: t('ecoimpacthub.nav.ehs', 'EHS Compliance'),\n path: joinPath(basePath, 'ehs'),\n icon: <ShieldCheck size={20} />,\n order: 3,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-species',\n label: t('ecoimpacthub.nav.species', 'Species'),\n path: joinPath(basePath, 'species'),\n icon: <PawPrint size={20} />,\n order: 4,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-observations',\n label: t('ecoimpacthub.nav.observations', 'Observations'),\n path: joinPath(basePath, 'observations'),\n icon: <Binoculars size={20} />,\n order: 5,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-habitat',\n label: t('ecoimpacthub.nav.habitat', 'Habitat'),\n path: joinPath(basePath, 'habitat'),\n icon: <Trees size={20} />,\n order: 6,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-carbon',\n label: t('ecoimpacthub.nav.carbon', 'Carbon'),\n path: joinPath(basePath, 'carbon'),\n icon: <Factory size={20} />,\n order: 7,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-circularity',\n label: t('ecoimpacthub.nav.circularity', 'Waste & Circularity'),\n path: joinPath(basePath, 'circularity'),\n icon: <Recycle size={20} />,\n order: 8,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-metrics',\n label: t('ecoimpacthub.nav.metrics', 'Metrics'),\n path: joinPath(basePath, 'metrics'),\n icon: <BookOpen size={20} />,\n order: 8,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-energy',\n label: t('ecoimpacthub.nav.energy', 'Energy'),\n path: joinPath(basePath, 'energy'),\n icon: <Sun size={20} />,\n order: 8,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-reports',\n label: t('ecoimpacthub.nav.reports', 'Reports'),\n path: joinPath(basePath, 'reports'),\n icon: <FileText size={20} />,\n order: 10,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-compliance',\n label: t('ecoimpacthub.nav.compliance', 'Compliance'),\n path: joinPath(basePath, 'compliance'),\n icon: <FileCheck2 size={20} />,\n order: 9,\n group: 'products',\n },\n {\n id: 'ecoimpacthub-grants',\n label: t('ecoimpacthub.nav.grants', 'Grants'),\n path: joinPath(basePath, 'grants'),\n icon: <HandCoins size={20} />,\n order: 8,\n group: 'products',\n },\n ];\n\n return registerNavItems(navItems);\n }, [registerNavItems, basePath, t]);\n\n useEffect(() => {\n if (!registerFooterItems) return;\n return registerFooterItems([\n {\n id: 'ecoimpacthub-status',\n label: t('ecoimpacthub.footer.ready', 'EcoImpactHub Ready'),\n type: 'status',\n section: 'left',\n order: 10,\n },\n ]);\n }, [registerFooterItems, t]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <EcoImpactHubProvider {...props}>\n <EcoImpactHubRoutes />\n </EcoImpactHubProvider>\n </FeatureFlagProvider>\n </QueryClientProvider>\n );\n};\n"],"mappings":";;;;;;;;;;AAmCA,IAAMA,IAAc,IAAIC,EAAY,EAClC,gBAAgB,EACd,SAAS;CACP,WAAW;CACX,OAAO;CACP,sBAAsB;AACxB,EACF,EACF,CAAC,GAEYC,KAA+C,MAAU;CACpE,IAAM,EAAE,qBAAkB,wBAAqB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BAACc,GAAD,EAAW,MAAM,GAAK,CAAA;IAC5B,OAAO;IACP,OAAO;GACT;EACF;EAEA,OAAOjB,EAAiBC,CAAQ;CAClC,GAAG;EAACD;EAAkBG;EAAUT;CAAC,CAAC,GAElCK,QAAgB;EACd,IAAKmB,GACL,OAAOA,EAAoB,CACzB;GACE,IAAI;GACJ,OAAOxB,EAAE,6BAA6B,oBAAoB;GAC1D,MAAM;GACN,SAAS;GACT,OAAO;EACT,CACF,CAAC;CACH,GAAG,CAACwB,GAAqBxB,CAAC,CAAC,GAGzB,kBAACyB,GAAD;EAAqB,QAAQ/B;EAC3B,UAAA,kBAACgC,GAAD;GAAqB,aAAa;GAAM,SAAQ;GAAS,gBAAgB;GACvE,UAAA,kBAACC,GAAD;IAAsB,GAAI9B;IACxB,UAAA,kBAAC+B,GAAD,CAAqB,CAAA;GACD,CAAA;EACH,CAAA;CACF,CAAA;AAEzB"}
|
|
@@ -7,125 +7,129 @@ import { Navigate as s, Route as c, Routes as l, useLocation as u } from "react-
|
|
|
7
7
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
8
|
import { Spinner as p } from "@burdenoff/fe-libs/ui";
|
|
9
9
|
// src/ecoimpacthub/EcoImpactHubRoutes.tsx
|
|
10
|
-
var m = a(() => import("./pages/sites/SitesPage.js").then((e) => ({ default: e.SitesPage }))), h = a(() => import("./pages/sites/SiteDetailPage.js").then((e) => ({ default: e.SiteDetailPage }))), g = a(() => import("./pages/monitoring/MonitoringPage.js").then((e) => ({ default: e.MonitoringPage }))), _ = a(() => import("./pages/species/SpeciesPage.js").then((e) => ({ default: e.SpeciesPage }))),
|
|
11
|
-
function
|
|
10
|
+
var m = a(() => import("./pages/sites/SitesPage.js").then((e) => ({ default: e.SitesPage }))), h = a(() => import("./pages/sites/SiteDetailPage.js").then((e) => ({ default: e.SiteDetailPage }))), g = a(() => import("./pages/monitoring/MonitoringPage.js").then((e) => ({ default: e.MonitoringPage }))), _ = a(() => import("./pages/ehs/EhsPage.js").then((e) => ({ default: e.EhsPage }))), v = a(() => import("./pages/species/SpeciesPage.js").then((e) => ({ default: e.SpeciesPage }))), y = a(() => import("./pages/species/SpeciesDetailPage.js").then((e) => ({ default: e.SpeciesDetailPage }))), b = a(() => import("./pages/observations/ObservationsPage.js").then((e) => ({ default: e.ObservationsPage }))), x = a(() => import("./pages/habitat/HabitatProjectsPage.js").then((e) => ({ default: e.HabitatProjectsPage }))), S = a(() => import("./pages/habitat/HabitatProjectDetailPage.js").then((e) => ({ default: e.HabitatProjectDetailPage }))), C = a(() => import("./pages/carbon/CarbonPage.js").then((e) => ({ default: e.CarbonPage }))), w = a(() => import("./pages/energy/EnergyPage.js").then((e) => ({ default: e.EnergyPage }))), T = a(() => import("./pages/circularity/CircularityPage.js").then((e) => ({ default: e.CircularityPage }))), E = a(() => import("./pages/reports/ReportsPage.js").then((e) => ({ default: e.ReportsPage }))), D = a(() => import("./pages/compliance/CompliancePage.js").then((e) => ({ default: e.CompliancePage }))), O = a(() => import("./pages/reports/ReportDetailPage.js").then((e) => ({ default: e.ReportDetailPage }))), k = a(() => import("./pages/metrics/MetricsPage.js").then((e) => ({ default: e.MetricsPage }))), A = a(() => import("./pages/grants/GrantsPage.js").then((e) => ({ default: e.GrantsPage }))), j = a(() => import("./pages/grants/GrantDetailPage.js").then((e) => ({ default: e.GrantDetailPage }))), M = a(() => import("./pages/grants/DonorPortalPage.js").then((e) => ({ default: e.DonorPortalPage }))), N = a(() => import("./pages/credits/CreditsPage.js").then((e) => ({ default: e.CreditsPage }))), P = a(() => import("./pages/mobile/MobileDashboardPage.js").then((e) => ({ default: e.MobileDashboardPage }))), F = a(() => import("./pages/mobile/MobileRecordObservationPage.js").then((e) => ({ default: e.MobileRecordObservationPage }))), I = () => (n(), null), L = "ecoimpacthub.field.nativeHomeShown";
|
|
11
|
+
function R() {
|
|
12
12
|
if (!globalThis.Capacitor?.isNativePlatform?.()) return !1;
|
|
13
13
|
try {
|
|
14
|
-
if (sessionStorage.getItem(
|
|
15
|
-
sessionStorage.setItem(
|
|
14
|
+
if (sessionStorage.getItem(L)) return !1;
|
|
15
|
+
sessionStorage.setItem(L, "1");
|
|
16
16
|
} catch {}
|
|
17
17
|
return !0;
|
|
18
18
|
}
|
|
19
|
-
var
|
|
20
|
-
let [e] = o(
|
|
19
|
+
var z = () => {
|
|
20
|
+
let [e] = o(R);
|
|
21
21
|
return e ? /* @__PURE__ */ d(s, {
|
|
22
22
|
to: "mobile",
|
|
23
23
|
replace: !0
|
|
24
24
|
}) : /* @__PURE__ */ d(r, {});
|
|
25
|
-
},
|
|
25
|
+
}, B = () => /* @__PURE__ */ d("div", {
|
|
26
26
|
className: "flex min-h-[400px] items-center justify-center",
|
|
27
27
|
children: /* @__PURE__ */ d(p, { size: "lg" })
|
|
28
28
|
});
|
|
29
|
-
function
|
|
29
|
+
function V(e, n) {
|
|
30
30
|
return /* @__PURE__ */ d(t, {
|
|
31
31
|
flag: e,
|
|
32
32
|
children: n
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
var
|
|
35
|
+
var H = () => {
|
|
36
36
|
let { basePath: t, isStandalone: n } = e(), r = u(), a = t === "/" ? "" : (t ?? "").replace(/\/$/, "");
|
|
37
37
|
return a && !n && !(r.pathname === a || r.pathname.startsWith(a + "/")) ? null : /* @__PURE__ */ f("div", {
|
|
38
38
|
className: "flex min-h-full flex-col",
|
|
39
|
-
children: [/* @__PURE__ */ d(
|
|
40
|
-
fallback: /* @__PURE__ */ d(
|
|
39
|
+
children: [/* @__PURE__ */ d(I, {}), /* @__PURE__ */ d(i, {
|
|
40
|
+
fallback: /* @__PURE__ */ d(B, {}),
|
|
41
41
|
children: /* @__PURE__ */ f(l, { children: [
|
|
42
42
|
/* @__PURE__ */ d(c, {
|
|
43
43
|
index: !0,
|
|
44
|
-
element:
|
|
44
|
+
element: V("ecoimpacthub.page.dashboard", /* @__PURE__ */ d(z, {}))
|
|
45
45
|
}),
|
|
46
46
|
/* @__PURE__ */ d(c, {
|
|
47
47
|
path: "sites",
|
|
48
|
-
element:
|
|
48
|
+
element: V("ecoimpacthub.page.sites", /* @__PURE__ */ d(m, {}))
|
|
49
49
|
}),
|
|
50
50
|
/* @__PURE__ */ d(c, {
|
|
51
51
|
path: "sites/:id",
|
|
52
|
-
element:
|
|
52
|
+
element: V("ecoimpacthub.page.sites", /* @__PURE__ */ d(h, {}))
|
|
53
53
|
}),
|
|
54
54
|
/* @__PURE__ */ d(c, {
|
|
55
55
|
path: "monitoring",
|
|
56
|
-
element:
|
|
56
|
+
element: V("ecoimpacthub.page.monitoring", /* @__PURE__ */ d(g, {}))
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ d(c, {
|
|
59
|
+
path: "ehs",
|
|
60
|
+
element: V("ecoimpacthub.page.ehs", /* @__PURE__ */ d(_, {}))
|
|
57
61
|
}),
|
|
58
62
|
/* @__PURE__ */ d(c, {
|
|
59
63
|
path: "species",
|
|
60
|
-
element:
|
|
64
|
+
element: V("ecoimpacthub.page.species", /* @__PURE__ */ d(v, {}))
|
|
61
65
|
}),
|
|
62
66
|
/* @__PURE__ */ d(c, {
|
|
63
67
|
path: "species/:id",
|
|
64
|
-
element:
|
|
68
|
+
element: V("ecoimpacthub.page.species", /* @__PURE__ */ d(y, {}))
|
|
65
69
|
}),
|
|
66
70
|
/* @__PURE__ */ d(c, {
|
|
67
71
|
path: "observations",
|
|
68
|
-
element:
|
|
72
|
+
element: V("ecoimpacthub.page.observations", /* @__PURE__ */ d(b, {}))
|
|
69
73
|
}),
|
|
70
74
|
/* @__PURE__ */ d(c, {
|
|
71
75
|
path: "habitat",
|
|
72
|
-
element:
|
|
76
|
+
element: V("ecoimpacthub.page.habitat", /* @__PURE__ */ d(x, {}))
|
|
73
77
|
}),
|
|
74
78
|
/* @__PURE__ */ d(c, {
|
|
75
79
|
path: "habitat/:id",
|
|
76
|
-
element:
|
|
80
|
+
element: V("ecoimpacthub.page.habitat", /* @__PURE__ */ d(S, {}))
|
|
77
81
|
}),
|
|
78
82
|
/* @__PURE__ */ d(c, {
|
|
79
83
|
path: "carbon",
|
|
80
|
-
element:
|
|
84
|
+
element: V("ecoimpacthub.page.carbon", /* @__PURE__ */ d(C, {}))
|
|
81
85
|
}),
|
|
82
86
|
/* @__PURE__ */ d(c, {
|
|
83
87
|
path: "credits",
|
|
84
|
-
element:
|
|
88
|
+
element: V("ecoimpacthub.page.credits", /* @__PURE__ */ d(N, {}))
|
|
85
89
|
}),
|
|
86
90
|
/* @__PURE__ */ d(c, {
|
|
87
91
|
path: "circularity",
|
|
88
|
-
element:
|
|
92
|
+
element: V("ecoimpacthub.page.circularity", /* @__PURE__ */ d(T, {}))
|
|
89
93
|
}),
|
|
90
94
|
/* @__PURE__ */ d(c, {
|
|
91
95
|
path: "metrics",
|
|
92
|
-
element:
|
|
96
|
+
element: V("ecoimpacthub.page.metrics", /* @__PURE__ */ d(k, {}))
|
|
93
97
|
}),
|
|
94
98
|
/* @__PURE__ */ d(c, {
|
|
95
99
|
path: "energy",
|
|
96
|
-
element:
|
|
100
|
+
element: V("ecoimpacthub.page.energy", /* @__PURE__ */ d(w, {}))
|
|
97
101
|
}),
|
|
98
102
|
/* @__PURE__ */ d(c, {
|
|
99
103
|
path: "reports",
|
|
100
|
-
element:
|
|
104
|
+
element: V("ecoimpacthub.page.reports", /* @__PURE__ */ d(E, {}))
|
|
101
105
|
}),
|
|
102
106
|
/* @__PURE__ */ d(c, {
|
|
103
107
|
path: "compliance",
|
|
104
|
-
element:
|
|
108
|
+
element: V("ecoimpacthub.page.compliance", /* @__PURE__ */ d(D, {}))
|
|
105
109
|
}),
|
|
106
110
|
/* @__PURE__ */ d(c, {
|
|
107
111
|
path: "reports/:id",
|
|
108
|
-
element:
|
|
112
|
+
element: V("ecoimpacthub.page.reports", /* @__PURE__ */ d(O, {}))
|
|
109
113
|
}),
|
|
110
114
|
/* @__PURE__ */ d(c, {
|
|
111
115
|
path: "grants/portal",
|
|
112
|
-
element: /* @__PURE__ */ d(
|
|
116
|
+
element: /* @__PURE__ */ d(M, {})
|
|
113
117
|
}),
|
|
114
118
|
/* @__PURE__ */ d(c, {
|
|
115
119
|
path: "grants",
|
|
116
|
-
element:
|
|
120
|
+
element: V("ecoimpacthub.page.grants", /* @__PURE__ */ d(A, {}))
|
|
117
121
|
}),
|
|
118
122
|
/* @__PURE__ */ d(c, {
|
|
119
123
|
path: "grants/:id",
|
|
120
|
-
element:
|
|
124
|
+
element: V("ecoimpacthub.page.grants", /* @__PURE__ */ d(j, {}))
|
|
121
125
|
}),
|
|
122
126
|
/* @__PURE__ */ d(c, {
|
|
123
127
|
path: "mobile",
|
|
124
|
-
element:
|
|
128
|
+
element: V("ecoimpacthub.page.mobile", /* @__PURE__ */ d(P, {}))
|
|
125
129
|
}),
|
|
126
130
|
/* @__PURE__ */ d(c, {
|
|
127
131
|
path: "mobile/record-observation",
|
|
128
|
-
element:
|
|
132
|
+
element: V("ecoimpacthub.page.observations", /* @__PURE__ */ d(F, {}))
|
|
129
133
|
}),
|
|
130
134
|
/* @__PURE__ */ d(c, {
|
|
131
135
|
path: "*",
|
|
@@ -138,6 +142,6 @@ var V = () => {
|
|
|
138
142
|
})]
|
|
139
143
|
});
|
|
140
144
|
};
|
|
141
|
-
export {
|
|
145
|
+
export { H as EcoImpactHubRoutes };
|
|
142
146
|
|
|
143
147
|
//# sourceMappingURL=EcoImpactHubRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EcoImpactHubRoutes.js","names":["SitesPage","lazy","m","SiteDetailPage","MonitoringPage","SpeciesPage","SpeciesDetailPage","ObservationsPage","HabitatProjectsPage","HabitatProjectDetailPage","CarbonPage","EnergyPage","CircularityPage","ReportsPage","CompliancePage","ReportDetailPage","MetricsPage","GrantsPage","GrantDetailPage","DonorPortalPage","CreditsPage","MobileDashboardPage","MobileRecordObservationPage","FieldSyncBridge","useFieldSyncBridge","NATIVE_HOME_KEY","shouldOpenNativeHome","DashboardIndex","openNativeHome","useState","Navigate","DashboardPage","PageLoader","Spinner","gated","FeatureFlagGate","element","EcoImpactHubRoutes","useEcoImpactHub","location","useLocation","normalizedBasePath","basePath","isStandalone","Suspense","Routes","Route"],"sources":["../../src/ecoimpacthub/EcoImpactHubRoutes.tsx"],"sourcesContent":["/**\n * EcoImpactHub Routes\n * @module ecoimpacthub\n *\n * Domain routes. The dashboard is eager-loaded (primary landing); all other\n * pages are lazy-loaded. Every route maps to a real `eco*` backend capability.\n */\n\nimport { type FC, lazy, Suspense, type ReactNode, useState } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useEcoImpactHub } from './context/EcoImpactHubContext';\nimport { FeatureFlagGate } from './components/FeatureFlagGate';\nimport { useFieldSyncBridge } from './field/useFieldQueue';\n\n// Eager — primary landing\nimport { DashboardPage } from './pages/DashboardPage';\n\n// Sites (Environmental Monitoring)\nconst SitesPage = lazy(() =>\n import('./pages/sites/SitesPage').then((m) => ({ default: m.SitesPage }))\n);\nconst SiteDetailPage = lazy(() =>\n import('./pages/sites/SiteDetailPage').then((m) => ({ default: m.SiteDetailPage }))\n);\n\n// Monitoring (sensors / measurements / thresholds)\nconst MonitoringPage = lazy(() =>\n import('./pages/monitoring/MonitoringPage').then((m) => ({ default: m.MonitoringPage }))\n);\n\n// Species (Conservation)\nconst SpeciesPage = lazy(() =>\n import('./pages/species/SpeciesPage').then((m) => ({ default: m.SpeciesPage }))\n);\nconst SpeciesDetailPage = lazy(() =>\n import('./pages/species/SpeciesDetailPage').then((m) => ({ default: m.SpeciesDetailPage }))\n);\n\n// Observations (citizen science / field data)\nconst ObservationsPage = lazy(() =>\n import('./pages/observations/ObservationsPage').then((m) => ({ default: m.ObservationsPage }))\n);\n\n// Habitat projects & restoration\nconst HabitatProjectsPage = lazy(() =>\n import('./pages/habitat/HabitatProjectsPage').then((m) => ({ default: m.HabitatProjectsPage }))\n);\nconst HabitatProjectDetailPage = lazy(() =>\n import('./pages/habitat/HabitatProjectDetailPage').then((m) => ({\n default: m.HabitatProjectDetailPage,\n }))\n);\n\n// Carbon ledger / emission factors / reduction targets (Sustainability)\nconst CarbonPage = lazy(() =>\n import('./pages/carbon/CarbonPage').then((m) => ({ default: m.CarbonPage }))\n);\n\n// Renewable energy tracking — generation assets, meter readings, energy mix (BOFF-5829)\nconst EnergyPage = lazy(() =>\n import('./pages/energy/EnergyPage').then((m) => ({ default: m.EnergyPage }))\n);\n\n// ESG Reports\n// Waste & circularity — waste streams, diversion tracking, material loops (BOFF-5830)\nconst CircularityPage = lazy(() =>\n import('./pages/circularity/CircularityPage').then((m) => ({ default: m.CircularityPage }))\n);\n\nconst ReportsPage = lazy(() =>\n import('./pages/reports/ReportsPage').then((m) => ({ default: m.ReportsPage }))\n);\n\n// Compliance — obligations register, permits, deadline calendar (BOFF-5827)\nconst CompliancePage = lazy(() =>\n import('./pages/compliance/CompliancePage').then((m) => ({ default: m.CompliancePage }))\n);\nconst ReportDetailPage = lazy(() =>\n import('./pages/reports/ReportDetailPage').then((m) => ({ default: m.ReportDetailPage }))\n);\n\n// Environmental metrics library (cross-product rollups)\nconst MetricsPage = lazy(() =>\n import('./pages/metrics/MetricsPage').then((m) => ({ default: m.MetricsPage }))\n);\n\n// Grants & donor portal (BOFF-5828)\nconst GrantsPage = lazy(() =>\n import('./pages/grants/GrantsPage').then((m) => ({ default: m.GrantsPage }))\n);\nconst GrantDetailPage = lazy(() =>\n import('./pages/grants/GrantDetailPage').then((m) => ({ default: m.GrantDetailPage }))\n);\nconst DonorPortalPage = lazy(() =>\n import('./pages/grants/DonorPortalPage').then((m) => ({ default: m.DonorPortalPage }))\n);\n\n// Carbon credit registry (BOFF-5824): portfolio, vintages, methodologies, retirement ledger\nconst CreditsPage = lazy(() =>\n import('./pages/credits/CreditsPage').then((m) => ({ default: m.CreditsPage }))\n);\n\n// Mobile field app (Capacitor iOS/Android home + offline field capture)\nconst MobileDashboardPage = lazy(() =>\n import('./pages/mobile/MobileDashboardPage').then((m) => ({ default: m.MobileDashboardPage }))\n);\nconst MobileRecordObservationPage = lazy(() =>\n import('./pages/mobile/MobileRecordObservationPage').then((m) => ({\n default: m.MobileRecordObservationPage,\n }))\n);\n\n/**\n * Drains the offline field-observation queue for the active workspace while\n * the MFE is mounted, whichever page is showing (see `field/fieldSync.ts`).\n */\nconst FieldSyncBridge: FC = () => {\n useFieldSyncBridge();\n return null;\n};\n\nconst NATIVE_HOME_KEY = 'ecoimpacthub.field.nativeHomeShown';\n\n/**\n * Inside the installed iOS/Android app the first screen of each launch is the\n * field app's mobile dashboard; after that the regular dashboard stays one tap\n * away (sidebar \"Dashboard\"). Capacitor injects `window.Capacitor`, so the MFE\n * needs no Capacitor dependency to detect it.\n */\nfunction shouldOpenNativeHome(): boolean {\n const cap = (globalThis as { Capacitor?: { isNativePlatform?: () => boolean } }).Capacitor;\n if (!cap?.isNativePlatform?.()) return false;\n try {\n if (sessionStorage.getItem(NATIVE_HOME_KEY)) return false;\n sessionStorage.setItem(NATIVE_HOME_KEY, '1');\n } catch {\n // Storage unavailable: still open the field home this time.\n }\n return true;\n}\n\nconst DashboardIndex: FC = () => {\n const [openNativeHome] = useState(shouldOpenNativeHome);\n if (openNativeHome) return <Navigate to=\"mobile\" replace />;\n return <DashboardPage />;\n};\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <Spinner size=\"lg\" />\n </div>\n);\n\nfunction gated(flag: string, element: ReactNode): ReactNode {\n return <FeatureFlagGate flag={flag}>{element}</FeatureFlagGate>;\n}\n\nexport const EcoImpactHubRoutes: FC = () => {\n const { basePath, isStandalone } = useEcoImpactHub();\n const location = useLocation();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the current path matches basePath (integrated mode).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <FieldSyncBridge />\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={gated('ecoimpacthub.page.dashboard', <DashboardIndex />)} />\n\n <Route path=\"sites\" element={gated('ecoimpacthub.page.sites', <SitesPage />)} />\n <Route path=\"sites/:id\" element={gated('ecoimpacthub.page.sites', <SiteDetailPage />)} />\n\n <Route\n path=\"monitoring\"\n element={gated('ecoimpacthub.page.monitoring', <MonitoringPage />)}\n />\n\n <Route path=\"species\" element={gated('ecoimpacthub.page.species', <SpeciesPage />)} />\n <Route\n path=\"species/:id\"\n element={gated('ecoimpacthub.page.species', <SpeciesDetailPage />)}\n />\n\n <Route\n path=\"observations\"\n element={gated('ecoimpacthub.page.observations', <ObservationsPage />)}\n />\n\n <Route\n path=\"habitat\"\n element={gated('ecoimpacthub.page.habitat', <HabitatProjectsPage />)}\n />\n <Route\n path=\"habitat/:id\"\n element={gated('ecoimpacthub.page.habitat', <HabitatProjectDetailPage />)}\n />\n\n <Route path=\"carbon\" element={gated('ecoimpacthub.page.carbon', <CarbonPage />)} />\n\n <Route path=\"credits\" element={gated('ecoimpacthub.page.credits', <CreditsPage />)} />\n\n <Route\n path=\"circularity\"\n element={gated('ecoimpacthub.page.circularity', <CircularityPage />)}\n />\n\n <Route path=\"metrics\" element={gated('ecoimpacthub.page.metrics', <MetricsPage />)} />\n\n <Route path=\"energy\" element={gated('ecoimpacthub.page.energy', <EnergyPage />)} />\n\n <Route path=\"reports\" element={gated('ecoimpacthub.page.reports', <ReportsPage />)} />\n <Route\n path=\"compliance\"\n element={gated('ecoimpacthub.page.compliance', <CompliancePage />)}\n />\n <Route\n path=\"reports/:id\"\n element={gated('ecoimpacthub.page.reports', <ReportDetailPage />)}\n />\n\n {/* Donor portal is a public, session-free view — not feature-flag gated,\n the link secret is the authorization (BOFF-5828). */}\n <Route path=\"grants/portal\" element={<DonorPortalPage />} />\n\n <Route path=\"grants\" element={gated('ecoimpacthub.page.grants', <GrantsPage />)} />\n <Route\n path=\"grants/:id\"\n element={gated('ecoimpacthub.page.grants', <GrantDetailPage />)}\n />\n\n <Route\n path=\"mobile\"\n element={gated('ecoimpacthub.page.mobile', <MobileDashboardPage />)}\n />\n <Route\n path=\"mobile/record-observation\"\n element={gated('ecoimpacthub.page.observations', <MobileRecordObservationPage />)}\n />\n\n <Route path=\"*\" element={<Navigate to=\"\" replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAmBA,IAAMA,IAAYC,QAChB,OAAO,6BAA0B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,UAAU,EAAE,CAC1E,GACMC,IAAiBF,QACrB,OAAO,kCAA+B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,eAAe,EAAE,CACpF,GAGME,IAAiBH,QACrB,OAAO,uCAAoC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,eAAe,EAAE,CACzF,GAGMG,IAAcJ,QAClB,OAAO,iCAA8B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,YAAY,EAAE,CAChF,GACMI,IAAoBL,QACxB,OAAO,uCAAoC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,kBAAkB,EAAE,CAC5F,GAGMK,IAAmBN,QACvB,OAAO,2CAAwC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,iBAAiB,EAAE,CAC/F,GAGMM,IAAsBP,QAC1B,OAAO,yCAAsC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,oBAAoB,EAAE,CAChG,GACMO,IAA2BR,QAC/B,OAAO,8CAA2C,CAAC,MAAM,OAAO,EAC9D,SAASC,EAAE,yBACb,EAAE,CACJ,GAGMQ,IAAaT,QACjB,OAAO,+BAA4B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,WAAW,EAAE,CAC7E,GAGMS,IAAaV,QACjB,OAAO,+BAA4B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,WA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pB,GAAD,CAAiB,CAAA,CAAC;IAClE,CAAA;IACD,kBAACgC,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,6BAA6B,kBAACnB,GAAD,CAAmB,CAAA,CAAC;IACjE,CAAA;IAID,kBAAC+B,GAAD;KAAO,MAAK;KAAgB,SAAS,kBAAC3B,GAAD,CAAkB,CAAA;IAAI,CAAA;IAE3D,kBAAC2B,GAAD;KAAO,MAAK;KAAS,SAASZ,EAAM,4BAA4B,kBAACjB,GAAD,CAAa,CAAA,CAAC;IAAI,CAAA;IAClF,kBAAC6B,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,4BAA4B,kBAAChB,GAAD,CAAkB,CAAA,CAAC;IAC/D,CAAA;IAED,kBAAC4B,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,4BAA4B,kBAACb,GAAD,CAAsB,CAAA,CAAC;IACnE,CAAA;IACD,kBAACyB,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,kCAAkC,kBAACZ,GAAD,CAA8B,CAAA,CAAC;IACjF,CAAA;IAED,kBAACwB,GAAD;KAAO,MAAK;KAAI,SAAS,kBAAChB,GAAD;MAAU,IAAG;MAAG,SAAA;KAAS,CAAA;IAAI,CAAA;GAChD,EAAA,CAAA;EACA,CAAA,CACP;;AAET"}
|
|
1
|
+
{"version":3,"file":"EcoImpactHubRoutes.js","names":["SitesPage","lazy","m","SiteDetailPage","MonitoringPage","EhsPage","SpeciesPage","SpeciesDetailPage","ObservationsPage","HabitatProjectsPage","HabitatProjectDetailPage","CarbonPage","EnergyPage","CircularityPage","ReportsPage","CompliancePage","ReportDetailPage","MetricsPage","GrantsPage","GrantDetailPage","DonorPortalPage","CreditsPage","MobileDashboardPage","MobileRecordObservationPage","FieldSyncBridge","useFieldSyncBridge","NATIVE_HOME_KEY","shouldOpenNativeHome","DashboardIndex","openNativeHome","useState","Navigate","DashboardPage","PageLoader","Spinner","gated","FeatureFlagGate","element","EcoImpactHubRoutes","useEcoImpactHub","location","useLocation","normalizedBasePath","basePath","isStandalone","Suspense","Routes","Route"],"sources":["../../src/ecoimpacthub/EcoImpactHubRoutes.tsx"],"sourcesContent":["/**\n * EcoImpactHub Routes\n * @module ecoimpacthub\n *\n * Domain routes. The dashboard is eager-loaded (primary landing); all other\n * pages are lazy-loaded. Every route maps to a real `eco*` backend capability.\n */\n\nimport { type FC, lazy, Suspense, type ReactNode, useState } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useEcoImpactHub } from './context/EcoImpactHubContext';\nimport { FeatureFlagGate } from './components/FeatureFlagGate';\nimport { useFieldSyncBridge } from './field/useFieldQueue';\n\n// Eager — primary landing\nimport { DashboardPage } from './pages/DashboardPage';\n\n// Sites (Environmental Monitoring)\nconst SitesPage = lazy(() =>\n import('./pages/sites/SitesPage').then((m) => ({ default: m.SitesPage }))\n);\nconst SiteDetailPage = lazy(() =>\n import('./pages/sites/SiteDetailPage').then((m) => ({ default: m.SiteDetailPage }))\n);\n\n// Monitoring (sensors / measurements / thresholds)\nconst MonitoringPage = lazy(() =>\n import('./pages/monitoring/MonitoringPage').then((m) => ({ default: m.MonitoringPage }))\n);\n\n// EHS compliance & risk (risk register / incidents / audits / actions / permits)\nconst EhsPage = lazy(() => import('./pages/ehs/EhsPage').then((m) => ({ default: m.EhsPage })));\n\n// Species (Conservation)\nconst SpeciesPage = lazy(() =>\n import('./pages/species/SpeciesPage').then((m) => ({ default: m.SpeciesPage }))\n);\nconst SpeciesDetailPage = lazy(() =>\n import('./pages/species/SpeciesDetailPage').then((m) => ({ default: m.SpeciesDetailPage }))\n);\n\n// Observations (citizen science / field data)\nconst ObservationsPage = lazy(() =>\n import('./pages/observations/ObservationsPage').then((m) => ({ default: m.ObservationsPage }))\n);\n\n// Habitat projects & restoration\nconst HabitatProjectsPage = lazy(() =>\n import('./pages/habitat/HabitatProjectsPage').then((m) => ({ default: m.HabitatProjectsPage }))\n);\nconst HabitatProjectDetailPage = lazy(() =>\n import('./pages/habitat/HabitatProjectDetailPage').then((m) => ({\n default: m.HabitatProjectDetailPage,\n }))\n);\n\n// Carbon ledger / emission factors / reduction targets (Sustainability)\nconst CarbonPage = lazy(() =>\n import('./pages/carbon/CarbonPage').then((m) => ({ default: m.CarbonPage }))\n);\n\n// Renewable energy tracking — generation assets, meter readings, energy mix (BOFF-5829)\nconst EnergyPage = lazy(() =>\n import('./pages/energy/EnergyPage').then((m) => ({ default: m.EnergyPage }))\n);\n\n// ESG Reports\n// Waste & circularity — waste streams, diversion tracking, material loops (BOFF-5830)\nconst CircularityPage = lazy(() =>\n import('./pages/circularity/CircularityPage').then((m) => ({ default: m.CircularityPage }))\n);\n\nconst ReportsPage = lazy(() =>\n import('./pages/reports/ReportsPage').then((m) => ({ default: m.ReportsPage }))\n);\n\n// Compliance — obligations register, permits, deadline calendar (BOFF-5827)\nconst CompliancePage = lazy(() =>\n import('./pages/compliance/CompliancePage').then((m) => ({ default: m.CompliancePage }))\n);\nconst ReportDetailPage = lazy(() =>\n import('./pages/reports/ReportDetailPage').then((m) => ({ default: m.ReportDetailPage }))\n);\n\n// Environmental metrics library (cross-product rollups)\nconst MetricsPage = lazy(() =>\n import('./pages/metrics/MetricsPage').then((m) => ({ default: m.MetricsPage }))\n);\n\n// Grants & donor portal (BOFF-5828)\nconst GrantsPage = lazy(() =>\n import('./pages/grants/GrantsPage').then((m) => ({ default: m.GrantsPage }))\n);\nconst GrantDetailPage = lazy(() =>\n import('./pages/grants/GrantDetailPage').then((m) => ({ default: m.GrantDetailPage }))\n);\nconst DonorPortalPage = lazy(() =>\n import('./pages/grants/DonorPortalPage').then((m) => ({ default: m.DonorPortalPage }))\n);\n\n// Carbon credit registry (BOFF-5824): portfolio, vintages, methodologies, retirement ledger\nconst CreditsPage = lazy(() =>\n import('./pages/credits/CreditsPage').then((m) => ({ default: m.CreditsPage }))\n);\n\n// Mobile field app (Capacitor iOS/Android home + offline field capture)\nconst MobileDashboardPage = lazy(() =>\n import('./pages/mobile/MobileDashboardPage').then((m) => ({ default: m.MobileDashboardPage }))\n);\nconst MobileRecordObservationPage = lazy(() =>\n import('./pages/mobile/MobileRecordObservationPage').then((m) => ({\n default: m.MobileRecordObservationPage,\n }))\n);\n\n/**\n * Drains the offline field-observation queue for the active workspace while\n * the MFE is mounted, whichever page is showing (see `field/fieldSync.ts`).\n */\nconst FieldSyncBridge: FC = () => {\n useFieldSyncBridge();\n return null;\n};\n\nconst NATIVE_HOME_KEY = 'ecoimpacthub.field.nativeHomeShown';\n\n/**\n * Inside the installed iOS/Android app the first screen of each launch is the\n * field app's mobile dashboard; after that the regular dashboard stays one tap\n * away (sidebar \"Dashboard\"). Capacitor injects `window.Capacitor`, so the MFE\n * needs no Capacitor dependency to detect it.\n */\nfunction shouldOpenNativeHome(): boolean {\n const cap = (globalThis as { Capacitor?: { isNativePlatform?: () => boolean } }).Capacitor;\n if (!cap?.isNativePlatform?.()) return false;\n try {\n if (sessionStorage.getItem(NATIVE_HOME_KEY)) return false;\n sessionStorage.setItem(NATIVE_HOME_KEY, '1');\n } catch {\n // Storage unavailable: still open the field home this time.\n }\n return true;\n}\n\nconst DashboardIndex: FC = () => {\n const [openNativeHome] = useState(shouldOpenNativeHome);\n if (openNativeHome) return <Navigate to=\"mobile\" replace />;\n return <DashboardPage />;\n};\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <Spinner size=\"lg\" />\n </div>\n);\n\nfunction gated(flag: string, element: ReactNode): ReactNode {\n return <FeatureFlagGate flag={flag}>{element}</FeatureFlagGate>;\n}\n\nexport const EcoImpactHubRoutes: FC = () => {\n const { basePath, isStandalone } = useEcoImpactHub();\n const location = useLocation();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the current path matches basePath (integrated mode).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <FieldSyncBridge />\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={gated('ecoimpacthub.page.dashboard', <DashboardIndex />)} />\n\n <Route path=\"sites\" element={gated('ecoimpacthub.page.sites', <SitesPage />)} />\n <Route path=\"sites/:id\" element={gated('ecoimpacthub.page.sites', <SiteDetailPage />)} />\n\n <Route\n path=\"monitoring\"\n element={gated('ecoimpacthub.page.monitoring', <MonitoringPage />)}\n />\n\n <Route path=\"ehs\" element={gated('ecoimpacthub.page.ehs', <EhsPage />)} />\n\n <Route path=\"species\" element={gated('ecoimpacthub.page.species', <SpeciesPage />)} />\n <Route\n path=\"species/:id\"\n element={gated('ecoimpacthub.page.species', <SpeciesDetailPage />)}\n />\n\n <Route\n path=\"observations\"\n element={gated('ecoimpacthub.page.observations', <ObservationsPage />)}\n />\n\n <Route\n path=\"habitat\"\n element={gated('ecoimpacthub.page.habitat', <HabitatProjectsPage />)}\n />\n <Route\n path=\"habitat/:id\"\n element={gated('ecoimpacthub.page.habitat', <HabitatProjectDetailPage />)}\n />\n\n <Route path=\"carbon\" element={gated('ecoimpacthub.page.carbon', <CarbonPage />)} />\n\n <Route path=\"credits\" element={gated('ecoimpacthub.page.credits', <CreditsPage />)} />\n\n <Route\n path=\"circularity\"\n element={gated('ecoimpacthub.page.circularity', <CircularityPage />)}\n />\n\n <Route path=\"metrics\" element={gated('ecoimpacthub.page.metrics', <MetricsPage />)} />\n\n <Route path=\"energy\" element={gated('ecoimpacthub.page.energy', <EnergyPage />)} />\n\n <Route path=\"reports\" element={gated('ecoimpacthub.page.reports', <ReportsPage />)} />\n <Route\n path=\"compliance\"\n element={gated('ecoimpacthub.page.compliance', <CompliancePage />)}\n />\n <Route\n path=\"reports/:id\"\n element={gated('ecoimpacthub.page.reports', <ReportDetailPage />)}\n />\n\n {/* Donor portal is a public, session-free view — not feature-flag gated,\n the link secret is the authorization (BOFF-5828). */}\n <Route path=\"grants/portal\" element={<DonorPortalPage />} />\n\n <Route path=\"grants\" element={gated('ecoimpacthub.page.grants', <GrantsPage />)} />\n <Route\n path=\"grants/:id\"\n element={gated('ecoimpacthub.page.grants', <GrantDetailPage />)}\n />\n\n <Route\n path=\"mobile\"\n element={gated('ecoimpacthub.page.mobile', <MobileDashboardPage />)}\n />\n <Route\n path=\"mobile/record-observation\"\n element={gated('ecoimpacthub.page.observations', <MobileRecordObservationPage />)}\n />\n\n <Route path=\"*\" element={<Navigate to=\"\" replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAmBA,IAAMA,IAAYC,QAChB,OAAO,6BAA0B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,UAAU,EAAE,CAC1E,GACMC,IAAiBF,QACrB,OAAO,kCAA+B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,eAAe,EAAE,CACpF,GAGME,IAAiBH,QACrB,OAAO,uCAAoC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,eAAe,EAAE,CACzF,GAGMG,IAAUJ,QAAW,OAAO,yBAAsB,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,QAAQ,EAAE,CAAC,GAGxFI,IAAcL,QAClB,OAAO,iCAA8B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,YAAY,EAAE,CAChF,GACMK,IAAoBN,QACxB,OAAO,uCAAoC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,kBAAkB,EAAE,CAC5F,GAGMM,IAAmBP,QACvB,OAAO,2CAAwC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,iBAAiB,EAAE,CAC/F,GAGMO,IAAsBR,QAC1B,OAAO,yCAAsC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,oBAAoB,EAAE,CAChG,GACMQ,IAA2BT,QAC/B,OAAO,8CAA2C,CAAC,MAAM,OAAO,EAC9D,SAASC,EAAE,yBACb,EAAE,CACJ,GAGMS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BAAC8B,GAAD;KAAO,MAAK;KAAS,SAASZ,EAAM,4BAA4B,kBAACvB,GAAD,CAAa,CAAA,CAAC;IAAI,CAAA;IAElF,kBAACmC,GAAD;KAAO,MAAK;KAAU,SAASZ,EAAM,6BAA6B,kBAACrB,GAAD,CAAc,CAAA,CAAC;IAAI,CAAA;IACrF,kBAACiC,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,gCAAgC,kBAACpB,GAAD,CAAiB,CAAA,CAAC;IAClE,CAAA;IACD,kBAACgC,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,6BAA6B,kBAACnB,GAAD,CAAmB,CAAA,CAAC;IACjE,CAAA;IAID,kBAAC+B,GAAD;KAAO,MAAK;KAAgB,SAAS,kBAAC3B,GAAD,CAAkB,CAAA;IAAI,CAAA;IAE3D,kBAAC2B,GAAD;KAAO,MAAK;KAAS,SAASZ,EAAM,4BAA4B,kBAACjB,GAAD,CAAa,CAAA,CAAC;IAAI,CAAA;IAClF,kBAAC6B,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,4BAA4B,kBAAChB,GAAD,CAAkB,CAAA,CAAC;IAC/D,CAAA;IAED,kBAAC4B,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,4BAA4B,kBAACb,GAAD,CAAsB,CAAA,CAAC;IACnE,CAAA;IACD,kBAACyB,GAAD;KACE,MAAK;KACL,SAASZ,EAAM,kCAAkC,kBAACZ,GAAD,CAA8B,CAAA,CAAC;IACjF,CAAA;IAED,kBAACwB,GAAD;KAAO,MAAK;KAAI,SAAS,kBAAChB,GAAD;MAAU,IAAG;MAAG,SAAA;KAAS,CAAA;IAAI,CAAA;GAChD,EAAA,CAAA;EACA,CAAA,CACP;;AAET"}
|
|
@@ -102,7 +102,20 @@ var i = {
|
|
|
102
102
|
FULLY_ISSUED: "success",
|
|
103
103
|
CLOSED: "outline",
|
|
104
104
|
ISSUED: "success",
|
|
105
|
-
PARTIALLY_RETIRED: "warning"
|
|
105
|
+
PARTIALLY_RETIRED: "warning",
|
|
106
|
+
IDENTIFIED: "secondary",
|
|
107
|
+
ASSESSING: "info",
|
|
108
|
+
MITIGATING: "warning",
|
|
109
|
+
LOW: "success",
|
|
110
|
+
MEDIUM: "info",
|
|
111
|
+
HIGH: "warning",
|
|
112
|
+
EXTREME: "destructive",
|
|
113
|
+
NEAR_MISS: "info",
|
|
114
|
+
REPORTED: "info",
|
|
115
|
+
UNDER_INVESTIGATION: "warning",
|
|
116
|
+
ACTION_REQUIRED: "destructive",
|
|
117
|
+
REVOKED: "destructive",
|
|
118
|
+
RENEWAL_DUE: "warning"
|
|
106
119
|
}, s = ({ status: s, className: c }) => {
|
|
107
120
|
let l = s.toUpperCase(), u = o[l] ?? "secondary", d = a.has(l);
|
|
108
121
|
return /* @__PURE__ */ r("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","names":["variantStyles","liveStatuses","statusVariantMap","StatusBadge","key","status","variant","isLive","cn","className","formatEnumLabel"],"sources":["../../../src/ecoimpacthub/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module ecoimpacthub/components\n *\n * A colored badge for EcoImpactHub domain statuses (site status, sensor status,\n * threshold severity, conservation status, habitat-project lifecycle, carbon\n * entry status, reduction-target status, report status/framework, emission\n * scope) with semantic color mapping. Accepts the raw server enum value.\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\nimport { formatEnumLabel } from '../utils/formatters';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['IN_PROGRESS', 'ONLINE', 'ACTIVE']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Site status\n ACTIVE: 'success',\n MONITORING_PAUSED: 'warning',\n ARCHIVED: 'outline',\n\n // Sensor status\n ONLINE: 'success',\n OFFLINE: 'destructive',\n DEGRADED: 'warning',\n MAINTENANCE: 'info',\n RETIRED: 'outline',\n\n // Threshold severity / generic severity\n INFO: 'secondary',\n WARNING: 'warning',\n CRITICAL: 'destructive',\n\n // Threshold direction\n ABOVE: 'warning',\n BELOW: 'info',\n OUTSIDE_RANGE: 'warning',\n\n // Measurement / breach\n BREACH: 'destructive',\n OK: 'success',\n\n // AI alert triage classification + anomaly kinds\n REAL_EVENT: 'destructive',\n SENSOR_FAULT: 'warning',\n INSUFFICIENT_DATA: 'secondary',\n SPIKE: 'warning',\n DROP: 'info',\n FLATLINE: 'secondary',\n\n // Conservation status (IUCN-style)\n LEAST_CONCERN: 'success',\n NEAR_THREATENED: 'info',\n VULNERABLE: 'warning',\n ENDANGERED: 'destructive',\n CRITICALLY_ENDANGERED: 'destructive',\n EXTINCT_IN_WILD: 'outline',\n DATA_DEFICIENT: 'secondary',\n NOT_EVALUATED: 'secondary',\n\n // Habitat-project lifecycle\n PLANNED: 'secondary',\n MONITORING: 'info',\n COMPLETED: 'success',\n ON_HOLD: 'warning',\n CANCELLED: 'destructive',\n\n // Carbon-entry status\n DRAFT: 'secondary',\n RECORDED: 'info',\n VERIFIED: 'success',\n ADJUSTED: 'warning',\n\n // Report status\n IN_REVIEW: 'warning',\n PUBLISHED: 'success',\n\n // Reduction-target status\n PROPOSED: 'secondary',\n ACHIEVED: 'success',\n MISSED: 'destructive',\n\n // Compliance — obligation lifecycle (BOFF-5827).\n // OPEN: 'info' is shared with the carbon-credit vintage lifecycle (BOFF-5824).\n FULFILLED: 'success',\n OVERDUE: 'destructive',\n WAIVED: 'outline',\n\n // Compliance — permit lifecycle\n SUBMITTED: 'info',\n UNDER_REVIEW: 'warning',\n APPROVED: 'success',\n REJECTED: 'destructive',\n SUSPENDED: 'warning',\n EXPIRED: 'outline',\n\n // Emission scope\n SCOPE_1: 'destructive',\n SCOPE_2: 'warning',\n SCOPE_3: 'info',\n\n // Waste categories (BOFF-5830) — informational, neutral badges\n GENERAL: 'secondary',\n RECYCLABLES: 'info',\n ORGANIC: 'success',\n HAZARDOUS: 'destructive',\n ELECTRONIC: 'info',\n CONSTRUCTION_DEMOLITION: 'warning',\n TEXTILES: 'info',\n PACKAGING: 'info',\n\n // Waste disposal routes (BOFF-5830): diverted routes read green/blue,\n // landfill reads red, OTHER stays neutral.\n LANDFILL: 'destructive',\n RECYCLED: 'success',\n COMPOSTED: 'success',\n RECOVERED: 'info',\n REUSED: 'success',\n OTHER: 'secondary',\n\n // Material-loop stages (BOFF-5830)\n INPUT: 'info',\n USE: 'secondary',\n RECOVERY: 'warning',\n REUSE: 'success',\n\n // Report frameworks (neutral badges)\n GHG_PROTOCOL: 'outline',\n GRI: 'outline',\n TCFD: 'outline',\n CDP: 'outline',\n SASB: 'outline',\n CSRD: 'outline',\n ISSB: 'outline',\n EU_TAXONOMY: 'outline',\n CUSTOM: 'secondary',\n\n // Carbon credit registry (BOFF-5824): vintage + credit lifecycle\n OPEN: 'info',\n PARTIALLY_ISSUED: 'warning',\n FULLY_ISSUED: 'success',\n CLOSED: 'outline',\n ISSUED: 'success',\n PARTIALLY_RETIRED: 'warning',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;AAqBA,IAAMA,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;AACX,GAIMC,oBAAe,IAAI,IAAI;CAAC;CAAe;CAAU;AAAQ,CAAC,GAE1DC,IAAiD;CAErD,QAAQ;CACR,mBAAmB;CACnB,UAAU;CAGV,QAAQ;CACR,SAAS;CACT,UAAU;CACV,aAAa;CACb,SAAS;CAGT,MAAM;CACN,SAAS;CACT,UAAU;CAGV,OAAO;CACP,OAAO;CACP,eAAe;CAGf,QAAQ;CACR,IAAI;CAGJ,YAAY;CACZ,cAAc;CACd,mBAAmB;CACnB,OAAO;CACP,MAAM;CACN,UAAU;CAGV,eAAe;CACf,iBAAiB;CACjB,YAAY;CACZ,YAAY;CACZ,uBAAuB;CACvB,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;CAGf,SAAS;CACT,YAAY;CACZ,WAAW;CACX,SAAS;CACT,WAAW;CAGX,OAAO;CACP,UAAU;CACV,UAAU;CACV,UAAU;CAGV,WAAW;CACX,WAAW;CAGX,UAAU;CACV,UAAU;CACV,QAAQ;CAIR,WAAW;CACX,SAAS;CACT,QAAQ;CAGR,WAAW;CACX,cAAc;CACd,UAAU;CACV,UAAU;CACV,WAAW;CACX,SAAS;CAGT,SAAS;CACT,SAAS;CACT,SAAS;CAGT,SAAS;CACT,aAAa;CACb,SAAS;CACT,WAAW;CACX,YAAY;CACZ,yBAAyB;CACzB,UAAU;CACV,WAAW;CAIX,UAAU;CACV,UAAU;CACV,WAAW;CACX,WAAW;CACX,QAAQ;CACR,OAAO;CAGP,OAAO;CACP,KAAK;CACL,UAAU;CACV,OAAO;CAGP,cAAc;CACd,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,MAAM;CACN,MAAM;CACN,aAAa;CACb,QAAQ;CAGR,MAAM;CACN,kBAAkB;CAClB,cAAc;CACd,QAAQ;CACR,QAAQ;CACR,mBAAmB;
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","names":["variantStyles","liveStatuses","statusVariantMap","StatusBadge","key","status","variant","isLive","cn","className","formatEnumLabel"],"sources":["../../../src/ecoimpacthub/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module ecoimpacthub/components\n *\n * A colored badge for EcoImpactHub domain statuses (site status, sensor status,\n * threshold severity, conservation status, habitat-project lifecycle, carbon\n * entry status, reduction-target status, report status/framework, emission\n * scope) with semantic color mapping. Accepts the raw server enum value.\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\nimport { formatEnumLabel } from '../utils/formatters';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['IN_PROGRESS', 'ONLINE', 'ACTIVE']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Site status\n ACTIVE: 'success',\n MONITORING_PAUSED: 'warning',\n ARCHIVED: 'outline',\n\n // Sensor status\n ONLINE: 'success',\n OFFLINE: 'destructive',\n DEGRADED: 'warning',\n MAINTENANCE: 'info',\n RETIRED: 'outline',\n\n // Threshold severity / generic severity\n INFO: 'secondary',\n WARNING: 'warning',\n CRITICAL: 'destructive',\n\n // Threshold direction\n ABOVE: 'warning',\n BELOW: 'info',\n OUTSIDE_RANGE: 'warning',\n\n // Measurement / breach\n BREACH: 'destructive',\n OK: 'success',\n\n // AI alert triage classification + anomaly kinds\n REAL_EVENT: 'destructive',\n SENSOR_FAULT: 'warning',\n INSUFFICIENT_DATA: 'secondary',\n SPIKE: 'warning',\n DROP: 'info',\n FLATLINE: 'secondary',\n\n // Conservation status (IUCN-style)\n LEAST_CONCERN: 'success',\n NEAR_THREATENED: 'info',\n VULNERABLE: 'warning',\n ENDANGERED: 'destructive',\n CRITICALLY_ENDANGERED: 'destructive',\n EXTINCT_IN_WILD: 'outline',\n DATA_DEFICIENT: 'secondary',\n NOT_EVALUATED: 'secondary',\n\n // Habitat-project lifecycle\n PLANNED: 'secondary',\n MONITORING: 'info',\n COMPLETED: 'success',\n ON_HOLD: 'warning',\n CANCELLED: 'destructive',\n\n // Carbon-entry status\n DRAFT: 'secondary',\n RECORDED: 'info',\n VERIFIED: 'success',\n ADJUSTED: 'warning',\n\n // Report status\n IN_REVIEW: 'warning',\n PUBLISHED: 'success',\n\n // Reduction-target status\n PROPOSED: 'secondary',\n ACHIEVED: 'success',\n MISSED: 'destructive',\n\n // Compliance — obligation lifecycle (BOFF-5827).\n // OPEN: 'info' is shared with the carbon-credit vintage lifecycle (BOFF-5824).\n FULFILLED: 'success',\n OVERDUE: 'destructive',\n WAIVED: 'outline',\n\n // Compliance — permit lifecycle\n SUBMITTED: 'info',\n UNDER_REVIEW: 'warning',\n APPROVED: 'success',\n REJECTED: 'destructive',\n SUSPENDED: 'warning',\n EXPIRED: 'outline',\n\n // Emission scope\n SCOPE_1: 'destructive',\n SCOPE_2: 'warning',\n SCOPE_3: 'info',\n\n // Waste categories (BOFF-5830) — informational, neutral badges\n GENERAL: 'secondary',\n RECYCLABLES: 'info',\n ORGANIC: 'success',\n HAZARDOUS: 'destructive',\n ELECTRONIC: 'info',\n CONSTRUCTION_DEMOLITION: 'warning',\n TEXTILES: 'info',\n PACKAGING: 'info',\n\n // Waste disposal routes (BOFF-5830): diverted routes read green/blue,\n // landfill reads red, OTHER stays neutral.\n LANDFILL: 'destructive',\n RECYCLED: 'success',\n COMPOSTED: 'success',\n RECOVERED: 'info',\n REUSED: 'success',\n OTHER: 'secondary',\n\n // Material-loop stages (BOFF-5830)\n INPUT: 'info',\n USE: 'secondary',\n RECOVERY: 'warning',\n REUSE: 'success',\n\n // Report frameworks (neutral badges)\n GHG_PROTOCOL: 'outline',\n GRI: 'outline',\n TCFD: 'outline',\n CDP: 'outline',\n SASB: 'outline',\n CSRD: 'outline',\n ISSB: 'outline',\n EU_TAXONOMY: 'outline',\n CUSTOM: 'secondary',\n\n // Carbon credit registry (BOFF-5824): vintage + credit lifecycle\n OPEN: 'info',\n PARTIALLY_ISSUED: 'warning',\n FULLY_ISSUED: 'success',\n CLOSED: 'outline',\n ISSUED: 'success',\n PARTIALLY_RETIRED: 'warning',\n // EHS risk register (BOFF-5820)\n IDENTIFIED: 'secondary',\n ASSESSING: 'info',\n MITIGATING: 'warning',\n LOW: 'success',\n MEDIUM: 'info',\n HIGH: 'warning',\n EXTREME: 'destructive',\n\n // EHS incidents\n NEAR_MISS: 'info',\n REPORTED: 'info',\n UNDER_INVESTIGATION: 'warning',\n ACTION_REQUIRED: 'destructive',\n\n // EHS permits (SUSPENDED / EXPIRED already mapped above)\n REVOKED: 'destructive',\n RENEWAL_DUE: 'warning',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;AAqBA,IAAMA,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW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