@burdenoff/microfe-labsofscience 2026.827.1 → 2026.1014.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/labsofscience/LabsOfScienceRoot.d.ts.map +1 -1
- package/dist/labsofscience/LabsOfScienceRoot.js +54 -57
- package/dist/labsofscience/LabsOfScienceRoot.js.map +1 -1
- package/dist/labsofscience/components/BottomNav.d.ts.map +1 -1
- package/dist/labsofscience/components/BottomNav.js +67 -63
- package/dist/labsofscience/components/BottomNav.js.map +1 -1
- package/dist/labsofscience/hooks/index.d.ts +1 -0
- package/dist/labsofscience/hooks/index.d.ts.map +1 -1
- package/dist/labsofscience/hooks/useTr.d.ts +17 -0
- package/dist/labsofscience/hooks/useTr.d.ts.map +1 -0
- package/dist/labsofscience/hooks/useTr.js +14 -0
- package/dist/labsofscience/hooks/useTr.js.map +1 -0
- package/dist/labsofscience/pages/OverviewPage.d.ts.map +1 -1
- package/dist/labsofscience/pages/OverviewPage.js +187 -161
- package/dist/labsofscience/pages/OverviewPage.js.map +1 -1
- package/dist/labsofscience/pages/datasets/DatasetsListPage.d.ts.map +1 -1
- package/dist/labsofscience/pages/datasets/DatasetsListPage.js +129 -128
- package/dist/labsofscience/pages/datasets/DatasetsListPage.js.map +1 -1
- package/dist/labsofscience/pages/experiments/ExperimentsListPage.d.ts.map +1 -1
- package/dist/labsofscience/pages/experiments/ExperimentsListPage.js +148 -147
- package/dist/labsofscience/pages/experiments/ExperimentsListPage.js.map +1 -1
- package/dist/labsofscience/pages/instruments/InstrumentsListPage.d.ts.map +1 -1
- package/dist/labsofscience/pages/instruments/InstrumentsListPage.js +140 -139
- package/dist/labsofscience/pages/instruments/InstrumentsListPage.js.map +1 -1
- package/dist/labsofscience/pages/inventory/InventoryListPage.d.ts.map +1 -1
- package/dist/labsofscience/pages/inventory/InventoryListPage.js +169 -168
- package/dist/labsofscience/pages/inventory/InventoryListPage.js.map +1 -1
- package/dist/labsofscience/pages/notebook/NotebookListPage.d.ts.map +1 -1
- package/dist/labsofscience/pages/notebook/NotebookListPage.js +123 -122
- package/dist/labsofscience/pages/notebook/NotebookListPage.js.map +1 -1
- package/dist/labsofscience/pages/projects/ProjectsListPage.d.ts.map +1 -1
- package/dist/labsofscience/pages/projects/ProjectsListPage.js +141 -140
- package/dist/labsofscience/pages/projects/ProjectsListPage.js.map +1 -1
- package/dist/labsofscience/pages/protocols/ProtocolsListPage.d.ts.map +1 -1
- package/dist/labsofscience/pages/protocols/ProtocolsListPage.js +123 -122
- package/dist/labsofscience/pages/protocols/ProtocolsListPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabsOfScienceRoot.d.ts","sourceRoot":"","sources":["../../src/labsofscience/LabsOfScienceRoot.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAmBhC,OAAO,KAAK,EAAE,sBAAsB,EAAW,MAAM,SAAS,CAAC;AAY/D,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"LabsOfScienceRoot.d.ts","sourceRoot":"","sources":["../../src/labsofscience/LabsOfScienceRoot.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAmBhC,OAAO,KAAK,EAAE,sBAAsB,EAAW,MAAM,SAAS,CAAC;AAY/D,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA0IxD,CAAC"}
|
|
@@ -1,133 +1,130 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useTr as e } from "./hooks/useTr.js";
|
|
2
|
+
import { LabsOfScienceProvider as t } from "./context/LabsOfScienceContext.js";
|
|
3
|
+
import { LabsOfScienceRoutes as n } from "./LabsOfScienceRoutes.js";
|
|
4
|
+
import { useEffect as r } from "react";
|
|
4
5
|
import { QueryClient as i, QueryClientProvider as a } from "@tanstack/react-query";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { FeatureFlagProvider as v } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
6
|
+
import { BookOpen as o, Boxes as s, Cpu as c, Database as l, FlaskConical as u, FolderKanban as d, GitBranch as f, LayoutDashboard as p, Microscope as m, Sparkles as h } from "lucide-react";
|
|
7
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
8
|
+
import { FeatureFlagProvider as _ } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
9
9
|
//#region src/labsofscience/LabsOfScienceRoot.tsx
|
|
10
|
-
var
|
|
10
|
+
var v = new i({ defaultOptions: { queries: {
|
|
11
11
|
staleTime: 300 * 1e3,
|
|
12
12
|
retry: 1
|
|
13
|
-
} } }),
|
|
14
|
-
let { registerNavItems:
|
|
15
|
-
let n = C(e);
|
|
16
|
-
return n === e ? t : n;
|
|
17
|
-
}, [C]), T = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
13
|
+
} } }), y = (i) => {
|
|
14
|
+
let { registerNavItems: y, registerFooterItems: b, basePath: x = "/" } = i, S = e(), C = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
18
15
|
return r(() => {
|
|
19
|
-
if (!
|
|
16
|
+
if (!y) return;
|
|
20
17
|
let e = [
|
|
21
18
|
{
|
|
22
19
|
id: "labsofscience-overview",
|
|
23
|
-
label:
|
|
24
|
-
path:
|
|
25
|
-
icon: /* @__PURE__ */
|
|
20
|
+
label: S("labsofscience.nav.overview", "Overview"),
|
|
21
|
+
path: C(x, ""),
|
|
22
|
+
icon: /* @__PURE__ */ g(p, { size: 20 }),
|
|
26
23
|
order: 1,
|
|
27
24
|
group: "main"
|
|
28
25
|
},
|
|
29
26
|
{
|
|
30
27
|
id: "labsofscience-projects",
|
|
31
|
-
label:
|
|
32
|
-
path:
|
|
33
|
-
icon: /* @__PURE__ */
|
|
28
|
+
label: S("labsofscience.nav.projects", "Projects"),
|
|
29
|
+
path: C(x, "projects"),
|
|
30
|
+
icon: /* @__PURE__ */ g(d, { size: 20 }),
|
|
34
31
|
order: 10,
|
|
35
32
|
group: "research"
|
|
36
33
|
},
|
|
37
34
|
{
|
|
38
35
|
id: "labsofscience-experiments",
|
|
39
|
-
label:
|
|
40
|
-
path:
|
|
41
|
-
icon: /* @__PURE__ */
|
|
36
|
+
label: S("labsofscience.nav.experiments", "Experiments"),
|
|
37
|
+
path: C(x, "experiments"),
|
|
38
|
+
icon: /* @__PURE__ */ g(u, { size: 20 }),
|
|
42
39
|
order: 11,
|
|
43
40
|
group: "research"
|
|
44
41
|
},
|
|
45
42
|
{
|
|
46
43
|
id: "labsofscience-notebook",
|
|
47
|
-
label:
|
|
48
|
-
path:
|
|
49
|
-
icon: /* @__PURE__ */
|
|
44
|
+
label: S("labsofscience.nav.notebook", "Notebook"),
|
|
45
|
+
path: C(x, "notebook"),
|
|
46
|
+
icon: /* @__PURE__ */ g(o, { size: 20 }),
|
|
50
47
|
order: 12,
|
|
51
48
|
group: "research"
|
|
52
49
|
},
|
|
53
50
|
{
|
|
54
51
|
id: "labsofscience-protocols",
|
|
55
|
-
label:
|
|
56
|
-
path:
|
|
57
|
-
icon: /* @__PURE__ */
|
|
52
|
+
label: S("labsofscience.nav.protocols", "Protocols"),
|
|
53
|
+
path: C(x, "protocols"),
|
|
54
|
+
icon: /* @__PURE__ */ g(m, { size: 20 }),
|
|
58
55
|
order: 13,
|
|
59
56
|
group: "research"
|
|
60
57
|
},
|
|
61
58
|
{
|
|
62
59
|
id: "labsofscience-datasets",
|
|
63
|
-
label:
|
|
64
|
-
path:
|
|
65
|
-
icon: /* @__PURE__ */
|
|
60
|
+
label: S("labsofscience.nav.datasets", "Datasets"),
|
|
61
|
+
path: C(x, "datasets"),
|
|
62
|
+
icon: /* @__PURE__ */ g(l, { size: 20 }),
|
|
66
63
|
order: 20,
|
|
67
64
|
group: "data"
|
|
68
65
|
},
|
|
69
66
|
{
|
|
70
67
|
id: "labsofscience-pipelines",
|
|
71
|
-
label:
|
|
72
|
-
path:
|
|
73
|
-
icon: /* @__PURE__ */
|
|
68
|
+
label: S("labsofscience.nav.pipelines", "Pipelines"),
|
|
69
|
+
path: C(x, "pipelines"),
|
|
70
|
+
icon: /* @__PURE__ */ g(f, { size: 20 }),
|
|
74
71
|
order: 21,
|
|
75
72
|
group: "data"
|
|
76
73
|
},
|
|
77
74
|
{
|
|
78
75
|
id: "labsofscience-inventory",
|
|
79
|
-
label:
|
|
80
|
-
path:
|
|
81
|
-
icon: /* @__PURE__ */
|
|
76
|
+
label: S("labsofscience.nav.inventory", "Inventory"),
|
|
77
|
+
path: C(x, "inventory"),
|
|
78
|
+
icon: /* @__PURE__ */ g(s, { size: 20 }),
|
|
82
79
|
order: 30,
|
|
83
80
|
group: "bench"
|
|
84
81
|
},
|
|
85
82
|
{
|
|
86
83
|
id: "labsofscience-instruments",
|
|
87
|
-
label:
|
|
88
|
-
path:
|
|
89
|
-
icon: /* @__PURE__ */
|
|
84
|
+
label: S("labsofscience.nav.instruments", "Instruments"),
|
|
85
|
+
path: C(x, "instruments"),
|
|
86
|
+
icon: /* @__PURE__ */ g(c, { size: 20 }),
|
|
90
87
|
order: 31,
|
|
91
88
|
group: "bench"
|
|
92
89
|
},
|
|
93
90
|
{
|
|
94
91
|
id: "labsofscience-ai",
|
|
95
|
-
label:
|
|
96
|
-
path:
|
|
97
|
-
icon: /* @__PURE__ */
|
|
92
|
+
label: S("labsofscience.nav.ai", "AI Operations"),
|
|
93
|
+
path: C(x, "ai"),
|
|
94
|
+
icon: /* @__PURE__ */ g(h, { size: 20 }),
|
|
98
95
|
order: 40,
|
|
99
96
|
group: "ai"
|
|
100
97
|
}
|
|
101
98
|
];
|
|
102
|
-
return
|
|
99
|
+
return y(e);
|
|
103
100
|
}, [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
y,
|
|
102
|
+
x,
|
|
103
|
+
S
|
|
107
104
|
]), r(() => {
|
|
108
|
-
if (!
|
|
105
|
+
if (!b) return;
|
|
109
106
|
let e = [{
|
|
110
107
|
id: "labsofscience-status",
|
|
111
|
-
label:
|
|
108
|
+
label: S("labsofscience.footer.ready", "LabsOfScience Ready"),
|
|
112
109
|
type: "status",
|
|
113
110
|
order: 10,
|
|
114
111
|
section: "left"
|
|
115
112
|
}];
|
|
116
|
-
return
|
|
117
|
-
}, [
|
|
118
|
-
client:
|
|
119
|
-
children: /* @__PURE__ */ _
|
|
113
|
+
return b(e);
|
|
114
|
+
}, [b, S]), /* @__PURE__ */ g(a, {
|
|
115
|
+
client: v,
|
|
116
|
+
children: /* @__PURE__ */ g(_, {
|
|
120
117
|
workspaceId: null,
|
|
121
118
|
gateway: "global",
|
|
122
119
|
defaultEnabled: !0,
|
|
123
|
-
children: /* @__PURE__ */
|
|
120
|
+
children: /* @__PURE__ */ g(t, {
|
|
124
121
|
...i,
|
|
125
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ g(n, {})
|
|
126
123
|
})
|
|
127
124
|
})
|
|
128
125
|
});
|
|
129
126
|
};
|
|
130
127
|
//#endregion
|
|
131
|
-
export {
|
|
128
|
+
export { y as LabsOfScienceRoot };
|
|
132
129
|
|
|
133
130
|
//# sourceMappingURL=LabsOfScienceRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabsOfScienceRoot.js","names":[],"sources":["../../src/labsofscience/LabsOfScienceRoot.tsx"],"sourcesContent":["/**\n * LabsOfScience Root Component\n * @module labsofscience\n */\n\nimport type { FC } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"LabsOfScienceRoot.js","names":[],"sources":["../../src/labsofscience/LabsOfScienceRoot.tsx"],"sourcesContent":["/**\n * LabsOfScience Root Component\n * @module labsofscience\n */\n\nimport type { FC } from 'react';\nimport { useEffect } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { useTr } from './hooks/useTr';\nimport {\n LayoutDashboard,\n FolderKanban,\n FlaskConical,\n Database,\n Microscope,\n Cpu,\n Boxes,\n BookOpen,\n GitBranch,\n Sparkles,\n} from 'lucide-react';\nimport { LabsOfScienceProvider } from './context/LabsOfScienceContext';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { LabsOfScienceRoutes } from './LabsOfScienceRoutes';\nimport type { LabsOfScienceRootProps, NavItem } from './types';\n\n// Create a query client for this microfrontend\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 5 * 60 * 1000,\n retry: 1,\n },\n },\n});\n\nexport const LabsOfScienceRoot: FC<LabsOfScienceRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const tr = useTr();\n\n // Helper to join paths correctly\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with shell on mount\n useEffect(() => {\n if (!registerNavItems) return;\n\n const navItems: NavItem[] = [\n // Overview\n {\n id: 'labsofscience-overview',\n label: tr('labsofscience.nav.overview', 'Overview'),\n path: joinPath(basePath, ''),\n icon: <LayoutDashboard size={20} />,\n order: 1,\n group: 'main',\n },\n\n // Research\n {\n id: 'labsofscience-projects',\n label: tr('labsofscience.nav.projects', 'Projects'),\n path: joinPath(basePath, 'projects'),\n icon: <FolderKanban size={20} />,\n order: 10,\n group: 'research',\n },\n {\n id: 'labsofscience-experiments',\n label: tr('labsofscience.nav.experiments', 'Experiments'),\n path: joinPath(basePath, 'experiments'),\n icon: <FlaskConical size={20} />,\n order: 11,\n group: 'research',\n },\n {\n id: 'labsofscience-notebook',\n label: tr('labsofscience.nav.notebook', 'Notebook'),\n path: joinPath(basePath, 'notebook'),\n icon: <BookOpen size={20} />,\n order: 12,\n group: 'research',\n },\n {\n id: 'labsofscience-protocols',\n label: tr('labsofscience.nav.protocols', 'Protocols'),\n path: joinPath(basePath, 'protocols'),\n icon: <Microscope size={20} />,\n order: 13,\n group: 'research',\n },\n\n // Data & analysis\n {\n id: 'labsofscience-datasets',\n label: tr('labsofscience.nav.datasets', 'Datasets'),\n path: joinPath(basePath, 'datasets'),\n icon: <Database size={20} />,\n order: 20,\n group: 'data',\n },\n {\n id: 'labsofscience-pipelines',\n label: tr('labsofscience.nav.pipelines', 'Pipelines'),\n path: joinPath(basePath, 'pipelines'),\n icon: <GitBranch size={20} />,\n order: 21,\n group: 'data',\n },\n\n // The bench\n {\n id: 'labsofscience-inventory',\n label: tr('labsofscience.nav.inventory', 'Inventory'),\n path: joinPath(basePath, 'inventory'),\n icon: <Boxes size={20} />,\n order: 30,\n group: 'bench',\n },\n {\n id: 'labsofscience-instruments',\n label: tr('labsofscience.nav.instruments', 'Instruments'),\n path: joinPath(basePath, 'instruments'),\n icon: <Cpu size={20} />,\n order: 31,\n group: 'bench',\n },\n\n // AI operations\n {\n id: 'labsofscience-ai',\n label: tr('labsofscience.nav.ai', 'AI Operations'),\n path: joinPath(basePath, 'ai'),\n icon: <Sparkles size={20} />,\n order: 40,\n group: 'ai',\n },\n ];\n\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath, tr]);\n\n // Register footer items\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'labsofscience-status',\n label: tr('labsofscience.footer.ready', 'LabsOfScience Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems, tr]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <LabsOfScienceProvider {...props}>\n <LabsOfScience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C,GAAD,CAAsB,CAAA;GACD,CAAA;EACJ,CAAA;CACF,CAAA;AAEzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomNav.d.ts","sourceRoot":"","sources":["../../../src/labsofscience/components/BottomNav.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomNav.d.ts","sourceRoot":"","sources":["../../../src/labsofscience/components/BottomNav.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AAkF1C,eAAO,MAAM,SAAS,EAAE,EAmGvB,CAAC"}
|
|
@@ -1,147 +1,151 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { useLabsOfScience as t } from "../context/LabsOfScienceContext.js";
|
|
3
|
+
import { cn as n } from "../utils/cn.js";
|
|
4
|
+
import { useState as r } from "react";
|
|
5
|
+
import { BookOpen as i, Boxes as a, Cpu as o, Database as s, FlaskConical as c, FolderKanban as l, GitBranch as u, LayoutDashboard as d, Microscope as f, MoreHorizontal as p, Sparkles as m } from "lucide-react";
|
|
6
|
+
import { useLocation as h } from "react-router";
|
|
7
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
8
|
+
import { BottomSheet as y, BottomSheetContent as b, BottomSheetDescription as x, BottomSheetHeader as S, BottomSheetTitle as C } from "@burdenoff/fe-libs/ui";
|
|
8
9
|
//#region src/labsofscience/components/BottomNav.tsx
|
|
9
|
-
var
|
|
10
|
+
var w = [
|
|
10
11
|
{
|
|
11
12
|
id: "overview",
|
|
12
13
|
label: "Overview",
|
|
13
14
|
path: "",
|
|
14
|
-
icon:
|
|
15
|
+
icon: d
|
|
15
16
|
},
|
|
16
17
|
{
|
|
17
18
|
id: "projects",
|
|
18
19
|
label: "Projects",
|
|
19
20
|
path: "projects",
|
|
20
|
-
icon:
|
|
21
|
+
icon: l
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
id: "experiments",
|
|
24
25
|
label: "Experiments",
|
|
25
26
|
path: "experiments",
|
|
26
|
-
icon:
|
|
27
|
+
icon: c
|
|
27
28
|
},
|
|
28
29
|
{
|
|
29
30
|
id: "notebook",
|
|
30
31
|
label: "Notebook",
|
|
31
32
|
path: "notebook",
|
|
32
|
-
icon:
|
|
33
|
+
icon: i
|
|
33
34
|
}
|
|
34
|
-
],
|
|
35
|
+
], T = [
|
|
35
36
|
{
|
|
36
37
|
id: "protocols",
|
|
37
38
|
label: "Protocols",
|
|
38
39
|
path: "protocols",
|
|
39
|
-
icon:
|
|
40
|
+
icon: f
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
43
|
id: "datasets",
|
|
43
44
|
label: "Datasets",
|
|
44
45
|
path: "datasets",
|
|
45
|
-
icon:
|
|
46
|
+
icon: s
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
id: "pipelines",
|
|
49
50
|
label: "Pipelines",
|
|
50
51
|
path: "pipelines",
|
|
51
|
-
icon:
|
|
52
|
+
icon: u
|
|
52
53
|
},
|
|
53
54
|
{
|
|
54
55
|
id: "inventory",
|
|
55
56
|
label: "Inventory",
|
|
56
57
|
path: "inventory",
|
|
57
|
-
icon:
|
|
58
|
+
icon: a
|
|
58
59
|
},
|
|
59
60
|
{
|
|
60
61
|
id: "instruments",
|
|
61
62
|
label: "Instruments",
|
|
62
63
|
path: "instruments",
|
|
63
|
-
icon:
|
|
64
|
+
icon: o
|
|
64
65
|
},
|
|
65
66
|
{
|
|
66
67
|
id: "ai",
|
|
67
68
|
label: "AI Operations",
|
|
68
69
|
path: "ai",
|
|
69
|
-
icon:
|
|
70
|
+
icon: m
|
|
70
71
|
}
|
|
71
72
|
];
|
|
72
|
-
function
|
|
73
|
-
let n =
|
|
73
|
+
function E(e, t) {
|
|
74
|
+
let n = h(), r = e(t);
|
|
74
75
|
return t === "" ? n.pathname === r : n.pathname === r || n.pathname.startsWith(`${r}/`);
|
|
75
76
|
}
|
|
76
|
-
var
|
|
77
|
+
var D = ({ tab: e, active: t, onClick: r }) => {
|
|
77
78
|
let i = e.icon;
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ _("li", {
|
|
79
80
|
className: "flex-1",
|
|
80
|
-
children: /* @__PURE__ */
|
|
81
|
+
children: /* @__PURE__ */ v("button", {
|
|
81
82
|
type: "button",
|
|
82
|
-
"aria-current":
|
|
83
|
+
"aria-current": t ? "page" : void 0,
|
|
83
84
|
onClick: r,
|
|
84
|
-
className:
|
|
85
|
-
children: [/* @__PURE__ */
|
|
85
|
+
className: n("flex w-full flex-col items-center gap-1 py-2.5 text-[11px] font-medium transition-colors", t ? "text-accent" : "text-text-tertiary hover:text-text-secondary"),
|
|
86
|
+
children: [/* @__PURE__ */ _(i, { className: n("h-5 w-5", t && "text-accent") }), e.label]
|
|
86
87
|
})
|
|
87
88
|
});
|
|
88
|
-
},
|
|
89
|
-
let { getPath:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
}, O = () => {
|
|
90
|
+
let { getPath: i, navigateTo: a } = t(), o = h(), [s, c] = r(!1), l = e(), u = (e) => e.map((e) => ({
|
|
91
|
+
...e,
|
|
92
|
+
label: l(`labsofscience.nav.${e.id}`, e.label)
|
|
93
|
+
})), d = u(w), f = u(T), m = T.some((e) => {
|
|
94
|
+
let t = i(e.path);
|
|
95
|
+
return o.pathname === t || o.pathname.startsWith(`${t}/`);
|
|
96
|
+
}), E = l("labsofscience.nav.more", "More"), D = l("labsofscience.mobileNav.moreTitle", "More"), O = l("labsofscience.mobileNav.moreDescription", "Protocols, datasets, pipelines, inventory, instruments and AI operations.");
|
|
97
|
+
return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("nav", {
|
|
98
|
+
"aria-label": l("labsofscience.mobileNav.label", "LabsOfScience mobile navigation"),
|
|
99
|
+
className: n("fixed inset-x-0 bottom-0 z-40 lg:hidden", "border-t border-border-seam bg-bg-surface/95 backdrop-blur-sm", "pb-[max(env(safe-area-inset-bottom),0px)]"),
|
|
100
|
+
children: /* @__PURE__ */ v("ul", {
|
|
97
101
|
className: "flex",
|
|
98
|
-
children: [
|
|
102
|
+
children: [d.map((e) => /* @__PURE__ */ _(k, {
|
|
99
103
|
tab: e,
|
|
100
|
-
onClick: () =>
|
|
101
|
-
}, e.id)), /* @__PURE__ */
|
|
104
|
+
onClick: () => a(e.path)
|
|
105
|
+
}, e.id)), /* @__PURE__ */ _("li", {
|
|
102
106
|
className: "flex-1",
|
|
103
|
-
children: /* @__PURE__ */
|
|
107
|
+
children: /* @__PURE__ */ v("button", {
|
|
104
108
|
type: "button",
|
|
105
|
-
"aria-current":
|
|
109
|
+
"aria-current": m ? "page" : void 0,
|
|
106
110
|
"aria-haspopup": "dialog",
|
|
107
|
-
"aria-expanded":
|
|
108
|
-
onClick: () =>
|
|
109
|
-
className:
|
|
110
|
-
children: [/* @__PURE__ */
|
|
111
|
+
"aria-expanded": s,
|
|
112
|
+
onClick: () => c(!0),
|
|
113
|
+
className: n("flex w-full flex-col items-center gap-1 py-2.5 text-[11px] font-medium transition-colors", m ? "text-accent" : "text-text-tertiary hover:text-text-secondary"),
|
|
114
|
+
children: [/* @__PURE__ */ _(p, { className: n("h-5 w-5", m && "text-accent") }), E]
|
|
111
115
|
})
|
|
112
116
|
})]
|
|
113
117
|
})
|
|
114
|
-
}), /* @__PURE__ */
|
|
115
|
-
open:
|
|
116
|
-
onOpenChange:
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
+
}), /* @__PURE__ */ _(y, {
|
|
119
|
+
open: s,
|
|
120
|
+
onOpenChange: c,
|
|
121
|
+
children: /* @__PURE__ */ v(b, {
|
|
118
122
|
className: "lg:hidden",
|
|
119
|
-
children: [/* @__PURE__ */
|
|
123
|
+
children: [/* @__PURE__ */ v(S, { children: [/* @__PURE__ */ _(C, { children: D }), /* @__PURE__ */ _(x, { children: O })] }), /* @__PURE__ */ _("ul", {
|
|
120
124
|
className: "grid grid-cols-3 gap-3 pb-6",
|
|
121
|
-
children:
|
|
122
|
-
let
|
|
123
|
-
return /* @__PURE__ */
|
|
125
|
+
children: f.map((e) => {
|
|
126
|
+
let t = e.icon, r = i(e.path), s = o.pathname === r || o.pathname.startsWith(`${r}/`);
|
|
127
|
+
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("button", {
|
|
124
128
|
type: "button",
|
|
125
|
-
"aria-current":
|
|
129
|
+
"aria-current": s ? "page" : void 0,
|
|
126
130
|
onClick: () => {
|
|
127
|
-
|
|
131
|
+
c(!1), a(e.path);
|
|
128
132
|
},
|
|
129
|
-
className:
|
|
130
|
-
children: [/* @__PURE__ */
|
|
133
|
+
className: n("flex w-full flex-col items-center gap-2 rounded-card border border-border-subtle bg-bg-surface p-3 text-xs font-medium transition-colors", s ? "border-border-strong text-accent" : "text-text-secondary hover:border-border-strong hover:text-text-primary"),
|
|
134
|
+
children: [/* @__PURE__ */ _(t, { className: n("h-5 w-5", s && "text-accent") }), e.label]
|
|
131
135
|
}) }, e.id);
|
|
132
136
|
})
|
|
133
137
|
})]
|
|
134
138
|
})
|
|
135
139
|
})] });
|
|
136
|
-
},
|
|
137
|
-
let { getPath: r } =
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
tab:
|
|
140
|
-
active:
|
|
140
|
+
}, k = ({ tab: e, onClick: n }) => {
|
|
141
|
+
let { getPath: r } = t();
|
|
142
|
+
return /* @__PURE__ */ _(D, {
|
|
143
|
+
tab: e,
|
|
144
|
+
active: E(r, e.path),
|
|
141
145
|
onClick: n
|
|
142
146
|
});
|
|
143
147
|
};
|
|
144
148
|
//#endregion
|
|
145
|
-
export {
|
|
149
|
+
export { O as BottomNav };
|
|
146
150
|
|
|
147
151
|
//# sourceMappingURL=BottomNav.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomNav.js","names":[],"sources":["../../../src/labsofscience/components/BottomNav.tsx"],"sourcesContent":["/**\n * BottomNav — LabsOfScience's mobile tab bar (BOFF-3982 / BOFF-4199 / BOFF-4642).\n * @module labsofscience/components\n *\n * The Capacitor iOS/Android shell renders this MFE inside a WebView with no\n * layout adaptation of its own: without this component the app shipped the\n * same desktop sidebar-oriented navigation on a phone screen. Mirrors the\n * host shell's own ten registered nav items (see `LabsOfScienceRoot`) but\n * surfaces only the four highest-traffic research destinations directly —\n * Overview / Projects / Experiments / Notebook — plus a \"More\" tab that opens\n * a bottom sheet for the remaining six (Protocols, Datasets, Pipelines,\n * Inventory, Instruments, AI Operations), matching the mobile mocks\n * (`labsofscience-specs/product/mockups/labsci-29-mobile-nav.png`,\n * `labsci-30-mobile-more-sheet.png`).\n *\n * Fixed at the bottom of the viewport, hidden at and above the `lg`\n * breakpoint — the same responsive split the shared `ResponsiveTable` /\n * `ResponsiveDialog` primitives already use throughout this MFE.\n */\n\nimport { type FC, useState } from 'react';\nimport { useLocation } from 'react-router';\nimport {\n LayoutDashboard,\n FolderKanban,\n FlaskConical,\n BookOpen,\n Microscope,\n Database,\n GitBranch,\n Boxes,\n Cpu,\n MoreHorizontal,\n Sparkles,\n} from 'lucide-react';\nimport {\n BottomSheet,\n BottomSheetContent,\n BottomSheetHeader,\n BottomSheetTitle,\n BottomSheetDescription,\n} from '@burdenoff/fe-libs/ui';\nimport { useLabsOfScience } from '../context/LabsOfScienceContext';\nimport { cn } from '../utils/cn';\n\ninterface TabDef {\n id: string;\n label: string;\n /** Path relative to basePath, '' for the overview. */\n path: string;\n icon: FC<{ className?: string }>;\n}\n\nconst PRIMARY_TABS: TabDef[] = [\n { id: 'overview', label: 'Overview', path: '', icon: LayoutDashboard },\n { id: 'projects', label: 'Projects', path: 'projects', icon: FolderKanban },\n { id: 'experiments', label: 'Experiments', path: 'experiments', icon: FlaskConical },\n { id: 'notebook', label: 'Notebook', path: 'notebook', icon: BookOpen },\n];\n\nconst MORE_TABS: TabDef[] = [\n { id: 'protocols', label: 'Protocols', path: 'protocols', icon: Microscope },\n { id: 'datasets', label: 'Datasets', path: 'datasets', icon: Database },\n { id: 'pipelines', label: 'Pipelines', path: 'pipelines', icon: GitBranch },\n { id: 'inventory', label: 'Inventory', path: 'inventory', icon: Boxes },\n { id: 'instruments', label: 'Instruments', path: 'instruments', icon: Cpu },\n { id: 'ai', label: 'AI Operations', path: 'ai', icon: Sparkles },\n];\n\nfunction useIsTabActive(getPath: (relativePath: string) => string, path: string): boolean {\n const location = useLocation();\n const target = getPath(path);\n return path === ''\n ? location.pathname === target\n : location.pathname === target || location.pathname.startsWith(`${target}/`);\n}\n\nconst TabButton: FC<{\n tab: TabDef;\n active: boolean;\n onClick: () => void;\n}> = ({ tab, active, onClick }) => {\n const Icon = tab.icon;\n return (\n <li className=\"flex-1\">\n <button\n type=\"button\"\n aria-current={active ? 'page' : undefined}\n onClick={onClick}\n className={cn(\n 'flex w-full flex-col items-center gap-1 py-2.5 text-[11px] font-medium transition-colors',\n active ? 'text-accent' : 'text-text-tertiary hover:text-text-secondary'\n )}\n >\n <Icon className={cn('h-5 w-5', active && 'text-accent')} />\n {tab.label}\n </button>\n </li>\n );\n};\n\nexport const BottomNav: FC = () => {\n const { getPath, navigateTo } = useLabsOfScience();\n const location = useLocation();\n const [moreOpen, setMoreOpen] = useState(false);\n\n const moreActive = MORE_TABS.some((tab) => {\n const target = getPath(tab.path);\n return location.pathname === target || location.pathname.startsWith(`${target}/`);\n });\n\n return (\n <>\n <nav\n aria-label=\"LabsOfScience mobile navigation\"\n className={cn(\n 'fixed inset-x-0 bottom-0 z-40 lg:hidden',\n 'border-t border-border-seam bg-bg-surface/95 backdrop-blur-sm',\n 'pb-[max(env(safe-area-inset-bottom),0px)]'\n )}\n >\n <ul className=\"flex\">\n {PRIMARY_TABS.map((tab) => (\n <TabButtonWithActive key={tab.id} tab={tab} onClick={() => navigateTo(tab.path)} />\n ))}\n <li className=\"flex-1\">\n <button\n type=\"button\"\n aria-current={moreActive ? 'page' : undefined}\n aria-haspopup=\"dialog\"\n aria-expanded={moreOpen}\n onClick={() => setMoreOpen(true)}\n className={cn(\n 'flex w-full flex-col items-center gap-1 py-2.5 text-[11px] font-medium transition-colors',\n moreActive ? 'text-accent' : 'text-text-tertiary hover:text-text-secondary'\n )}\n >\n <MoreHorizontal className={cn('h-5 w-5', moreActive && 'text-accent')} />\n More\n </button>\n </li>\n </ul>\n </nav>\n\n <BottomSheet open={moreOpen} onOpenChange={setMoreOpen}>\n <BottomSheetContent className=\"lg:hidden\">\n <BottomSheetHeader>\n <BottomSheetTitle>More</BottomSheetTitle>\n <BottomSheetDescription>\n Protocols, datasets, pipelines, inventory, instruments and AI operations.\n </BottomSheetDescription>\n </BottomSheetHeader>\n <ul className=\"grid grid-cols-3 gap-3 pb-6\">\n {MORE_TABS.map((tab) => {\n const Icon = tab.icon;\n const target = getPath(tab.path);\n const active =\n location.pathname === target || location.pathname.startsWith(`${target}/`);\n return (\n <li key={tab.id}>\n <button\n type=\"button\"\n aria-current={active ? 'page' : undefined}\n onClick={() => {\n setMoreOpen(false);\n navigateTo(tab.path);\n }}\n className={cn(\n 'flex w-full flex-col items-center gap-2 rounded-card border border-border-subtle bg-bg-surface p-3 text-xs font-medium transition-colors',\n active\n ? 'border-border-strong text-accent'\n : 'text-text-secondary hover:border-border-strong hover:text-text-primary'\n )}\n >\n <Icon className={cn('h-5 w-5', active && 'text-accent')} />\n {tab.label}\n </button>\n </li>\n );\n })}\n </ul>\n </BottomSheetContent>\n </BottomSheet>\n </>\n );\n};\n\n/** Split out so `useIsTabActive` (which calls `useLocation`) stays a proper hook call per list item. */\nconst TabButtonWithActive: FC<{ tab: TabDef; onClick: () => void }> = ({ tab, onClick }) => {\n const { getPath } = useLabsOfScience();\n const active = useIsTabActive(getPath, tab.path);\n return <TabButton tab={tab} active={active} onClick={onClick} />;\n};\n"],"mappings":";;;;;;;;AAqDA,IAAM,IAAyB;CAC7B;EAAE,IAAI;EAAY,OAAO;EAAY,MAAM;EAAI,MAAM;CAAgB;CACrE;EAAE,IAAI;EAAY,OAAO;EAAY,MAAM;EAAY,MAAM;CAAa;CAC1E;EAAE,IAAI;EAAe,OAAO;EAAe,MAAM;EAAe,MAAM;CAAa;CACnF;EAAE,IAAI;EAAY,OAAO;EAAY,MAAM;EAAY,MAAM;CAAS;AACxE,GAEM,IAAsB;CAC1B;EAAE,IAAI;EAAa,OAAO;EAAa,MAAM;EAAa,MAAM;CAAW;CAC3E;EAAE,IAAI;EAAY,OAAO;EAAY,MAAM;EAAY,MAAM;CAAS;CACtE;EAAE,IAAI;EAAa,OAAO;EAAa,MAAM;EAAa,MAAM;CAAU;CAC1E;EAAE,IAAI;EAAa,OAAO;EAAa,MAAM;EAAa,MAAM;CAAM;CACtE;EAAE,IAAI;EAAe,OAAO;EAAe,MAAM;EAAe,MAAM;CAAI;CAC1E;EAAE,IAAI;EAAM,OAAO;EAAiB,MAAM;EAAM,MAAM;CAAS;AACjE;AAEA,SAAS,EAAe,GAA2C,GAAuB;CACxF,IAAM,IAAW,EAAY,GACvB,IAAS,EAAQ,CAAI;CAC3B,OAAO,MAAS,KACZ,EAAS,aAAa,IACtB,EAAS,aAAa,KAAU,EAAS,SAAS,WAAW,GAAG,EAAO,EAAE;AAC/E;AAEA,IAAM,KAIA,EAAE,QAAK,WAAQ,iBAAc;CACjC,IAAM,IAAO,EAAI;CACjB,OACE,kBAAC,MAAD;EAAI,WAAU;YACZ,kBAAC,UAAD;GACE,MAAK;GACL,gBAAc,IAAS,SAAS,KAAA;GACvB;GACT,WAAW,EACT,4FACA,IAAS,gBAAgB,8CAC3B;aAPF,CASE,kB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AAS,aAAa,KAAU,EAAS,SAAS,WAAW,GAAG,EAAO,EAAE;KAC3E,OACE,kBAAC,MAAD,EAAA,UACE,kBAAC,UAAD;MACE,MAAK;MACL,gBAAc,IAAS,SAAS,KAAA;MAChC,eAAe;OAEb,AADA,EAAY,EAAK,GACjB,EAAW,EAAI,IAAI;MACrB;MACA,WAAW,EACT,4IACA,IACI,qCACA,wEACN;gBAZF,CAcE,kBAAC,GAAD,EAAM,WAAW,EAAG,WAAW,KAAU,aAAa,EAAI,CAAA,GACzD,EAAI,KACC;QACN,GAlBK,EAAI,EAkBT;IAER,CAAC;GACC,CAAA,CACc;;CACT,CAAA,CACb,EAAA,CAAA;AAEN,GAGM,KAAiE,EAAE,QAAK,iBAAc;CAC1F,IAAM,EAAE,eAAY,EAAiB;CAErC,OAAO,kBAAC,GAAD;EAAgB;EAAa,QADrB,EAAe,GAAS,EAAI,IACP;EAAiB;CAAU,CAAA;AACjE"}
|
|
1
|
+
{"version":3,"file":"BottomNav.js","names":[],"sources":["../../../src/labsofscience/components/BottomNav.tsx"],"sourcesContent":["/**\n * BottomNav — LabsOfScience's mobile tab bar (BOFF-3982 / BOFF-4199 / BOFF-4642).\n * @module labsofscience/components\n *\n * The Capacitor iOS/Android shell renders this MFE inside a WebView with no\n * layout adaptation of its own: without this component the app shipped the\n * same desktop sidebar-oriented navigation on a phone screen. Mirrors the\n * host shell's own ten registered nav items (see `LabsOfScienceRoot`) but\n * surfaces only the four highest-traffic research destinations directly —\n * Overview / Projects / Experiments / Notebook — plus a \"More\" tab that opens\n * a bottom sheet for the remaining six (Protocols, Datasets, Pipelines,\n * Inventory, Instruments, AI Operations), matching the mobile mocks\n * (`labsofscience-specs/product/mockups/labsci-29-mobile-nav.png`,\n * `labsci-30-mobile-more-sheet.png`).\n *\n * Fixed at the bottom of the viewport, hidden at and above the `lg`\n * breakpoint — the same responsive split the shared `ResponsiveTable` /\n * `ResponsiveDialog` primitives already use throughout this MFE.\n */\n\nimport { type FC, useState } from 'react';\nimport { useLocation } from 'react-router';\nimport {\n LayoutDashboard,\n FolderKanban,\n FlaskConical,\n BookOpen,\n Microscope,\n Database,\n GitBranch,\n Boxes,\n Cpu,\n MoreHorizontal,\n Sparkles,\n} from 'lucide-react';\nimport {\n BottomSheet,\n BottomSheetContent,\n BottomSheetHeader,\n BottomSheetTitle,\n BottomSheetDescription,\n} from '@burdenoff/fe-libs/ui';\nimport { useLabsOfScience } from '../context/LabsOfScienceContext';\nimport { useTr } from '../hooks/useTr';\nimport { cn } from '../utils/cn';\n\ninterface TabDef {\n id: string;\n label: string;\n /** Path relative to basePath, '' for the overview. */\n path: string;\n icon: FC<{ className?: string }>;\n}\n\nconst PRIMARY_TABS: TabDef[] = [\n { id: 'overview', label: 'Overview', path: '', icon: LayoutDashboard },\n { id: 'projects', label: 'Projects', path: 'projects', icon: FolderKanban },\n { id: 'experiments', label: 'Experiments', path: 'experiments', icon: FlaskConical },\n { id: 'notebook', label: 'Notebook', path: 'notebook', icon: BookOpen },\n];\n\nconst MORE_TABS: TabDef[] = [\n { id: 'protocols', label: 'Protocols', path: 'protocols', icon: Microscope },\n { id: 'datasets', label: 'Datasets', path: 'datasets', icon: Database },\n { id: 'pipelines', label: 'Pipelines', path: 'pipelines', icon: GitBranch },\n { id: 'inventory', label: 'Inventory', path: 'inventory', icon: Boxes },\n { id: 'instruments', label: 'Instruments', path: 'instruments', icon: Cpu },\n { id: 'ai', label: 'AI Operations', path: 'ai', icon: Sparkles },\n];\n\nfunction useIsTabActive(getPath: (relativePath: string) => string, path: string): boolean {\n const location = useLocation();\n const target = getPath(path);\n return path === ''\n ? location.pathname === target\n : location.pathname === target || location.pathname.startsWith(`${target}/`);\n}\n\nconst TabButton: FC<{\n tab: TabDef;\n active: boolean;\n onClick: () => void;\n}> = ({ tab, active, onClick }) => {\n const Icon = tab.icon;\n return (\n <li className=\"flex-1\">\n <button\n type=\"button\"\n aria-current={active ? 'page' : undefined}\n onClick={onClick}\n className={cn(\n 'flex w-full flex-col items-center gap-1 py-2.5 text-[11px] font-medium transition-colors',\n active ? 'text-accent' : 'text-text-tertiary hover:text-text-secondary'\n )}\n >\n <Icon className={cn('h-5 w-5', active && 'text-accent')} />\n {tab.label}\n </button>\n </li>\n );\n};\n\nexport const BottomNav: FC = () => {\n const { getPath, navigateTo } = useLabsOfScience();\n const location = useLocation();\n const [moreOpen, setMoreOpen] = useState(false);\n const tr = useTr();\n\n const translateTabs = (tabs: TabDef[]): TabDef[] =>\n tabs.map((tab) => ({\n ...tab,\n label: tr(`labsofscience.nav.${tab.id}`, tab.label),\n }));\n\n const primaryTabs = translateTabs(PRIMARY_TABS);\n const moreTabs = translateTabs(MORE_TABS);\n\n const moreActive = MORE_TABS.some((tab) => {\n const target = getPath(tab.path);\n return location.pathname === target || location.pathname.startsWith(`${target}/`);\n });\n\n const moreLabel = tr('labsofscience.nav.more', 'More');\n const moreSheetTitle = tr('labsofscience.mobileNav.moreTitle', 'More');\n const moreSheetDescription = tr(\n 'labsofscience.mobileNav.moreDescription',\n 'Protocols, datasets, pipelines, inventory, instruments and AI operations.'\n );\n\n return (\n <>\n <nav\n aria-label={tr('labsofscience.mobileNav.label', 'LabsOfScience mobile navigation')}\n className={cn(\n 'fixed inset-x-0 bottom-0 z-40 lg:hidden',\n 'border-t border-border-seam bg-bg-surface/95 backdrop-blur-sm',\n 'pb-[max(env(safe-area-inset-bottom),0px)]'\n )}\n >\n <ul className=\"flex\">\n {primaryTabs.map((tab) => (\n <TabButtonWithActive key={tab.id} tab={tab} onClick={() => navigateTo(tab.path)} />\n ))}\n <li className=\"flex-1\">\n <button\n type=\"button\"\n aria-current={moreActive ? 'page' : undefined}\n aria-haspopup=\"dialog\"\n aria-expanded={moreOpen}\n onClick={() => setMoreOpen(true)}\n className={cn(\n 'flex w-full flex-col items-center gap-1 py-2.5 text-[11px] font-medium transition-colors',\n moreActive ? 'text-accent' : 'text-text-tertiary hover:text-text-secondary'\n )}\n >\n <MoreHorizontal className={cn('h-5 w-5', moreActive && 'text-accent')} />\n {moreLabel}\n </button>\n </li>\n </ul>\n </nav>\n\n <BottomSheet open={moreOpen} onOpenChange={setMoreOpen}>\n <BottomSheetContent className=\"lg:hidden\">\n <BottomSheetHeader>\n <BottomSheetTitle>{moreSheetTitle}</BottomSheetTitle>\n <BottomSheetDescription>{moreSheetDescription}</BottomSheetDescription>\n </BottomSheetHeader>\n <ul className=\"grid grid-cols-3 gap-3 pb-6\">\n {moreTabs.map((tab) => {\n const Icon = tab.icon;\n const target = getPath(tab.path);\n const active =\n location.pathname === target || location.pathname.startsWith(`${target}/`);\n return (\n <li key={tab.id}>\n <button\n type=\"button\"\n aria-current={active ? 'page' : undefined}\n onClick={() => {\n setMoreOpen(false);\n navigateTo(tab.path);\n }}\n className={cn(\n 'flex w-full flex-col items-center gap-2 rounded-card border border-border-subtle bg-bg-surface p-3 text-xs font-medium transition-colors',\n active\n ? 'border-border-strong text-accent'\n : 'text-text-secondary hover:border-border-strong hover:text-text-primary'\n )}\n >\n <Icon className={cn('h-5 w-5', active && 'text-accent')} />\n {tab.label}\n </button>\n </li>\n );\n })}\n </ul>\n </BottomSheetContent>\n </BottomSheet>\n </>\n );\n};\n\n/** Split out so `useIsTabActive` (which calls `useLocation`) stays a proper hook call per list item. */\nconst TabButtonWithActive: FC<{ tab: TabDef; onClick: () => void }> = ({ tab, onClick }) => {\n const { getPath } = useLabsOfScience();\n const active = useIsTabActive(getPath, tab.path);\n return <TabButton tab={tab} active={active} onClick={onClick} />;\n};\n"],"mappings":";;;;;;;;;AAsDA,IAAM,IAAyB;CAC7B;EAAE,IAAI;EAAY,OAAO;EAAY,MAAM;EAAI,MAAM;CAAgB;CACrE;EAAE,IAAI;EAAY,OAAO;EAAY,MAAM;EAAY,MAAM;CAAa;CAC1E;EAAE,IAAI;EAAe,OAAO;EAAe,MAAM;EAAe,MAAM;CAAa;CACnF;EAAE,IAAI;EAAY,OAAO;EAAY,MAAM;EAAY,MAAM;CAAS;AACxE,GAEM,IAAsB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A;MAChC,eAAe;OAEb,AADA,EAAY,EAAK,GACjB,EAAW,EAAI,IAAI;MACrB;MACA,WAAW,EACT,4IACA,IACI,qCACA,wEACN;gBAZF,CAcE,kBAAC,GAAD,EAAM,WAAW,EAAG,WAAW,KAAU,aAAa,EAAI,CAAA,GACzD,EAAI,KACC;QACN,GAlBK,EAAI,EAkBT;IAER,CAAC;GACC,CAAA,CACc;;CACT,CAAA,CACb,EAAA,CAAA;AAEN,GAGM,KAAiE,EAAE,QAAK,iBAAc;CAC1F,IAAM,EAAE,eAAY,EAAiB;CAErC,OAAO,kBAAC,GAAD;EAAgB;EAAa,QADrB,EAAe,GAAS,EAAI,IACP;EAAiB;CAAU,CAAA;AACjE"}
|
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { useProjects, useProject, useCreateProject, useUpdateProject, useArchiveProject, useExperiments, useExperiment, useCreateExperiment, useUpdateExperiment, useTransitionExperiment, useRuns, useStartRun, usePlanRun, useCompleteRun, useNotebookEntries, useNotebookEntry, useCreateNotebookEntry, useSignNotebookEntry, useWitnessNotebookEntry, useProtocols, useProtocol, useCreateProtocol, useUpdateProtocol, usePublishProtocol, useDatasets, useDataset, useCreateDataset, useArchiveDataset, usePipelines, useCreatePipeline, usePipelineRuns, useRunPipeline, useTransitionPipelineRun, useInventoryItems, useInventoryItem, useCreateInventoryItem, useAdjustInventory, useArchiveInventoryItem, useInstruments, useInstrument, useCreateInstrument, useCancelBooking, useAiModelCatalog, useWorkspaceAiConfig, useSetWorkspaceAiModel, useSetWorkspaceAutoPilot, useAgentRuns, useAgentRun, useSuggestProtocol, useRecommendNextRun, useOverrideAgentRun, useExperimentAiContext, useResearchAnalytics, useWorkspaceTotals, useLabRecentActivity, LabApiError, } from './useLabsOfScienceApi';
|
|
6
6
|
export { useLabActorNames, type UseLabActorNamesResult } from './useLabActorNames';
|
|
7
|
+
export { useTr } from './useTr';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/labsofscience/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAEjB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EAEvB,OAAO,EACP,WAAW,EACX,UAAU,EACV,cAAc,EAEd,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EAEvB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAElB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EAEjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,wBAAwB,EAExB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EAEvB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAEhB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EAEtB,oBAAoB,EAEpB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/labsofscience/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAEjB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EAEvB,OAAO,EACP,WAAW,EACX,UAAU,EACV,cAAc,EAEd,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EAEvB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAElB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EAEjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,wBAAwB,EAExB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EAEvB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAEhB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EAEtB,oBAAoB,EAEpB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useTr — translation hook with fallback semantics.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `useI18n().t()` so that when a key has no translation (i.e. the
|
|
5
|
+
* provider returns the key itself), the caller's English fallback is used
|
|
6
|
+
* instead. This keeps consumer call sites consistent and avoids leaking
|
|
7
|
+
* untranslated keys into the UI.
|
|
8
|
+
*
|
|
9
|
+
* Supports optional interpolation params using `{{key}}` placeholders.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const tr = useTr();
|
|
13
|
+
* return <h1>{tr('labsofscience.projects.title', 'Projects')}</h1>;
|
|
14
|
+
* return <p>{tr('labsofscience.items.selected', '{{count}} selected', { count: 5 })}</p>;
|
|
15
|
+
*/
|
|
16
|
+
export declare function useTr(): (key: string, fallback: string, params?: Record<string, string | number>) => string;
|
|
17
|
+
//# sourceMappingURL=useTr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTr.d.ts","sourceRoot":"","sources":["../../../src/labsofscience/hooks/useTr.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,IAAI,CACvB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,CAcV"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useCallback as e } from "react";
|
|
2
|
+
import { useI18n as t } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
3
|
+
//#region src/labsofscience/hooks/useTr.ts
|
|
4
|
+
function n() {
|
|
5
|
+
let { t: n } = t();
|
|
6
|
+
return e((e, t, r) => {
|
|
7
|
+
let i = n(e), a = i === e ? t : i;
|
|
8
|
+
return r ? Object.entries(r).reduce((e, [t, n]) => e.replace(RegExp(`\\{\\{${t}\\}\\}`, "g"), String(n)), a) : a;
|
|
9
|
+
}, [n]);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as useTr };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=useTr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTr.js","names":[],"sources":["../../../src/labsofscience/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * Supports optional interpolation params using `{{key}}` placeholders.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('labsofscience.projects.title', 'Projects')}</h1>;\n * return <p>{tr('labsofscience.items.selected', '{{count}} selected', { count: 5 })}</p>;\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string {\n const { t } = useI18n();\n return useCallback(\n (key: string, fallback: string, params?: Record<string, string | number>): string => {\n const translated = t(key);\n const raw = translated === key ? fallback : translated;\n if (!params) return raw;\n return Object.entries(params).reduce(\n (str, [k, v]) => str.replace(new RegExp(`\\\\{\\\\{${k}\\\\}\\\\}`, 'g'), String(v)),\n raw\n );\n },\n [t]\n );\n}\n"],"mappings":";;;AAkBA,SAAgB,IAIJ;CACV,IAAM,EAAE,SAAM,EAAQ;CACtB,OAAO,GACJ,GAAa,GAAkB,MAAqD;EACnF,IAAM,IAAa,EAAE,CAAG,GAClB,IAAM,MAAe,IAAM,IAAW;EAE5C,OADK,IACE,OAAO,QAAQ,CAAM,CAAC,CAAC,QAC3B,GAAK,CAAC,GAAG,OAAO,EAAI,QAAY,OAAO,SAAS,EAAE,SAAS,GAAG,GAAG,OAAO,CAAC,CAAC,GAC3E,CACF,IAJoB;CAKtB,GACA,CAAC,CAAC,CACJ;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverviewPage.d.ts","sourceRoot":"","sources":["../../../src/labsofscience/pages/OverviewPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"OverviewPage.d.ts","sourceRoot":"","sources":["../../../src/labsofscience/pages/OverviewPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0GH,wBAAgB,YAAY,gCAgS3B"}
|