@burdenoff/microfe-labsofscience 2026.706.1 → 2026.706.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/labsofscience/LabsOfScienceRoutes.js +11 -7
- package/dist/labsofscience/LabsOfScienceRoutes.js.map +1 -1
- package/dist/labsofscience/components/FileAttachment.js +45 -0
- package/dist/labsofscience/components/FileAttachment.js.map +1 -0
- package/dist/labsofscience/components/FileUploadField.js +90 -0
- package/dist/labsofscience/components/FileUploadField.js.map +1 -0
- package/dist/labsofscience/components/ListSearchInput.js +23 -0
- package/dist/labsofscience/components/ListSearchInput.js.map +1 -0
- package/dist/labsofscience/hooks/useLabsOfScienceApi.js +155 -61
- package/dist/labsofscience/hooks/useLabsOfScienceApi.js.map +1 -1
- package/dist/labsofscience/pages/OverviewPage.js +7 -7
- package/dist/labsofscience/pages/OverviewPage.js.map +1 -1
- package/dist/labsofscience/pages/datasets/AddDatasetVersionDialog.js +68 -60
- package/dist/labsofscience/pages/datasets/AddDatasetVersionDialog.js.map +1 -1
- package/dist/labsofscience/pages/datasets/DatasetFormDialog.js +16 -4
- package/dist/labsofscience/pages/datasets/DatasetFormDialog.js.map +1 -1
- package/dist/labsofscience/pages/datasets/DatasetsListPage.js +97 -81
- package/dist/labsofscience/pages/datasets/DatasetsListPage.js.map +1 -1
- package/dist/labsofscience/pages/experiments/ExperimentDetailPage.js +2 -1
- package/dist/labsofscience/pages/experiments/ExperimentDetailPage.js.map +1 -1
- package/dist/labsofscience/pages/experiments/ExperimentFormDialog.js +113 -66
- package/dist/labsofscience/pages/experiments/ExperimentFormDialog.js.map +1 -1
- package/dist/labsofscience/pages/experiments/ExperimentsListPage.js +69 -58
- package/dist/labsofscience/pages/experiments/ExperimentsListPage.js.map +1 -1
- package/dist/labsofscience/pages/experiments/RunDialogs.js +52 -19
- package/dist/labsofscience/pages/experiments/RunDialogs.js.map +1 -1
- package/dist/labsofscience/pages/instruments/InstrumentsListPage.js +59 -48
- package/dist/labsofscience/pages/instruments/InstrumentsListPage.js.map +1 -1
- package/dist/labsofscience/pages/inventory/InventoryFormDialog.js +126 -98
- package/dist/labsofscience/pages/inventory/InventoryFormDialog.js.map +1 -1
- package/dist/labsofscience/pages/inventory/InventoryListPage.js +100 -84
- package/dist/labsofscience/pages/inventory/InventoryListPage.js.map +1 -1
- package/dist/labsofscience/pages/notebook/NotebookEntryDetailPage.js +158 -0
- package/dist/labsofscience/pages/notebook/NotebookEntryDetailPage.js.map +1 -0
- package/dist/labsofscience/pages/notebook/NotebookEntryFormDialog.js +133 -61
- package/dist/labsofscience/pages/notebook/NotebookEntryFormDialog.js.map +1 -1
- package/dist/labsofscience/pages/notebook/NotebookListPage.js +84 -71
- package/dist/labsofscience/pages/notebook/NotebookListPage.js.map +1 -1
- package/dist/labsofscience/pages/pipelines/PipelinesPage.js +172 -85
- package/dist/labsofscience/pages/pipelines/PipelinesPage.js.map +1 -1
- package/dist/labsofscience/pages/pipelines/RunPipelineDialog.js +106 -47
- package/dist/labsofscience/pages/pipelines/RunPipelineDialog.js.map +1 -1
- package/dist/labsofscience/pages/projects/ProjectFormDialog.js +108 -55
- package/dist/labsofscience/pages/projects/ProjectFormDialog.js.map +1 -1
- package/dist/labsofscience/pages/projects/ProjectsListPage.js +69 -58
- package/dist/labsofscience/pages/projects/ProjectsListPage.js.map +1 -1
- package/dist/labsofscience/pages/protocols/ProtocolDetailPage.js +145 -129
- package/dist/labsofscience/pages/protocols/ProtocolDetailPage.js.map +1 -1
- package/dist/labsofscience/pages/protocols/ProtocolFormDialog.js +75 -72
- package/dist/labsofscience/pages/protocols/ProtocolFormDialog.js.map +1 -1
- package/dist/labsofscience/pages/protocols/ProtocolsListPage.js +70 -59
- package/dist/labsofscience/pages/protocols/ProtocolsListPage.js.map +1 -1
- package/dist/labsofscience/utils/uploadFile.js +107 -0
- package/dist/labsofscience/utils/uploadFile.js.map +1 -0
- package/dist/labsofscience/utils/useDebouncedValue.js +13 -0
- package/dist/labsofscience/utils/useDebouncedValue.js.map +1 -0
- package/package.json +1 -1
|
@@ -6,103 +6,119 @@ import { QueryBoundary as i } from "../../components/QueryStates.js";
|
|
|
6
6
|
import { useInventoryItems as a } from "../../hooks/useLabsOfScienceApi.js";
|
|
7
7
|
import { formatDateShort as o, titleCase as s } from "../../utils/formatters.js";
|
|
8
8
|
import { EmptyState as c } from "../../components/EmptyState.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { ListSearchInput as l } from "../../components/ListSearchInput.js";
|
|
10
|
+
import { useDebouncedValue as u } from "../../utils/useDebouncedValue.js";
|
|
11
|
+
import { InventoryFormDialog as d } from "./InventoryFormDialog.js";
|
|
12
|
+
import { useState as f } from "react";
|
|
13
|
+
import { Boxes as p, Plus as m } from "lucide-react";
|
|
14
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
15
|
+
import { Button as v, Pagination as y, ResponsiveTable as b, Select as x, SelectContent as S, SelectItem as C, SelectTrigger as w, SelectValue as T } from "@burdenoff/fe-libs/ui";
|
|
14
16
|
//#region src/labsofscience/pages/inventory/InventoryListPage.tsx
|
|
15
|
-
var
|
|
17
|
+
var E = 20, D = [
|
|
16
18
|
"REAGENT",
|
|
17
19
|
"CONSUMABLE",
|
|
18
20
|
"SAMPLE",
|
|
19
21
|
"CHEMICAL",
|
|
20
22
|
"BIOLOGICAL",
|
|
21
23
|
"EQUIPMENT_PART"
|
|
22
|
-
],
|
|
24
|
+
], O = [
|
|
23
25
|
"IN_STOCK",
|
|
24
26
|
"LOW",
|
|
25
27
|
"OUT_OF_STOCK",
|
|
26
28
|
"EXPIRED",
|
|
27
29
|
"QUARANTINED"
|
|
28
30
|
];
|
|
29
|
-
function
|
|
30
|
-
let { navigateTo:
|
|
31
|
-
category:
|
|
32
|
-
status:
|
|
31
|
+
function k() {
|
|
32
|
+
let { navigateTo: k } = e(), [A, j] = f(1), [M, N] = f("ALL"), [P, F] = f("ALL"), [I, L] = f(""), [R, z] = f(!1), B = u(I.trim()), V = a({
|
|
33
|
+
category: M === "ALL" ? void 0 : M,
|
|
34
|
+
status: P === "ALL" ? void 0 : P,
|
|
35
|
+
search: B || void 0,
|
|
33
36
|
pagination: {
|
|
34
|
-
limit:
|
|
35
|
-
offset: (
|
|
37
|
+
limit: E,
|
|
38
|
+
offset: (A - 1) * E
|
|
36
39
|
}
|
|
37
|
-
}),
|
|
38
|
-
return /* @__PURE__ */
|
|
40
|
+
}), H = V.data?.items ?? [], U = V.data?.pageInfo.hasMore ?? !1;
|
|
41
|
+
return /* @__PURE__ */ _(n, {
|
|
39
42
|
title: "Inventory",
|
|
40
43
|
description: "Reagents, samples, and consumables with auto-derived stock status.",
|
|
41
|
-
actions: /* @__PURE__ */
|
|
42
|
-
onClick: () =>
|
|
43
|
-
children: [/* @__PURE__ */ m
|
|
44
|
+
actions: /* @__PURE__ */ _(v, {
|
|
45
|
+
onClick: () => z(!0),
|
|
46
|
+
children: [/* @__PURE__ */ g(m, { className: "mr-2 h-4 w-4" }), "New item"]
|
|
44
47
|
}),
|
|
45
|
-
children: [/* @__PURE__ */
|
|
48
|
+
children: [/* @__PURE__ */ _("div", {
|
|
46
49
|
className: "space-y-4",
|
|
47
|
-
children: [/* @__PURE__ */
|
|
50
|
+
children: [/* @__PURE__ */ _("div", {
|
|
48
51
|
className: "flex flex-wrap items-center gap-3",
|
|
49
|
-
children: [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
value:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ g(l, {
|
|
54
|
+
value: I,
|
|
55
|
+
ariaLabel: "Search inventory",
|
|
56
|
+
placeholder: "Search inventory…",
|
|
57
|
+
onChange: (e) => {
|
|
58
|
+
L(e), j(1);
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ _(x, {
|
|
62
|
+
value: M,
|
|
63
|
+
onValueChange: (e) => {
|
|
64
|
+
N(e), j(1);
|
|
65
|
+
},
|
|
66
|
+
children: [/* @__PURE__ */ g(w, {
|
|
67
|
+
className: "w-48",
|
|
68
|
+
"aria-label": "Filter by category",
|
|
69
|
+
children: /* @__PURE__ */ g(T, { placeholder: "All categories" })
|
|
70
|
+
}), /* @__PURE__ */ _(S, { children: [/* @__PURE__ */ g(C, {
|
|
71
|
+
value: "ALL",
|
|
72
|
+
children: "All categories"
|
|
73
|
+
}), D.map((e) => /* @__PURE__ */ g(C, {
|
|
74
|
+
value: e,
|
|
75
|
+
children: s(e)
|
|
76
|
+
}, e))] })]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ _(x, {
|
|
79
|
+
value: P,
|
|
80
|
+
onValueChange: (e) => {
|
|
81
|
+
F(e), j(1);
|
|
82
|
+
},
|
|
83
|
+
children: [/* @__PURE__ */ g(w, {
|
|
84
|
+
className: "w-48",
|
|
85
|
+
"aria-label": "Filter by status",
|
|
86
|
+
children: /* @__PURE__ */ g(T, { placeholder: "All statuses" })
|
|
87
|
+
}), /* @__PURE__ */ _(S, { children: [/* @__PURE__ */ g(C, {
|
|
88
|
+
value: "ALL",
|
|
89
|
+
children: "All statuses"
|
|
90
|
+
}), O.map((e) => /* @__PURE__ */ g(C, {
|
|
91
|
+
value: e,
|
|
92
|
+
children: s(e)
|
|
93
|
+
}, e))] })]
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
}), /* @__PURE__ */ g(i, {
|
|
97
|
+
isLoading: V.isLoading,
|
|
98
|
+
isError: V.isError,
|
|
99
|
+
error: V.error,
|
|
100
|
+
onRetry: () => void V.refetch(),
|
|
85
101
|
loadingLabel: "Loading inventory…",
|
|
86
|
-
children:
|
|
87
|
-
icon: /* @__PURE__ */
|
|
102
|
+
children: H.length === 0 ? /* @__PURE__ */ g(c, {
|
|
103
|
+
icon: /* @__PURE__ */ g(p, { className: "h-10 w-10" }),
|
|
88
104
|
title: "No inventory items found",
|
|
89
105
|
description: "Register your first reagent or sample to start tracking stock.",
|
|
90
|
-
action: /* @__PURE__ */
|
|
91
|
-
onClick: () =>
|
|
92
|
-
children: [/* @__PURE__ */ m
|
|
106
|
+
action: /* @__PURE__ */ _(v, {
|
|
107
|
+
onClick: () => z(!0),
|
|
108
|
+
children: [/* @__PURE__ */ g(m, { className: "mr-2 h-4 w-4" }), "New item"]
|
|
93
109
|
})
|
|
94
|
-
}) : /* @__PURE__ */ h
|
|
110
|
+
}) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(b, {
|
|
95
111
|
columns: [
|
|
96
112
|
{
|
|
97
113
|
key: "name",
|
|
98
114
|
header: "Item",
|
|
99
115
|
priority: "primary",
|
|
100
|
-
cell: (e) => /* @__PURE__ */
|
|
116
|
+
cell: (e) => /* @__PURE__ */ _("div", {
|
|
101
117
|
className: "min-w-0",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ g("p", {
|
|
103
119
|
className: "truncate font-medium text-text-primary",
|
|
104
120
|
children: e.name
|
|
105
|
-
}), e.catalogNumber && /* @__PURE__ */
|
|
121
|
+
}), e.catalogNumber && /* @__PURE__ */ g("p", {
|
|
106
122
|
className: "text-xs text-text-tertiary",
|
|
107
123
|
children: e.catalogNumber
|
|
108
124
|
})]
|
|
@@ -111,7 +127,7 @@ function D() {
|
|
|
111
127
|
{
|
|
112
128
|
key: "category",
|
|
113
129
|
header: "Category",
|
|
114
|
-
cell: (e) => /* @__PURE__ */
|
|
130
|
+
cell: (e) => /* @__PURE__ */ g("span", {
|
|
115
131
|
className: "text-text-secondary",
|
|
116
132
|
children: s(e.category)
|
|
117
133
|
})
|
|
@@ -119,7 +135,7 @@ function D() {
|
|
|
119
135
|
{
|
|
120
136
|
key: "quantity",
|
|
121
137
|
header: "Quantity",
|
|
122
|
-
cell: (e) => /* @__PURE__ */
|
|
138
|
+
cell: (e) => /* @__PURE__ */ _("span", {
|
|
123
139
|
className: t("tabular-nums", e.quantity <= e.reorderLevel ? "text-status-warning-text" : "text-text-secondary"),
|
|
124
140
|
children: [
|
|
125
141
|
e.quantity,
|
|
@@ -132,13 +148,13 @@ function D() {
|
|
|
132
148
|
key: "status",
|
|
133
149
|
header: "Status",
|
|
134
150
|
priority: "primary",
|
|
135
|
-
cell: (e) => /* @__PURE__ */
|
|
151
|
+
cell: (e) => /* @__PURE__ */ g(r, { status: e.status })
|
|
136
152
|
},
|
|
137
153
|
{
|
|
138
154
|
key: "location",
|
|
139
155
|
header: "Location",
|
|
140
156
|
priority: "hidden-on-mobile",
|
|
141
|
-
cell: (e) => /* @__PURE__ */
|
|
157
|
+
cell: (e) => /* @__PURE__ */ g("span", {
|
|
142
158
|
className: "text-text-secondary",
|
|
143
159
|
children: e.location ?? "—"
|
|
144
160
|
})
|
|
@@ -147,32 +163,32 @@ function D() {
|
|
|
147
163
|
key: "updatedAt",
|
|
148
164
|
header: "Updated",
|
|
149
165
|
priority: "hidden-on-mobile",
|
|
150
|
-
cell: (e) => /* @__PURE__ */
|
|
166
|
+
cell: (e) => /* @__PURE__ */ g("span", {
|
|
151
167
|
className: "text-text-secondary",
|
|
152
168
|
children: o(e.updatedAt)
|
|
153
169
|
})
|
|
154
170
|
}
|
|
155
171
|
],
|
|
156
|
-
data:
|
|
172
|
+
data: H,
|
|
157
173
|
rowKey: (e) => e.id,
|
|
158
|
-
onRowClick: (e) =>
|
|
159
|
-
}), /* @__PURE__ */
|
|
160
|
-
page:
|
|
161
|
-
pageSize:
|
|
162
|
-
hasNextPage:
|
|
163
|
-
hasPreviousPage:
|
|
164
|
-
loading:
|
|
165
|
-
onPageChange:
|
|
174
|
+
onRowClick: (e) => k(`inventory/${e.id}`)
|
|
175
|
+
}), /* @__PURE__ */ g(y, {
|
|
176
|
+
page: A,
|
|
177
|
+
pageSize: E,
|
|
178
|
+
hasNextPage: U,
|
|
179
|
+
hasPreviousPage: A > 1,
|
|
180
|
+
loading: V.isFetching,
|
|
181
|
+
onPageChange: j
|
|
166
182
|
})] })
|
|
167
183
|
})]
|
|
168
|
-
}), /* @__PURE__ */
|
|
169
|
-
open:
|
|
170
|
-
onOpenChange:
|
|
171
|
-
onSaved: (e) =>
|
|
184
|
+
}), /* @__PURE__ */ g(d, {
|
|
185
|
+
open: R,
|
|
186
|
+
onOpenChange: z,
|
|
187
|
+
onSaved: (e) => k(`inventory/${e.id}`)
|
|
172
188
|
})]
|
|
173
189
|
});
|
|
174
190
|
}
|
|
175
191
|
//#endregion
|
|
176
|
-
export {
|
|
192
|
+
export { k as InventoryListPage };
|
|
177
193
|
|
|
178
194
|
//# sourceMappingURL=InventoryListPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InventoryListPage.js","names":[],"sources":["../../../../src/labsofscience/pages/inventory/InventoryListPage.tsx"],"sourcesContent":["/**\n * Inventory list page\n * @module labsofscience/pages/inventory\n */\n\nimport { useState } from 'react';\nimport { Boxes, Plus } from 'lucide-react';\nimport {\n Button,\n Pagination,\n ResponsiveTable,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n type ResponsiveTableColumn,\n} from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { QueryBoundary } from '../../components/QueryStates';\nimport { useLabsOfScience } from '../../context/LabsOfScienceContext';\nimport { useInventoryItems } from '../../hooks/useLabsOfScienceApi';\nimport type { LabInventoryCategory, LabInventoryItem, LabInventoryStatus } from '../../types';\nimport { formatDateShort, titleCase } from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport { InventoryFormDialog } from './InventoryFormDialog';\n\nconst PAGE_SIZE = 20;\nconst CATEGORY_OPTIONS: LabInventoryCategory[] = [\n 'REAGENT',\n 'CONSUMABLE',\n 'SAMPLE',\n 'CHEMICAL',\n 'BIOLOGICAL',\n 'EQUIPMENT_PART',\n];\nconst STATUS_OPTIONS: LabInventoryStatus[] = [\n 'IN_STOCK',\n 'LOW',\n 'OUT_OF_STOCK',\n 'EXPIRED',\n 'QUARANTINED',\n];\n\nexport function InventoryListPage() {\n const { navigateTo } = useLabsOfScience();\n const [page, setPage] = useState(1);\n const [category, setCategory] = useState<LabInventoryCategory | 'ALL'>('ALL');\n const [status, setStatus] = useState<LabInventoryStatus | 'ALL'>('ALL');\n const [createOpen, setCreateOpen] = useState(false);\n\n const query = useInventoryItems({\n category: category === 'ALL' ? undefined : category,\n status: status === 'ALL' ? undefined : status,\n pagination: { limit: PAGE_SIZE, offset: (page - 1) * PAGE_SIZE },\n });\n\n const items = query.data?.items ?? [];\n const hasMore = query.data?.pageInfo.hasMore ?? false;\n\n const columns: ResponsiveTableColumn<LabInventoryItem>[] = [\n {\n key: 'name',\n header: 'Item',\n priority: 'primary',\n cell: (row) => (\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium text-text-primary\">{row.name}</p>\n {row.catalogNumber && <p className=\"text-xs text-text-tertiary\">{row.catalogNumber}</p>}\n </div>\n ),\n },\n {\n key: 'category',\n header: 'Category',\n cell: (row) => <span className=\"text-text-secondary\">{titleCase(row.category)}</span>,\n },\n {\n key: 'quantity',\n header: 'Quantity',\n cell: (row) => (\n <span\n className={cn(\n 'tabular-nums',\n row.quantity <= row.reorderLevel ? 'text-status-warning-text' : 'text-text-secondary'\n )}\n >\n {row.quantity} {row.unit}\n </span>\n ),\n },\n {\n key: 'status',\n header: 'Status',\n priority: 'primary',\n cell: (row) => <StatusBadge status={row.status} />,\n },\n {\n key: 'location',\n header: 'Location',\n priority: 'hidden-on-mobile',\n cell: (row) => <span className=\"text-text-secondary\">{row.location ?? '—'}</span>,\n },\n {\n key: 'updatedAt',\n header: 'Updated',\n priority: 'hidden-on-mobile',\n cell: (row) => <span className=\"text-text-secondary\">{formatDateShort(row.updatedAt)}</span>,\n },\n ];\n\n return (\n <PageLayout\n title=\"Inventory\"\n description=\"Reagents, samples, and consumables with auto-derived stock status.\"\n actions={\n <Button onClick={() => setCreateOpen(true)}>\n <Plus className=\"mr-2 h-4 w-4\" />\n New item\n </Button>\n }\n >\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <Select\n value={category}\n onValueChange={(value) => {\n setCategory(value as LabInventoryCategory | 'ALL');\n setPage(1);\n }}\n >\n <SelectTrigger className=\"w-48\">\n <SelectValue placeholder=\"All categories\" />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"ALL\">All categories</SelectItem>\n {CATEGORY_OPTIONS.map((option) => (\n <SelectItem key={option} value={option}>\n {titleCase(option)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <Select\n value={status}\n onValueChange={(value) => {\n setStatus(value as LabInventoryStatus | 'ALL');\n setPage(1);\n }}\n >\n <SelectTrigger className=\"w-48\">\n <SelectValue placeholder=\"All statuses\" />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"ALL\">All statuses</SelectItem>\n {STATUS_OPTIONS.map((option) => (\n <SelectItem key={option} value={option}>\n {titleCase(option)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <QueryBoundary\n isLoading={query.isLoading}\n isError={query.isError}\n error={query.error}\n onRetry={() => void query.refetch()}\n loadingLabel=\"Loading inventory…\"\n >\n {items.length === 0 ? (\n <EmptyState\n icon={<Boxes className=\"h-10 w-10\" />}\n title=\"No inventory items found\"\n description=\"Register your first reagent or sample to start tracking stock.\"\n action={\n <Button onClick={() => setCreateOpen(true)}>\n <Plus className=\"mr-2 h-4 w-4\" />\n New item\n </Button>\n }\n />\n ) : (\n <>\n <ResponsiveTable\n columns={columns}\n data={items}\n rowKey={(row) => row.id}\n onRowClick={(row) => navigateTo(`inventory/${row.id}`)}\n />\n <Pagination\n page={page}\n pageSize={PAGE_SIZE}\n hasNextPage={hasMore}\n hasPreviousPage={page > 1}\n loading={query.isFetching}\n onPageChange={setPage}\n />\n </>\n )}\n </QueryBoundary>\n </div>\n\n <InventoryFormDialog\n open={createOpen}\n onOpenChange={setCreateOpen}\n onSaved={(item) => navigateTo(`inventory/${item.id}`)}\n />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA6BA,IAAM,IAAY,IACZ,IAA2C;CAC/C;CACA;CACA;CACA;CACA;CACA;CACD,EACK,IAAuC;CAC3C;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,IAAoB;CAClC,IAAM,EAAE,kBAAe,GAAkB,EACnC,CAAC,GAAM,KAAW,EAAS,EAAE,EAC7B,CAAC,GAAU,KAAe,EAAuC,MAAM,EACvE,CAAC,GAAQ,KAAa,EAAqC,MAAM,EACjE,CAAC,GAAY,KAAiB,EAAS,GAAM,EAE7C,IAAQ,EAAkB;EAC9B,UAAU,MAAa,QAAQ,KAAA,IAAY;EAC3C,QAAQ,MAAW,QAAQ,KAAA,IAAY;EACvC,YAAY;GAAE,OAAO;GAAW,SAAS,IAAO,KAAK;GAAW;EACjE,CAAC,EAEI,IAAQ,EAAM,MAAM,SAAS,EAAE,EAC/B,IAAU,EAAM,MAAM,SAAS,WAAW;AAqDhD,QACE,kBAAC,GAAD;EACE,OAAM;EACN,aAAY;EACZ,SACE,kBAAC,GAAD;GAAQ,eAAe,EAAc,GAAK;aAA1C,CACE,kBAAC,GAAD,EAAM,WAAU,gBAAiB,CAAA,EAAA,WAE1B;;YAPb,CAUE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,CACS"}
|
|
1
|
+
{"version":3,"file":"InventoryListPage.js","names":[],"sources":["../../../../src/labsofscience/pages/inventory/InventoryListPage.tsx"],"sourcesContent":["/**\n * Inventory list page\n * @module labsofscience/pages/inventory\n */\n\nimport { useState } from 'react';\nimport { Boxes, Plus } from 'lucide-react';\nimport {\n Button,\n Pagination,\n ResponsiveTable,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n type ResponsiveTableColumn,\n} from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { QueryBoundary } from '../../components/QueryStates';\nimport { ListSearchInput } from '../../components/ListSearchInput';\nimport { useLabsOfScience } from '../../context/LabsOfScienceContext';\nimport { useInventoryItems } from '../../hooks/useLabsOfScienceApi';\nimport type { LabInventoryCategory, LabInventoryItem, LabInventoryStatus } from '../../types';\nimport { formatDateShort, titleCase } from '../../utils/formatters';\nimport { useDebouncedValue } from '../../utils/useDebouncedValue';\nimport { cn } from '../../utils/cn';\nimport { InventoryFormDialog } from './InventoryFormDialog';\n\nconst PAGE_SIZE = 20;\nconst CATEGORY_OPTIONS: LabInventoryCategory[] = [\n 'REAGENT',\n 'CONSUMABLE',\n 'SAMPLE',\n 'CHEMICAL',\n 'BIOLOGICAL',\n 'EQUIPMENT_PART',\n];\nconst STATUS_OPTIONS: LabInventoryStatus[] = [\n 'IN_STOCK',\n 'LOW',\n 'OUT_OF_STOCK',\n 'EXPIRED',\n 'QUARANTINED',\n];\n\nexport function InventoryListPage() {\n const { navigateTo } = useLabsOfScience();\n const [page, setPage] = useState(1);\n const [category, setCategory] = useState<LabInventoryCategory | 'ALL'>('ALL');\n const [status, setStatus] = useState<LabInventoryStatus | 'ALL'>('ALL');\n const [search, setSearch] = useState('');\n const [createOpen, setCreateOpen] = useState(false);\n const debouncedSearch = useDebouncedValue(search.trim());\n\n const query = useInventoryItems({\n category: category === 'ALL' ? undefined : category,\n status: status === 'ALL' ? undefined : status,\n search: debouncedSearch || undefined,\n pagination: { limit: PAGE_SIZE, offset: (page - 1) * PAGE_SIZE },\n });\n\n const items = query.data?.items ?? [];\n const hasMore = query.data?.pageInfo.hasMore ?? false;\n\n const columns: ResponsiveTableColumn<LabInventoryItem>[] = [\n {\n key: 'name',\n header: 'Item',\n priority: 'primary',\n cell: (row) => (\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium text-text-primary\">{row.name}</p>\n {row.catalogNumber && <p className=\"text-xs text-text-tertiary\">{row.catalogNumber}</p>}\n </div>\n ),\n },\n {\n key: 'category',\n header: 'Category',\n cell: (row) => <span className=\"text-text-secondary\">{titleCase(row.category)}</span>,\n },\n {\n key: 'quantity',\n header: 'Quantity',\n cell: (row) => (\n <span\n className={cn(\n 'tabular-nums',\n row.quantity <= row.reorderLevel ? 'text-status-warning-text' : 'text-text-secondary'\n )}\n >\n {row.quantity} {row.unit}\n </span>\n ),\n },\n {\n key: 'status',\n header: 'Status',\n priority: 'primary',\n cell: (row) => <StatusBadge status={row.status} />,\n },\n {\n key: 'location',\n header: 'Location',\n priority: 'hidden-on-mobile',\n cell: (row) => <span className=\"text-text-secondary\">{row.location ?? '—'}</span>,\n },\n {\n key: 'updatedAt',\n header: 'Updated',\n priority: 'hidden-on-mobile',\n cell: (row) => <span className=\"text-text-secondary\">{formatDateShort(row.updatedAt)}</span>,\n },\n ];\n\n return (\n <PageLayout\n title=\"Inventory\"\n description=\"Reagents, samples, and consumables with auto-derived stock status.\"\n actions={\n <Button onClick={() => setCreateOpen(true)}>\n <Plus className=\"mr-2 h-4 w-4\" />\n New item\n </Button>\n }\n >\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <ListSearchInput\n value={search}\n ariaLabel=\"Search inventory\"\n placeholder=\"Search inventory…\"\n onChange={(value) => {\n setSearch(value);\n setPage(1);\n }}\n />\n <Select\n value={category}\n onValueChange={(value) => {\n setCategory(value as LabInventoryCategory | 'ALL');\n setPage(1);\n }}\n >\n <SelectTrigger className=\"w-48\" aria-label=\"Filter by category\">\n <SelectValue placeholder=\"All categories\" />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"ALL\">All categories</SelectItem>\n {CATEGORY_OPTIONS.map((option) => (\n <SelectItem key={option} value={option}>\n {titleCase(option)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <Select\n value={status}\n onValueChange={(value) => {\n setStatus(value as LabInventoryStatus | 'ALL');\n setPage(1);\n }}\n >\n <SelectTrigger className=\"w-48\" aria-label=\"Filter by status\">\n <SelectValue placeholder=\"All statuses\" />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"ALL\">All statuses</SelectItem>\n {STATUS_OPTIONS.map((option) => (\n <SelectItem key={option} value={option}>\n {titleCase(option)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <QueryBoundary\n isLoading={query.isLoading}\n isError={query.isError}\n error={query.error}\n onRetry={() => void query.refetch()}\n loadingLabel=\"Loading inventory…\"\n >\n {items.length === 0 ? (\n <EmptyState\n icon={<Boxes className=\"h-10 w-10\" />}\n title=\"No inventory items found\"\n description=\"Register your first reagent or sample to start tracking stock.\"\n action={\n <Button onClick={() => setCreateOpen(true)}>\n <Plus className=\"mr-2 h-4 w-4\" />\n New item\n </Button>\n }\n />\n ) : (\n <>\n <ResponsiveTable\n columns={columns}\n data={items}\n rowKey={(row) => row.id}\n onRowClick={(row) => navigateTo(`inventory/${row.id}`)}\n />\n <Pagination\n page={page}\n pageSize={PAGE_SIZE}\n hasNextPage={hasMore}\n hasPreviousPage={page > 1}\n loading={query.isFetching}\n onPageChange={setPage}\n />\n </>\n )}\n </QueryBoundary>\n </div>\n\n <InventoryFormDialog\n open={createOpen}\n onOpenChange={setCreateOpen}\n onSaved={(item) => navigateTo(`inventory/${item.id}`)}\n />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,IAAM,IAAY,IACZ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E,KAAK;OACL,QAAQ;OACR,OAAO,MAAQ,kBAAC,QAAD;QAAM,WAAU;kBAAuB,EAAU,EAAI,SAAS;QAAQ,CAAA;OACtF;MACD;OACE,KAAK;OACL,QAAQ;OACR,OAAO,MACL,kBAAC,QAAD;QACE,WAAW,EACT,gBACA,EAAI,YAAY,EAAI,eAAe,6BAA6B,sBACjE;kBAJH;SAMG,EAAI;SAAS;SAAE,EAAI;SACf;;OAEV;MACD;OACE,KAAK;OACL,QAAQ;OACR,UAAU;OACV,OAAO,MAAQ,kBAAC,GAAD,EAAa,QAAQ,EAAI,QAAU,CAAA;OACnD;MACD;OACE,KAAK;OACL,QAAQ;OACR,UAAU;OACV,OAAO,MAAQ,kBAAC,QAAD;QAAM,WAAU;kBAAuB,EAAI,YAAY;QAAW,CAAA;OAClF;MACD;OACE,KAAK;OACL,QAAQ;OACR,UAAU;OACV,OAAO,MAAQ,kBAAC,QAAD;QAAM,WAAU;kBAAuB,EAAgB,EAAI,UAAU;QAAQ,CAAA;OAC7F;MACF;KAuFa,MAAM;KACN,SAAS,MAAQ,EAAI;KACrB,aAAa,MAAQ,EAAW,aAAa,EAAI,KAAK;KACtD,CAAA,EACF,kBAAC,GAAD;KACQ;KACN,UAAU;KACV,aAAa;KACb,iBAAiB,IAAO;KACxB,SAAS,EAAM;KACf,cAAc;KACd,CAAA,CACD,EAAA,CAAA;IAES,CAAA,CACZ;MAEN,kBAAC,GAAD;GACE,MAAM;GACN,cAAc;GACd,UAAU,MAAS,EAAW,aAAa,EAAK,KAAK;GACrD,CAAA,CACS"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { useLabsOfScience as e } from "../../context/LabsOfScienceContext.js";
|
|
2
|
+
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
|
+
import { StatusBadge as n } from "../../components/StatusBadge.js";
|
|
4
|
+
import { QueryBoundary as r } from "../../components/QueryStates.js";
|
|
5
|
+
import { useNotebookEntry as i, useSignNotebookEntry as a, useWitnessNotebookEntry as o } from "../../hooks/useLabsOfScienceApi.js";
|
|
6
|
+
import { formatDate as s } from "../../utils/formatters.js";
|
|
7
|
+
import { EmptyState as c } from "../../components/EmptyState.js";
|
|
8
|
+
import { BackLink as l, DetailField as u, DetailSection as d, TagList as f } from "../shared/DetailComponents.js";
|
|
9
|
+
import { FileAttachment as p } from "../../components/FileAttachment.js";
|
|
10
|
+
import { BookOpen as m, FlaskConical as h, PenLine as g, ShieldCheck as _ } from "lucide-react";
|
|
11
|
+
import { useParams as v } from "react-router-dom";
|
|
12
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
13
|
+
import { Button as x } from "@burdenoff/fe-libs/ui";
|
|
14
|
+
import { useActorProfiles as S } from "@burdenoff/fe-libs/shared";
|
|
15
|
+
//#region src/labsofscience/pages/notebook/NotebookEntryDetailPage.tsx
|
|
16
|
+
var C = new Set(["DRAFT", "SUBMITTED"]);
|
|
17
|
+
function w() {
|
|
18
|
+
let { id: w } = v(), { navigateTo: T, workspaceId: E } = e(), D = i(w), O = a(), k = o(), A = D.data, j = S([
|
|
19
|
+
A?.authorId,
|
|
20
|
+
A?.signedById,
|
|
21
|
+
A?.witnessedById
|
|
22
|
+
].filter((e) => !!e).map((e) => ({
|
|
23
|
+
actorId: e,
|
|
24
|
+
actorType: "user"
|
|
25
|
+
})), { workspaceId: E }), M = (e) => e ? j[e]?.displayName ?? e : "—", N = A ? C.has(A.status) : !1, P = A?.status === "SIGNED";
|
|
26
|
+
return /* @__PURE__ */ y(t, {
|
|
27
|
+
title: A?.title ?? "Notebook entry",
|
|
28
|
+
description: A ? `Entry ${A.id.slice(0, 8)}…` : void 0,
|
|
29
|
+
actions: A ? /* @__PURE__ */ b("div", {
|
|
30
|
+
className: "flex items-center gap-2",
|
|
31
|
+
children: [N && /* @__PURE__ */ b(x, {
|
|
32
|
+
onClick: () => void O.mutateAsync(A.id),
|
|
33
|
+
disabled: O.isPending,
|
|
34
|
+
children: [/* @__PURE__ */ y(g, { className: "mr-2 h-4 w-4" }), O.isPending ? "Signing…" : "Sign"]
|
|
35
|
+
}), P && /* @__PURE__ */ b(x, {
|
|
36
|
+
variant: "outline",
|
|
37
|
+
onClick: () => void k.mutateAsync(A.id),
|
|
38
|
+
disabled: k.isPending,
|
|
39
|
+
children: [/* @__PURE__ */ y(_, { className: "mr-2 h-4 w-4" }), k.isPending ? "Witnessing…" : "Witness"]
|
|
40
|
+
})]
|
|
41
|
+
}) : void 0,
|
|
42
|
+
children: /* @__PURE__ */ b("div", {
|
|
43
|
+
className: "space-y-4",
|
|
44
|
+
children: [/* @__PURE__ */ y(l, {
|
|
45
|
+
label: "Lab notebook",
|
|
46
|
+
onClick: () => T("notebook")
|
|
47
|
+
}), /* @__PURE__ */ y(r, {
|
|
48
|
+
isLoading: D.isLoading,
|
|
49
|
+
isError: D.isError,
|
|
50
|
+
error: D.error,
|
|
51
|
+
onRetry: () => void D.refetch(),
|
|
52
|
+
loadingLabel: "Loading notebook entry…",
|
|
53
|
+
children: A ? /* @__PURE__ */ b("div", {
|
|
54
|
+
className: "space-y-6",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ y(d, {
|
|
57
|
+
title: "Overview",
|
|
58
|
+
children: /* @__PURE__ */ b("dl", {
|
|
59
|
+
className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ y(u, {
|
|
62
|
+
label: "Status",
|
|
63
|
+
children: /* @__PURE__ */ y(n, { status: A.status })
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ y(u, {
|
|
66
|
+
label: "Author",
|
|
67
|
+
children: M(A.authorId)
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ y(u, {
|
|
70
|
+
label: "Created",
|
|
71
|
+
children: s(A.createdAt)
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ y(u, {
|
|
74
|
+
label: "Experiment",
|
|
75
|
+
children: A.experimentId ? /* @__PURE__ */ b("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
className: "inline-flex items-center gap-1 text-text-link hover:underline",
|
|
78
|
+
onClick: () => T(`experiments/${A.experimentId}`),
|
|
79
|
+
children: [/* @__PURE__ */ y(h, { className: "h-3.5 w-3.5" }), "Open experiment"]
|
|
80
|
+
}) : "—"
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ y(u, {
|
|
83
|
+
label: "Run",
|
|
84
|
+
children: A.runId ? /* @__PURE__ */ b("span", {
|
|
85
|
+
className: "font-mono text-xs",
|
|
86
|
+
children: [A.runId.slice(0, 8), "…"]
|
|
87
|
+
}) : "—"
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ y(u, {
|
|
90
|
+
label: "Updated",
|
|
91
|
+
children: s(A.updatedAt)
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ y(u, {
|
|
94
|
+
label: "Tags",
|
|
95
|
+
className: "col-span-2 sm:col-span-3",
|
|
96
|
+
children: /* @__PURE__ */ y(f, { tags: A.tags })
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ y(d, {
|
|
102
|
+
title: "Record",
|
|
103
|
+
children: A.body ? /* @__PURE__ */ y("p", {
|
|
104
|
+
className: "whitespace-pre-wrap break-words text-sm text-text-primary",
|
|
105
|
+
children: A.body
|
|
106
|
+
}) : /* @__PURE__ */ y("p", {
|
|
107
|
+
className: "text-sm text-text-secondary",
|
|
108
|
+
children: "No body recorded."
|
|
109
|
+
})
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ y(d, {
|
|
112
|
+
title: "Integrity",
|
|
113
|
+
children: /* @__PURE__ */ b("dl", {
|
|
114
|
+
className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3",
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ y(u, {
|
|
117
|
+
label: "Signed by",
|
|
118
|
+
children: A.signedById ? M(A.signedById) : "Not signed"
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ y(u, {
|
|
121
|
+
label: "Signed at",
|
|
122
|
+
children: A.signedAt ? s(A.signedAt) : "—"
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ y(u, {
|
|
125
|
+
label: "Witnessed by",
|
|
126
|
+
children: A.witnessedById ? M(A.witnessedById) : "Not witnessed"
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ y(u, {
|
|
129
|
+
label: "Witnessed at",
|
|
130
|
+
children: A.witnessedAt ? s(A.witnessedAt) : "—"
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ y(d, {
|
|
136
|
+
title: `Attachments (${A.files.length})`,
|
|
137
|
+
children: A.files.length === 0 ? /* @__PURE__ */ y("p", {
|
|
138
|
+
className: "py-2 text-sm text-text-secondary",
|
|
139
|
+
children: "No files attached."
|
|
140
|
+
}) : /* @__PURE__ */ y("div", {
|
|
141
|
+
className: "space-y-2",
|
|
142
|
+
children: A.files.map((e) => /* @__PURE__ */ y(p, { fileId: e.id }, e.id))
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
}) : /* @__PURE__ */ y(c, {
|
|
147
|
+
icon: /* @__PURE__ */ y(m, { className: "h-10 w-10" }),
|
|
148
|
+
title: "Notebook entry not found",
|
|
149
|
+
description: "This entry may have been voided or is outside your workspace."
|
|
150
|
+
})
|
|
151
|
+
})]
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { w as NotebookEntryDetailPage };
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=NotebookEntryDetailPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotebookEntryDetailPage.js","names":[],"sources":["../../../../src/labsofscience/pages/notebook/NotebookEntryDetailPage.tsx"],"sourcesContent":["/**\n * Notebook entry detail page\n * @module labsofscience/pages/notebook\n *\n * Shows a single ELN entry in full: body, linked experiment / run, lifecycle\n * status, the signer + witness with timestamps (record integrity), and any file\n * attachments. Draft / submitted entries can be signed (`labSignNotebookEntry`);\n * a SIGNED entry can be witnessed by a second party (`labWitnessNotebookEntry`).\n */\n\nimport { useParams } from 'react-router-dom';\nimport { BookOpen, FlaskConical, PenLine, ShieldCheck } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useActorProfiles } from '@burdenoff/fe-libs/shared';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { QueryBoundary } from '../../components/QueryStates';\nimport { FileAttachment } from '../../components/FileAttachment';\nimport { useLabsOfScience } from '../../context/LabsOfScienceContext';\nimport {\n useNotebookEntry,\n useSignNotebookEntry,\n useWitnessNotebookEntry,\n} from '../../hooks/useLabsOfScienceApi';\nimport { formatDate } from '../../utils/formatters';\nimport { DetailField, DetailSection, BackLink, TagList } from '../shared/DetailComponents';\n\nconst SIGNABLE = new Set(['DRAFT', 'SUBMITTED']);\n\nexport function NotebookEntryDetailPage() {\n const { id } = useParams<{ id: string }>();\n const { navigateTo, workspaceId } = useLabsOfScience();\n const query = useNotebookEntry(id);\n const sign = useSignNotebookEntry();\n const witness = useWitnessNotebookEntry();\n\n const entry = query.data;\n\n // Resolve author / signer / witness ids to human-friendly names. The hook\n // auto-resolves the GLOBAL gateway (do NOT pass the workspace apiGatewayUrl)\n // and falls back gracefully to a humanized id on any failure.\n const actorIds = [entry?.authorId, entry?.signedById, entry?.witnessedById].filter(\n (value): value is string => Boolean(value)\n );\n const profiles = useActorProfiles(\n actorIds.map((actorId) => ({ actorId, actorType: 'user' })),\n { workspaceId }\n );\n const nameOf = (actorId: string | null): string =>\n actorId ? (profiles[actorId]?.displayName ?? actorId) : '—';\n\n const canSign = entry ? SIGNABLE.has(entry.status) : false;\n const canWitness = entry?.status === 'SIGNED';\n\n return (\n <PageLayout\n title={entry?.title ?? 'Notebook entry'}\n description={entry ? `Entry ${entry.id.slice(0, 8)}…` : undefined}\n actions={\n entry ? (\n <div className=\"flex items-center gap-2\">\n {canSign && (\n <Button\n onClick={() => void sign.mutateAsync(entry.id)}\n disabled={sign.isPending}\n >\n <PenLine className=\"mr-2 h-4 w-4\" />\n {sign.isPending ? 'Signing…' : 'Sign'}\n </Button>\n )}\n {canWitness && (\n <Button\n variant=\"outline\"\n onClick={() => void witness.mutateAsync(entry.id)}\n disabled={witness.isPending}\n >\n <ShieldCheck className=\"mr-2 h-4 w-4\" />\n {witness.isPending ? 'Witnessing…' : 'Witness'}\n </Button>\n )}\n </div>\n ) : undefined\n }\n >\n <div className=\"space-y-4\">\n <BackLink label=\"Lab notebook\" onClick={() => navigateTo('notebook')} />\n\n <QueryBoundary\n isLoading={query.isLoading}\n isError={query.isError}\n error={query.error}\n onRetry={() => void query.refetch()}\n loadingLabel=\"Loading notebook entry…\"\n >\n {!entry ? (\n <EmptyState\n icon={<BookOpen className=\"h-10 w-10\" />}\n title=\"Notebook entry not found\"\n description=\"This entry may have been voided or is outside your workspace.\"\n />\n ) : (\n <div className=\"space-y-6\">\n <DetailSection title=\"Overview\">\n <dl className=\"grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3\">\n <DetailField label=\"Status\">\n <StatusBadge status={entry.status} />\n </DetailField>\n <DetailField label=\"Author\">{nameOf(entry.authorId)}</DetailField>\n <DetailField label=\"Created\">{formatDate(entry.createdAt)}</DetailField>\n <DetailField label=\"Experiment\">\n {entry.experimentId ? (\n <button\n type=\"button\"\n className=\"inline-flex items-center gap-1 text-text-link hover:underline\"\n onClick={() => navigateTo(`experiments/${entry.experimentId}`)}\n >\n <FlaskConical className=\"h-3.5 w-3.5\" />\n Open experiment\n </button>\n ) : (\n '—'\n )}\n </DetailField>\n <DetailField label=\"Run\">\n {entry.runId ? (\n <span className=\"font-mono text-xs\">{entry.runId.slice(0, 8)}…</span>\n ) : (\n '—'\n )}\n </DetailField>\n <DetailField label=\"Updated\">{formatDate(entry.updatedAt)}</DetailField>\n <DetailField label=\"Tags\" className=\"col-span-2 sm:col-span-3\">\n <TagList tags={entry.tags} />\n </DetailField>\n </dl>\n </DetailSection>\n\n <DetailSection title=\"Record\">\n {entry.body ? (\n <p className=\"whitespace-pre-wrap break-words text-sm text-text-primary\">\n {entry.body}\n </p>\n ) : (\n <p className=\"text-sm text-text-secondary\">No body recorded.</p>\n )}\n </DetailSection>\n\n <DetailSection title=\"Integrity\">\n <dl className=\"grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3\">\n <DetailField label=\"Signed by\">\n {entry.signedById ? nameOf(entry.signedById) : 'Not signed'}\n </DetailField>\n <DetailField label=\"Signed at\">\n {entry.signedAt ? formatDate(entry.signedAt) : '—'}\n </DetailField>\n <DetailField label=\"Witnessed by\">\n {entry.witnessedById ? nameOf(entry.witnessedById) : 'Not witnessed'}\n </DetailField>\n <DetailField label=\"Witnessed at\">\n {entry.witnessedAt ? formatDate(entry.witnessedAt) : '—'}\n </DetailField>\n </dl>\n </DetailSection>\n\n <DetailSection title={`Attachments (${entry.files.length})`}>\n {entry.files.length === 0 ? (\n <p className=\"py-2 text-sm text-text-secondary\">No files attached.</p>\n ) : (\n <div className=\"space-y-2\">\n {entry.files.map((file) => (\n <FileAttachment key={file.id} fileId={file.id} />\n ))}\n </div>\n )}\n </DetailSection>\n </div>\n )}\n </QueryBoundary>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,IAAM,IAAW,IAAI,IAAI,CAAC,SAAS,YAAY,CAAC;AAEhD,SAAgB,IAA0B;CACxC,IAAM,EAAE,UAAO,GAA2B,EACpC,EAAE,eAAY,mBAAgB,GAAkB,EAChD,IAAQ,EAAiB,EAAG,EAC5B,IAAO,GAAsB,EAC7B,IAAU,GAAyB,EAEnC,IAAQ,EAAM,MAQd,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