@burdenoff/microfe-sandbox 2026.525.3 → 2026.528.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/sandbox/components/CountdownTimer.js +39 -47
- package/dist/sandbox/components/CountdownTimer.js.map +1 -1
- package/dist/sandbox/components/ExportSandboxesDialog.js +62 -60
- package/dist/sandbox/components/ExportSandboxesDialog.js.map +1 -1
- package/dist/sandbox/components/ExtendTTLModal.js +8 -2
- package/dist/sandbox/components/ExtendTTLModal.js.map +1 -1
- package/dist/sandbox/components/FilesFolderPicker.js +53 -53
- package/dist/sandbox/components/FilesFolderPicker.js.map +1 -1
- package/dist/sandbox/components/PageLayout.js +16 -24
- package/dist/sandbox/components/PageLayout.js.map +1 -1
- package/dist/sandbox/components/RouteUtils.js +3 -3
- package/dist/sandbox/components/RouteUtils.js.map +1 -1
- package/dist/sandbox/components/SandboxActivityTab.js +0 -2
- package/dist/sandbox/components/SandboxActivityTab.js.map +1 -1
- package/dist/sandbox/components/SandboxUsageBanner.js +1 -2
- package/dist/sandbox/components/SandboxUsageBanner.js.map +1 -1
- package/dist/sandbox/components/StatusBadge.js +1 -2
- package/dist/sandbox/components/StatusBadge.js.map +1 -1
- package/dist/sandbox/components/TagsInput.js +2 -2
- package/dist/sandbox/components/TagsInput.js.map +1 -1
- package/dist/sandbox/pages/AdminPage.js +82 -78
- package/dist/sandbox/pages/AdminPage.js.map +1 -1
- package/dist/sandbox/pages/AdminTemplatesPage.js +1 -1
- package/dist/sandbox/pages/AdminTemplatesPage.js.map +1 -1
- package/dist/sandbox/pages/SandboxCreatePage.js +513 -463
- package/dist/sandbox/pages/SandboxCreatePage.js.map +1 -1
- package/dist/sandbox/pages/SandboxDetailPage.js +374 -339
- package/dist/sandbox/pages/SandboxDetailPage.js.map +1 -1
- package/dist/sandbox/pages/SandboxListPage.js +2 -1
- package/dist/sandbox/pages/SandboxListPage.js.map +1 -1
- package/dist/sandbox/pages/TemplateDetailPage.js +199 -150
- package/dist/sandbox/pages/TemplateDetailPage.js.map +1 -1
- package/dist/sandbox/pages/UserTemplatesPage.js +1 -1
- package/dist/sandbox/pages/UserTemplatesPage.js.map +1 -1
- package/dist/sandbox/providers/SandboxProvider.js +1 -1
- package/dist/sandbox/providers/SandboxProvider.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,90 +1,90 @@
|
|
|
1
1
|
import { Button as e, Input as t } from "./ui.js";
|
|
2
2
|
import { tWithFallback as n } from "../utils/i18n.js";
|
|
3
3
|
import { useSandboxCreateFolderMutation as r, useSandboxGetFoldersQuery as i } from "../../generated/wspace-operations.js";
|
|
4
|
-
import { useMemo as a,
|
|
5
|
-
import { AlertCircle as
|
|
6
|
-
import { useI18n as
|
|
7
|
-
import { jsx as
|
|
4
|
+
import { useMemo as a, useRef as o, useState as s } from "react";
|
|
5
|
+
import { AlertCircle as c, Check as l, Folder as u, FolderOpen as d, Loader2 as f, Plus as p } from "lucide-react";
|
|
6
|
+
import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
7
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
8
8
|
//#region src/sandbox/components/FilesFolderPicker.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let { t:
|
|
9
|
+
var _ = 20;
|
|
10
|
+
function v({ value: v, onChange: y }) {
|
|
11
|
+
let { t: b } = m(), x = o(0), [S, C] = s(!1), [w, T] = s(""), [E, D] = s(null), { data: O, loading: k, error: A, fetchMore: j, refetch: M } = i({
|
|
12
12
|
variables: { pagination: {
|
|
13
|
-
limit:
|
|
13
|
+
limit: _,
|
|
14
14
|
offset: 0
|
|
15
15
|
} },
|
|
16
16
|
fetchPolicy: "cache-and-network",
|
|
17
17
|
notifyOnNetworkStatusChange: !0
|
|
18
18
|
}), [N, { loading: P }] = r(), F = a(() => O?.getFolders.folders ?? [], [O]), I = O?.getFolders.hasMore ?? !1;
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ g("div", {
|
|
20
20
|
className: "space-y-3",
|
|
21
21
|
children: [
|
|
22
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ g("div", {
|
|
23
23
|
className: "flex items-center justify-between",
|
|
24
|
-
children: [/* @__PURE__ */
|
|
24
|
+
children: [/* @__PURE__ */ h("label", {
|
|
25
25
|
className: "block text-sm font-semibold",
|
|
26
|
-
children: n(
|
|
27
|
-
}),
|
|
26
|
+
children: n(b, "sandbox.create.fields.filesFolder.label", "Export folder (files-svc)")
|
|
27
|
+
}), v !== null && /* @__PURE__ */ h("button", {
|
|
28
28
|
type: "button",
|
|
29
|
-
onClick: () =>
|
|
29
|
+
onClick: () => y(null),
|
|
30
30
|
className: "text-xs text-muted-foreground hover:text-foreground transition-colors",
|
|
31
|
-
children: n(
|
|
31
|
+
children: n(b, "sandbox.create.fields.filesFolder.clear", "Clear")
|
|
32
32
|
})]
|
|
33
33
|
}),
|
|
34
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ h("p", {
|
|
35
35
|
className: "text-xs text-muted-foreground",
|
|
36
|
-
children: n(
|
|
36
|
+
children: n(b, "sandbox.create.fields.filesFolder.help", "When the sandbox stops, the volume contents are best-effort copied to this folder. Leave empty to skip export.")
|
|
37
37
|
}),
|
|
38
|
-
A && /* @__PURE__ */
|
|
38
|
+
A && /* @__PURE__ */ g("div", {
|
|
39
39
|
className: "flex items-center gap-2 text-xs text-destructive",
|
|
40
|
-
children: [/* @__PURE__ */
|
|
40
|
+
children: [/* @__PURE__ */ h(c, { className: "size-4" }), A.message]
|
|
41
41
|
}),
|
|
42
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ g("div", {
|
|
43
43
|
className: "border-2 border-border rounded-lg bg-background max-h-56 overflow-y-auto",
|
|
44
|
-
children: [k && F.length === 0 ? /* @__PURE__ */
|
|
44
|
+
children: [k && F.length === 0 ? /* @__PURE__ */ g("div", {
|
|
45
45
|
className: "flex items-center justify-center py-6 text-muted-foreground",
|
|
46
|
-
children: [/* @__PURE__ */
|
|
46
|
+
children: [/* @__PURE__ */ h(f, { className: "size-4 animate-spin mr-2" }), /* @__PURE__ */ h("span", {
|
|
47
47
|
className: "text-sm",
|
|
48
|
-
children: n(
|
|
48
|
+
children: n(b, "sandbox.create.fields.filesFolder.loading", "Loading folders…")
|
|
49
49
|
})]
|
|
50
|
-
}) : F.length === 0 ? /* @__PURE__ */
|
|
50
|
+
}) : F.length === 0 ? /* @__PURE__ */ h("div", {
|
|
51
51
|
className: "px-4 py-6 text-sm text-muted-foreground text-center",
|
|
52
|
-
children: n(
|
|
53
|
-
}) : /* @__PURE__ */
|
|
52
|
+
children: n(b, "sandbox.create.fields.filesFolder.empty", "No folders yet — create one below.")
|
|
53
|
+
}) : /* @__PURE__ */ h("ul", {
|
|
54
54
|
className: "divide-y divide-border",
|
|
55
55
|
children: F.map((e) => {
|
|
56
|
-
let t = e.id ===
|
|
57
|
-
return /* @__PURE__ */
|
|
56
|
+
let t = e.id === v;
|
|
57
|
+
return /* @__PURE__ */ h("li", { children: /* @__PURE__ */ g("button", {
|
|
58
58
|
type: "button",
|
|
59
|
-
onClick: () =>
|
|
59
|
+
onClick: () => y(e.id),
|
|
60
60
|
className: `w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-muted ${t ? "bg-primary/10" : ""}`,
|
|
61
61
|
children: [
|
|
62
|
-
t ? /* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
62
|
+
t ? /* @__PURE__ */ h(d, { className: "size-4 text-primary" }) : /* @__PURE__ */ h(u, { className: "size-4 text-muted-foreground" }),
|
|
63
|
+
/* @__PURE__ */ g("div", {
|
|
64
64
|
className: "flex-1 min-w-0",
|
|
65
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ h("p", {
|
|
66
66
|
className: "text-sm font-medium truncate",
|
|
67
67
|
children: e.name
|
|
68
|
-
}), e.path && /* @__PURE__ */
|
|
68
|
+
}), e.path && /* @__PURE__ */ h("p", {
|
|
69
69
|
className: "text-xs text-muted-foreground truncate",
|
|
70
70
|
children: e.path
|
|
71
71
|
})]
|
|
72
72
|
}),
|
|
73
|
-
t && /* @__PURE__ */
|
|
73
|
+
t && /* @__PURE__ */ h(l, { className: "size-4 text-primary" })
|
|
74
74
|
]
|
|
75
75
|
}) }, e.id);
|
|
76
76
|
})
|
|
77
|
-
}), I && /* @__PURE__ */
|
|
77
|
+
}), I && /* @__PURE__ */ h("div", {
|
|
78
78
|
className: "border-t border-border p-2",
|
|
79
|
-
children: /* @__PURE__ */
|
|
79
|
+
children: /* @__PURE__ */ g(e, {
|
|
80
80
|
type: "button",
|
|
81
81
|
variant: "ghost",
|
|
82
82
|
size: "sm",
|
|
83
83
|
onClick: async () => {
|
|
84
|
-
let e =
|
|
84
|
+
let e = x.current + _;
|
|
85
85
|
await j({
|
|
86
86
|
variables: { pagination: {
|
|
87
|
-
limit:
|
|
87
|
+
limit: _,
|
|
88
88
|
offset: e
|
|
89
89
|
} },
|
|
90
90
|
updateQuery: (e, { fetchMoreResult: t }) => t ? {
|
|
@@ -94,25 +94,25 @@ function _({ value: _, onChange: v }) {
|
|
|
94
94
|
folders: [...e.getFolders.folders, ...t.getFolders.folders]
|
|
95
95
|
}
|
|
96
96
|
} : e
|
|
97
|
-
}), x
|
|
97
|
+
}), x.current = e;
|
|
98
98
|
},
|
|
99
99
|
disabled: k,
|
|
100
100
|
className: "w-full",
|
|
101
|
-
children: [k ? /* @__PURE__ */
|
|
101
|
+
children: [k ? /* @__PURE__ */ h(f, { className: "size-3 animate-spin mr-2" }) : null, n(b, "sandbox.create.fields.filesFolder.loadMore", "Load more")]
|
|
102
102
|
})
|
|
103
103
|
})]
|
|
104
104
|
}),
|
|
105
|
-
S ? /* @__PURE__ */
|
|
105
|
+
S ? /* @__PURE__ */ g("div", {
|
|
106
106
|
className: "flex items-center gap-2",
|
|
107
107
|
children: [
|
|
108
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ h(t, {
|
|
109
109
|
value: w,
|
|
110
110
|
onChange: (e) => T(e.target.value),
|
|
111
|
-
placeholder: n(
|
|
111
|
+
placeholder: n(b, "sandbox.create.fields.filesFolder.newPlaceholder", "Folder name"),
|
|
112
112
|
className: "flex-1",
|
|
113
113
|
autoFocus: !0
|
|
114
114
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ g(e, {
|
|
116
116
|
type: "button",
|
|
117
117
|
size: "sm",
|
|
118
118
|
onClick: async () => {
|
|
@@ -121,40 +121,40 @@ function _({ value: _, onChange: v }) {
|
|
|
121
121
|
D(null);
|
|
122
122
|
try {
|
|
123
123
|
let t = (await N({ variables: { input: { name: e } } })).data?.createFolder;
|
|
124
|
-
t && (
|
|
124
|
+
t && (y(t.id), T(""), C(!1), await M());
|
|
125
125
|
} catch (e) {
|
|
126
126
|
D(e instanceof Error ? e.message : String(e));
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
130
|
disabled: P || w.trim().length === 0,
|
|
131
|
-
children: [P ? /* @__PURE__ */
|
|
131
|
+
children: [P ? /* @__PURE__ */ h(f, { className: "size-3 animate-spin mr-2" }) : null, n(b, "sandbox.create.fields.filesFolder.createConfirm", "Create")]
|
|
132
132
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ h(e, {
|
|
134
134
|
type: "button",
|
|
135
135
|
size: "sm",
|
|
136
136
|
variant: "ghost",
|
|
137
137
|
onClick: () => {
|
|
138
138
|
C(!1), T(""), D(null);
|
|
139
139
|
},
|
|
140
|
-
children: n(
|
|
140
|
+
children: n(b, "sandbox.create.fields.filesFolder.cancel", "Cancel")
|
|
141
141
|
})
|
|
142
142
|
]
|
|
143
|
-
}) : /* @__PURE__ */
|
|
143
|
+
}) : /* @__PURE__ */ g(e, {
|
|
144
144
|
type: "button",
|
|
145
145
|
variant: "outline",
|
|
146
146
|
size: "sm",
|
|
147
147
|
onClick: () => C(!0),
|
|
148
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ h(p, { className: "size-3 mr-2" }), n(b, "sandbox.create.fields.filesFolder.createNew", "Create folder")]
|
|
149
149
|
}),
|
|
150
|
-
E && /* @__PURE__ */
|
|
150
|
+
E && /* @__PURE__ */ g("div", {
|
|
151
151
|
className: "flex items-center gap-2 text-xs text-destructive",
|
|
152
|
-
children: [/* @__PURE__ */
|
|
152
|
+
children: [/* @__PURE__ */ h(c, { className: "size-4" }), E]
|
|
153
153
|
})
|
|
154
154
|
]
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
//#endregion
|
|
158
|
-
export {
|
|
158
|
+
export { v as FilesFolderPicker };
|
|
159
159
|
|
|
160
160
|
//# sourceMappingURL=FilesFolderPicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilesFolderPicker.js","names":[],"sources":["../../../src/sandbox/components/FilesFolderPicker.tsx"],"sourcesContent":["import { useState, useMemo } from 'react';\nimport { FolderOpen, Folder, Plus, Loader2, Check, AlertCircle } from 'lucide-react';\nimport { Button, Input } from './ui';\nimport { tWithFallback } from '../utils/i18n';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n useSandboxGetFoldersQuery,\n useSandboxCreateFolderMutation,\n} from '../../generated/wspace-operations';\n\nconst PAGE_SIZE = 20;\n\ninterface FilesFolderPickerProps {\n /** Currently selected folder id (uncontrolled-leaning controlled). */\n value: string | null;\n /** Fired with the selected folder id (or null when cleared). */\n onChange: (folderId: string | null) => void;\n}\n\n/**\n * Picks a files-svc folder for sandbox volume export on stop.\n *\n * Behaviour:\n * - Lists folders from the workspaces gateway via `getFolders` (offset paging\n * — wspace.graphql exposes limit/offset, not cursor).\n * - \"Load more\" appends; \"Create folder\" inline action calls `createFolder`\n * and selects the newly created folder.\n * - Selection writes the folder id back through `onChange`.\n *\n * Styling sticks to semantic tokens (`bg-card`, `text-muted-foreground`,\n * `border-border`, `text-primary`) — no raw colours.\n */\nexport function FilesFolderPicker({ value, onChange }: FilesFolderPickerProps) {\n const { t } = useI18n();\n const [offset, setOffset] = useState(0);\n const [creating, setCreating] = useState(false);\n const [newFolderName, setNewFolderName] = useState('');\n const [createError, setCreateError] = useState<string | null>(null);\n\n const { data, loading, error, fetchMore, refetch } = useSandboxGetFoldersQuery({\n variables: { pagination: { limit: PAGE_SIZE, offset: 0 } },\n fetchPolicy: 'cache-and-network',\n notifyOnNetworkStatusChange: true,\n });\n\n const [createFolderMutation, { loading: createLoading }] = useSandboxCreateFolderMutation();\n\n interface FolderRow {\n id: string;\n name: string;\n path: string;\n parentFolderId?: string | null;\n }\n const folders: FolderRow[] = useMemo(\n () => (data?.getFolders.folders ?? []) as FolderRow[],\n [data]\n );\n const hasMore = data?.getFolders.hasMore ?? false;\n\n const handleLoadMore = async (): Promise<void> => {\n const next = offset + PAGE_SIZE;\n await fetchMore({\n variables: { pagination: { limit: PAGE_SIZE, offset: next } },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n ...fetchMoreResult,\n getFolders: {\n ...fetchMoreResult.getFolders,\n folders: [...prev.getFolders.folders, ...fetchMoreResult.getFolders.folders],\n },\n };\n },\n });\n setOffset(next);\n };\n\n const handleCreate = async (): Promise<void> => {\n const name = newFolderName.trim();\n if (!name) return;\n setCreateError(null);\n try {\n const result = await createFolderMutation({ variables: { input: { name } } });\n const created = result.data?.createFolder;\n if (created) {\n onChange(created.id);\n setNewFolderName('');\n setCreating(false);\n await refetch();\n }\n } catch (err) {\n setCreateError(err instanceof Error ? err.message : String(err));\n }\n };\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-between\">\n <label className=\"block text-sm font-semibold\">\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.label', 'Export folder (files-svc)')}\n </label>\n {value !== null && (\n <button\n type=\"button\"\n onClick={() => onChange(null)}\n className=\"text-xs text-muted-foreground hover:text-foreground transition-colors\"\n >\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.clear', 'Clear')}\n </button>\n )}\n </div>\n\n <p className=\"text-xs text-muted-foreground\">\n {tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.help',\n 'When the sandbox stops, the volume contents are best-effort copied to this folder. Leave empty to skip export.'\n )}\n </p>\n\n {error && (\n <div className=\"flex items-center gap-2 text-xs text-destructive\">\n <AlertCircle className=\"w-4 h-4\" />\n {error.message}\n </div>\n )}\n\n <div className=\"border-2 border-border rounded-lg bg-background max-h-56 overflow-y-auto\">\n {loading && folders.length === 0 ? (\n <div className=\"flex items-center justify-center py-6 text-muted-foreground\">\n <Loader2 className=\"w-4 h-4 animate-spin mr-2\" />\n <span className=\"text-sm\">\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.loading', 'Loading folders…')}\n </span>\n </div>\n ) : folders.length === 0 ? (\n <div className=\"px-4 py-6 text-sm text-muted-foreground text-center\">\n {tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.empty',\n 'No folders yet — create one below.'\n )}\n </div>\n ) : (\n <ul className=\"divide-y divide-border\">\n {folders.map((folder) => {\n const isSelected = folder.id === value;\n return (\n <li key={folder.id}>\n <button\n type=\"button\"\n onClick={() => onChange(folder.id)}\n className={`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-muted ${\n isSelected ? 'bg-primary/10' : ''\n }`}\n >\n {isSelected ? (\n <FolderOpen className=\"w-4 h-4 text-primary\" />\n ) : (\n <Folder className=\"w-4 h-4 text-muted-foreground\" />\n )}\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium truncate\">{folder.name}</p>\n {folder.path && (\n <p className=\"text-xs text-muted-foreground truncate\">{folder.path}</p>\n )}\n </div>\n {isSelected && <Check className=\"w-4 h-4 text-primary\" />}\n </button>\n </li>\n );\n })}\n </ul>\n )}\n\n {hasMore && (\n <div className=\"border-t border-border p-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleLoadMore}\n disabled={loading}\n className=\"w-full\"\n >\n {loading ? <Loader2 className=\"w-3 h-3 animate-spin mr-2\" /> : null}\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.loadMore', 'Load more')}\n </Button>\n </div>\n )}\n </div>\n\n {creating ? (\n <div className=\"flex items-center gap-2\">\n <Input\n value={newFolderName}\n onChange={(e) => setNewFolderName(e.target.value)}\n placeholder={tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.newPlaceholder',\n 'Folder name'\n )}\n className=\"flex-1\"\n autoFocus\n />\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={handleCreate}\n disabled={createLoading || newFolderName.trim().length === 0}\n >\n {createLoading ? <Loader2 className=\"w-3 h-3 animate-spin mr-2\" /> : null}\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.createConfirm', 'Create')}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => {\n setCreating(false);\n setNewFolderName('');\n setCreateError(null);\n }}\n >\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.cancel', 'Cancel')}\n </Button>\n </div>\n ) : (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => setCreating(true)}>\n <Plus className=\"w-3 h-3 mr-2\" />\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.createNew', 'Create folder')}\n </Button>\n )}\n\n {createError && (\n <div className=\"flex items-center gap-2 text-xs text-destructive\">\n <AlertCircle className=\"w-4 h-4\" />\n {createError}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,IAAY;AAsBlB,SAAgB,EAAkB,EAAE,UAAO,eAAoC;CAC7E,IAAM,EAAE,SAAM,GAAS,EACjB,CAAC,GAAQ,KAAa,EAAS,EAAE,EACjC,CAAC,GAAU,KAAe,EAAS,GAAM,EACzC,CAAC,GAAe,KAAoB,EAAS,GAAG,EAChD,CAAC,GAAa,KAAkB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9C,IAAM,IAAO,EAAc,MAAM;AAC5B,cACL;UAAe,KAAK;AACpB,YAAI;SAEF,IAAM,KADS,MAAM,EAAqB,EAAE,WAAW,EAAE,OAAO,EAAE,SAAM,EAAE,EAAE,CAAC,EACtD,MAAM;AAC7B,SAAI,MACF,EAAS,EAAQ,GAAG,EACpB,EAAiB,GAAG,EACpB,EAAY,GAAM,EAClB,MAAM,GAAS;iBAEV,GAAK;AACZ,WAAe,aAAe,QAAQ,EAAI,UAAU,OAAO,EAAI,CAAC;;;;MAsH1D,UAAU,KAAiB,EAAc,MAAM,CAAC,WAAW;gBAJ7D,CAMG,IAAgB,kBAAC,GAAD,EAAS,WAAU,6BAA8B,CAAA,GAAG,MACpE,EAAc,GAAG,mDAAmD,SAAS,CACvE;;KACT,kBAAC,GAAD;MACE,MAAK;MACL,MAAK;MACL,SAAQ;MACR,eAAe;AAGb,OAFA,EAAY,GAAM,EAClB,EAAiB,GAAG,EACpB,EAAe,KAAK;;gBAGrB,EAAc,GAAG,4CAA4C,SAAS;MAChE,CAAA;KACL;QAEN,kBAAC,GAAD;IAAQ,MAAK;IAAS,SAAQ;IAAU,MAAK;IAAK,eAAe,EAAY,GAAK;cAAlF,CACE,kBAAC,GAAD,EAAM,WAAU,gBAAiB,CAAA,EAChC,EAAc,GAAG,+CAA+C,gBAAgB,CAC1E;;GAGV,KACC,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD,EAAa,WAAU,WAAY,CAAA,EAClC,EACG;;GAEJ"}
|
|
1
|
+
{"version":3,"file":"FilesFolderPicker.js","names":[],"sources":["../../../src/sandbox/components/FilesFolderPicker.tsx"],"sourcesContent":["import { useState, useMemo, useRef } from 'react';\nimport { FolderOpen, Folder, Plus, Loader2, Check, AlertCircle } from 'lucide-react';\nimport { Button, Input } from './ui';\nimport { tWithFallback } from '../utils/i18n';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n useSandboxGetFoldersQuery,\n useSandboxCreateFolderMutation,\n} from '../../generated/wspace-operations';\n\nconst PAGE_SIZE = 20;\n\ninterface FilesFolderPickerProps {\n /** Currently selected folder id (uncontrolled-leaning controlled). */\n value: string | null;\n /** Fired with the selected folder id (or null when cleared). */\n onChange: (folderId: string | null) => void;\n}\n\n/**\n * Picks a files-svc folder for sandbox volume export on stop.\n *\n * Behaviour:\n * - Lists folders from the workspaces gateway via `getFolders` (offset paging\n * — wspace.graphql exposes limit/offset, not cursor).\n * - \"Load more\" appends; \"Create folder\" inline action calls `createFolder`\n * and selects the newly created folder.\n * - Selection writes the folder id back through `onChange`.\n *\n * Styling sticks to semantic tokens (`bg-card`, `text-muted-foreground`,\n * `border-border`, `text-primary`) — no raw colours.\n */\nexport function FilesFolderPicker({ value, onChange }: FilesFolderPickerProps) {\n const { t } = useI18n();\n const offsetRef = useRef(0);\n const [creating, setCreating] = useState(false);\n const [newFolderName, setNewFolderName] = useState('');\n const [createError, setCreateError] = useState<string | null>(null);\n\n const { data, loading, error, fetchMore, refetch } = useSandboxGetFoldersQuery({\n variables: { pagination: { limit: PAGE_SIZE, offset: 0 } },\n fetchPolicy: 'cache-and-network',\n notifyOnNetworkStatusChange: true,\n });\n\n const [createFolderMutation, { loading: createLoading }] = useSandboxCreateFolderMutation();\n\n interface FolderRow {\n id: string;\n name: string;\n path: string;\n parentFolderId?: string | null;\n }\n const folders: FolderRow[] = useMemo(\n () => (data?.getFolders.folders ?? []) as FolderRow[],\n [data]\n );\n const hasMore = data?.getFolders.hasMore ?? false;\n\n const handleLoadMore = async (): Promise<void> => {\n const next = offsetRef.current + PAGE_SIZE;\n await fetchMore({\n variables: { pagination: { limit: PAGE_SIZE, offset: next } },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n ...fetchMoreResult,\n getFolders: {\n ...fetchMoreResult.getFolders,\n folders: [...prev.getFolders.folders, ...fetchMoreResult.getFolders.folders],\n },\n };\n },\n });\n offsetRef.current = next;\n };\n\n const handleCreate = async (): Promise<void> => {\n const name = newFolderName.trim();\n if (!name) return;\n setCreateError(null);\n try {\n const result = await createFolderMutation({ variables: { input: { name } } });\n const created = result.data?.createFolder;\n if (created) {\n onChange(created.id);\n setNewFolderName('');\n setCreating(false);\n await refetch();\n }\n } catch (err) {\n setCreateError(err instanceof Error ? err.message : String(err));\n }\n };\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-between\">\n <label className=\"block text-sm font-semibold\">\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.label', 'Export folder (files-svc)')}\n </label>\n {value !== null && (\n <button\n type=\"button\"\n onClick={() => onChange(null)}\n className=\"text-xs text-muted-foreground hover:text-foreground transition-colors\"\n >\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.clear', 'Clear')}\n </button>\n )}\n </div>\n\n <p className=\"text-xs text-muted-foreground\">\n {tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.help',\n 'When the sandbox stops, the volume contents are best-effort copied to this folder. Leave empty to skip export.'\n )}\n </p>\n\n {error && (\n <div className=\"flex items-center gap-2 text-xs text-destructive\">\n <AlertCircle className=\"size-4\" />\n {error.message}\n </div>\n )}\n\n <div className=\"border-2 border-border rounded-lg bg-background max-h-56 overflow-y-auto\">\n {loading && folders.length === 0 ? (\n <div className=\"flex items-center justify-center py-6 text-muted-foreground\">\n <Loader2 className=\"size-4 animate-spin mr-2\" />\n <span className=\"text-sm\">\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.loading', 'Loading folders…')}\n </span>\n </div>\n ) : folders.length === 0 ? (\n <div className=\"px-4 py-6 text-sm text-muted-foreground text-center\">\n {tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.empty',\n 'No folders yet — create one below.'\n )}\n </div>\n ) : (\n <ul className=\"divide-y divide-border\">\n {folders.map((folder) => {\n const isSelected = folder.id === value;\n return (\n <li key={folder.id}>\n <button\n type=\"button\"\n onClick={() => onChange(folder.id)}\n className={`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-muted ${\n isSelected ? 'bg-primary/10' : ''\n }`}\n >\n {isSelected ? (\n <FolderOpen className=\"size-4 text-primary\" />\n ) : (\n <Folder className=\"size-4 text-muted-foreground\" />\n )}\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium truncate\">{folder.name}</p>\n {folder.path && (\n <p className=\"text-xs text-muted-foreground truncate\">{folder.path}</p>\n )}\n </div>\n {isSelected && <Check className=\"size-4 text-primary\" />}\n </button>\n </li>\n );\n })}\n </ul>\n )}\n\n {hasMore && (\n <div className=\"border-t border-border p-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleLoadMore}\n disabled={loading}\n className=\"w-full\"\n >\n {loading ? <Loader2 className=\"size-3 animate-spin mr-2\" /> : null}\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.loadMore', 'Load more')}\n </Button>\n </div>\n )}\n </div>\n\n {creating ? (\n <div className=\"flex items-center gap-2\">\n <Input\n value={newFolderName}\n onChange={(e) => setNewFolderName(e.target.value)}\n placeholder={tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.newPlaceholder',\n 'Folder name'\n )}\n className=\"flex-1\"\n autoFocus\n />\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={handleCreate}\n disabled={createLoading || newFolderName.trim().length === 0}\n >\n {createLoading ? <Loader2 className=\"size-3 animate-spin mr-2\" /> : null}\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.createConfirm', 'Create')}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => {\n setCreating(false);\n setNewFolderName('');\n setCreateError(null);\n }}\n >\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.cancel', 'Cancel')}\n </Button>\n </div>\n ) : (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => setCreating(true)}>\n <Plus className=\"size-3 mr-2\" />\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.createNew', 'Create folder')}\n </Button>\n )}\n\n {createError && (\n <div className=\"flex items-center gap-2 text-xs text-destructive\">\n <AlertCircle className=\"size-4\" />\n {createError}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,IAAY;AAsBlB,SAAgB,EAAkB,EAAE,UAAO,eAAoC;CAC7E,IAAM,EAAE,SAAM,GAAS,EACjB,IAAY,EAAO,EAAE,EACrB,CAAC,GAAU,KAAe,EAAS,GAAM,EACzC,CAAC,GAAe,KAAoB,EAAS,GAAG,EAChD,CAAC,GAAa,KAAkB,EAAwB,KAAK,EAE7D,EAAE,SAAM,YAAS,UAAO,cAAW,eAAY,EAA0B;EAC7E,WAAW,EAAE,YAAY;GAAE,OAAO;GAAW,QAAQ;GAAG,EAAE;EAC1D,aAAa;EACb,6BAA6B;EAC9B,CAAC,EAEI,CAAC,GAAsB,EAAE,SAAS,OAAmB,GAAgC,EAQrF,IAAuB,QACpB,GAAM,WAAW,WAAW,EAAE,EACrC,CAAC,EAAK,CACP,EACK,IAAU,GAAM,WAAW,WAAW;AAsC5C,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,SAAD;KAAO,WAAU;eACd,EAAc,GAAG,2CAA2C,4BAA4B;KACnF,CAAA,EACP,MAAU,QACT,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,EAAS,KAAK;KAC7B,WAAU;eAET,EAAc,GAAG,2CAA2C,QAAQ;KAC9D,CAAA,CAEP;;GAEN,kBAAC,KAAD;IAAG,WAAU;cACV,EACC,GACA,0CACA,iHACD;IACC,CAAA;GAEH,KACC,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD,EAAa,WAAU,UAAW,CAAA,EACjC,EAAM,QACH;;GAGR,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,KAAW,EAAQ,WAAW,IAC7B,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD,EAAS,WA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C,GAAD,EAAa,WAAU,UAAW,CAAA,EACjC,EACG;;GAEJ"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { cn as e } from "../utils/cn.js";
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { EmptyState as r } from "@burdenoff/fe-libs/ui";
|
|
3
4
|
//#region src/sandbox/components/PageLayout.tsx
|
|
4
|
-
var
|
|
5
|
+
var i = {
|
|
5
6
|
sm: "max-w-screen-sm",
|
|
6
7
|
md: "max-w-screen-md",
|
|
7
8
|
lg: "max-w-screen-lg",
|
|
@@ -10,11 +11,11 @@ var r = {
|
|
|
10
11
|
"3xl": "max-w-[1600px]",
|
|
11
12
|
full: "max-w-full"
|
|
12
13
|
};
|
|
13
|
-
function
|
|
14
|
+
function a({ children: r, title: a, subtitle: o, icon: s, headerActions: c, headerContent: l, maxWidth: u = "xl", showHeader: d = !0, className: f, contentClassName: p }) {
|
|
14
15
|
return /* @__PURE__ */ t("div", {
|
|
15
|
-
className: e("min-h-
|
|
16
|
+
className: e("min-h-screen w-full bg-bg-surface text-text-primary", "px-4 sm:px-6 lg:px-8 xl:px-12", "py-6 sm:py-8 lg:py-10", "animate-in fade-in-0 slide-in-from-bottom-4 duration-500", f),
|
|
16
17
|
children: /* @__PURE__ */ n("div", {
|
|
17
|
-
className: e("mx-auto w-full",
|
|
18
|
+
className: e("mx-auto w-full", i[u], p),
|
|
18
19
|
children: [d && (a || c) && /* @__PURE__ */ n("header", {
|
|
19
20
|
className: "mb-6 sm:mb-8",
|
|
20
21
|
children: [/* @__PURE__ */ n("div", {
|
|
@@ -44,32 +45,23 @@ function i({ children: i, title: a, subtitle: o, icon: s, headerActions: c, head
|
|
|
44
45
|
})]
|
|
45
46
|
}), /* @__PURE__ */ t("div", {
|
|
46
47
|
className: "space-y-6",
|
|
47
|
-
children:
|
|
48
|
+
children: r
|
|
48
49
|
})]
|
|
49
50
|
})
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
className:
|
|
55
|
-
children:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
className: "text-lg font-semibold text-foreground mb-1",
|
|
62
|
-
children: i
|
|
63
|
-
}),
|
|
64
|
-
a && /* @__PURE__ */ t("p", {
|
|
65
|
-
className: "text-sm text-muted-foreground max-w-sm mb-4",
|
|
66
|
-
children: a
|
|
67
|
-
}),
|
|
68
|
-
o
|
|
69
|
-
]
|
|
53
|
+
function o({ icon: e, title: n, description: i, action: a, className: o }) {
|
|
54
|
+
return /* @__PURE__ */ t("div", {
|
|
55
|
+
className: o,
|
|
56
|
+
children: /* @__PURE__ */ t(r, {
|
|
57
|
+
icon: e,
|
|
58
|
+
title: n,
|
|
59
|
+
description: i,
|
|
60
|
+
action: a
|
|
61
|
+
})
|
|
70
62
|
});
|
|
71
63
|
}
|
|
72
64
|
//#endregion
|
|
73
|
-
export {
|
|
65
|
+
export { o as EmptyState, a as PageLayout };
|
|
74
66
|
|
|
75
67
|
//# sourceMappingURL=PageLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/sandbox/components/PageLayout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n children: ReactNode;\n /** Page title */\n title?: string;\n /** Page subtitle/description */\n subtitle?: string;\n /** Icon component to display next to title */\n icon?: ReactNode;\n /** Actions to display in header (buttons, etc.) */\n headerActions?: ReactNode;\n /** Additional header content below title */\n headerContent?: ReactNode;\n /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */\n maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';\n /** Whether to show the header section */\n showHeader?: boolean;\n /** Additional CSS classes for the container */\n className?: string;\n /** Additional CSS classes for the content area */\n contentClassName?: string;\n}\n\nconst maxWidthClasses = {\n sm: 'max-w-screen-sm',\n md: 'max-w-screen-md',\n lg: 'max-w-screen-lg',\n xl: 'max-w-screen-xl',\n '2xl': 'max-w-screen-2xl',\n '3xl': 'max-w-[1600px]',\n full: 'max-w-full',\n};\n\n/**\n * PageLayout - A consistent page wrapper with responsive design\n */\nexport function PageLayout({\n children,\n title,\n subtitle,\n icon,\n headerActions,\n headerContent,\n maxWidth = 'xl',\n showHeader = true,\n className,\n contentClassName,\n}: PageLayoutProps) {\n return (\n <div\n className={cn(\n 'min-h-
|
|
1
|
+
{"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/sandbox/components/PageLayout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { EmptyState as CanonicalEmptyState } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n children: ReactNode;\n /** Page title */\n title?: string;\n /** Page subtitle/description */\n subtitle?: string;\n /** Icon component to display next to title */\n icon?: ReactNode;\n /** Actions to display in header (buttons, etc.) */\n headerActions?: ReactNode;\n /** Additional header content below title */\n headerContent?: ReactNode;\n /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */\n maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';\n /** Whether to show the header section */\n showHeader?: boolean;\n /** Additional CSS classes for the container */\n className?: string;\n /** Additional CSS classes for the content area */\n contentClassName?: string;\n}\n\nconst maxWidthClasses = {\n sm: 'max-w-screen-sm',\n md: 'max-w-screen-md',\n lg: 'max-w-screen-lg',\n xl: 'max-w-screen-xl',\n '2xl': 'max-w-screen-2xl',\n '3xl': 'max-w-[1600px]',\n full: 'max-w-full',\n};\n\n/**\n * PageLayout - A consistent page wrapper with responsive design\n */\nexport function PageLayout({\n children,\n title,\n subtitle,\n icon,\n headerActions,\n headerContent,\n maxWidth = 'xl',\n showHeader = true,\n className,\n contentClassName,\n}: PageLayoutProps) {\n return (\n <div\n className={cn(\n 'min-h-screen w-full bg-bg-surface text-text-primary',\n 'px-4 sm:px-6 lg:px-8 xl:px-12',\n 'py-6 sm:py-8 lg:py-10',\n 'animate-in fade-in-0 slide-in-from-bottom-4 duration-500',\n className\n )}\n >\n <div className={cn('mx-auto w-full', maxWidthClasses[maxWidth], contentClassName)}>\n {showHeader && (title || headerActions) && (\n <header className=\"mb-6 sm:mb-8\">\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"space-y-1\">\n {(title || icon) && (\n <div className=\"flex items-center gap-3\">\n {icon && (\n <div className=\"flex-shrink-0 p-2.5 rounded-xl bg-primary/10 text-primary\">\n {icon}\n </div>\n )}\n {title && (\n <h1 className=\"text-2xl sm:text-3xl font-bold tracking-tight text-foreground\">\n {title}\n </h1>\n )}\n </div>\n )}\n {subtitle && (\n <p className=\"text-sm sm:text-base text-muted-foreground max-w-2xl\">{subtitle}</p>\n )}\n </div>\n {headerActions && (\n <div className=\"flex items-center gap-2 flex-shrink-0\">{headerActions}</div>\n )}\n </div>\n {headerContent && <div className=\"mt-4\">{headerContent}</div>}\n </header>\n )}\n {/* Page content — must not use a <main> landmark here because the\n host shell (AppShellLayout) already renders one; nesting <main>\n elements is invalid HTML and an a11y violation. */}\n <div className=\"space-y-6\">{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * Local wrapper around the canonical `EmptyState` from `@burdenoff/fe-libs/ui`.\n * Keeps the existing microfe-sandbox call sites stable while routing all\n * empty-state rendering through the shared primitive.\n */\nexport function EmptyState({\n icon,\n title,\n description,\n action,\n className,\n}: {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}) {\n return (\n <div className={className}>\n <CanonicalEmptyState icon={icon} title={title} description={description} action={action} />\n </div>\n );\n}\n"],"mappings":";;;;AA0BA,IAAM,IAAkB;CACtB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;CACP;AAKD,SAAgB,EAAW,EACzB,aACA,UACA,aACA,SACA,kBACA,kBACA,cAAW,MACX,gBAAa,IACb,cACA,uBACkB;AAClB,QACE,kBAAC,OAAD;EACE,WAAW,EACT,uDACA,iCACA,yBACA,4DACA,EACD;YAED,kBAAC,OAAD;GAAK,WAAW,EAAG,kBAAkB,EAAgB,IAAW,EAAiB;aAAjF,CACG,MAAe,KAAS,MACvB,kBAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,OAAD;MAAK,WAAU;gBAAf,EACI,KAAS,MACT,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACG,KACC,kBAAC,OAAD;QAAK,WAAU;kBACZ;QACG,CAAA,EAEP,KACC,kBAAC,MAAD;QAAI,WAAU;kBACX;QACE,CAAA,CAEH;UAEP,KACC,kBAAC,KAAD;OAAG,WAAU;iBAAwD;OAAa,CAAA,CAEhF;SACL,KACC,kBAAC,OAAD;MAAK,WAAU;gBAAyC;MAAoB,CAAA,CAE1E;QACL,KAAiB,kBAAC,OAAD;KAAK,WAAU;eAAQ;KAAoB,CAAA,CACtD;OAKX,kBAAC,OAAD;IAAK,WAAU;IAAa;IAAe,CAAA,CACvC;;EACF,CAAA;;AASV,SAAgB,EAAW,EACzB,SACA,UACA,gBACA,WACA,gBAOC;AACD,QACE,kBAAC,OAAD;EAAgB;YACd,kBAAC,GAAD;GAA2B;GAAa;GAAoB;GAAqB;GAAU,CAAA;EACvF,CAAA"}
|
|
@@ -5,7 +5,7 @@ import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
|
5
5
|
function o() {
|
|
6
6
|
return /* @__PURE__ */ i("div", {
|
|
7
7
|
className: "flex items-center justify-center min-h-[400px]",
|
|
8
|
-
children: /* @__PURE__ */ i(n, { className: "
|
|
8
|
+
children: /* @__PURE__ */ i(n, { className: "size-8 animate-spin text-primary" })
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
var s = class extends e {
|
|
@@ -40,7 +40,7 @@ var s = class extends e {
|
|
|
40
40
|
children: [
|
|
41
41
|
/* @__PURE__ */ i("div", {
|
|
42
42
|
className: "p-3 rounded-full bg-destructive/10",
|
|
43
|
-
children: /* @__PURE__ */ i(t, { className: "
|
|
43
|
+
children: /* @__PURE__ */ i(t, { className: "size-8 text-destructive" })
|
|
44
44
|
}),
|
|
45
45
|
/* @__PURE__ */ a("div", {
|
|
46
46
|
className: "space-y-2",
|
|
@@ -56,7 +56,7 @@ var s = class extends e {
|
|
|
56
56
|
type: "button",
|
|
57
57
|
onClick: this.handleRetry,
|
|
58
58
|
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",
|
|
59
|
-
children: [/* @__PURE__ */ i(r, { className: "
|
|
59
|
+
children: [/* @__PURE__ */ i(r, { className: "size-4" }), "Try Again"]
|
|
60
60
|
})
|
|
61
61
|
]
|
|
62
62
|
}) : this.props.children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteUtils.js","names":[],"sources":["../../../src/sandbox/components/RouteUtils.tsx"],"sourcesContent":["import { Component, type ReactNode, type ErrorInfo } from 'react';\nimport { Loader2, AlertTriangle, RefreshCw } from 'lucide-react';\n\n/**\n * Loading fallback for lazy-loaded pages\n */\nexport function PageLoader() {\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Loader2 className=\"
|
|
1
|
+
{"version":3,"file":"RouteUtils.js","names":[],"sources":["../../../src/sandbox/components/RouteUtils.tsx"],"sourcesContent":["import { Component, type ReactNode, type ErrorInfo } from 'react';\nimport { Loader2, AlertTriangle, RefreshCw } from 'lucide-react';\n\n/**\n * Loading fallback for lazy-loaded pages\n */\nexport function PageLoader() {\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n );\n}\n\n/**\n * Error boundary for lazy-loaded page chunks.\n * Catches chunk-load failures and renders a retry UI instead of an infinite spinner.\n */\nexport class LazyErrorBoundary extends Component<\n { children: ReactNode },\n { hasError: boolean; error: Error | null }\n> {\n constructor(props: { children: ReactNode }) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n console.error('[Sandbox] Lazy page load failed:', error, errorInfo);\n }\n\n handleRetry = () => {\n if (this.state.error?.name === 'ChunkLoadError') {\n window.location.reload();\n return;\n }\n this.setState({ hasError: false, error: null });\n };\n\n render() {\n if (this.state.hasError) {\n return (\n <div className=\"flex flex-col items-center justify-center min-h-[400px] gap-4 text-center p-6\">\n <div className=\"p-3 rounded-full bg-destructive/10\">\n <AlertTriangle className=\"size-8 text-destructive\" />\n </div>\n <div className=\"space-y-2\">\n <h3 className=\"text-lg font-semibold text-foreground\">Failed to load page</h3>\n <p className=\"text-sm text-muted-foreground max-w-md\">\n {this.state.error?.message?.includes('Loading chunk')\n ? 'The page chunk could not be loaded. This may be due to a network issue.'\n : 'Something went wrong while loading this page. Please try again.'}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={this.handleRetry}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n <RefreshCw className=\"size-4\" />\n Try Again\n </button>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"],"mappings":";;;;AAMA,SAAgB,IAAa;AAC3B,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,GAAD,EAAS,WAAU,oCAAqC,CAAA;EACpD,CAAA;;AAQV,IAAa,IAAb,cAAuC,EAGrC;CACA,YAAY,GAAgC;AAE1C,EADA,MAAM,EAAM,EACZ,KAAK,QAAQ;GAAE,UAAU;GAAO,OAAO;GAAM;;CAG/C,OAAO,yBAAyB,GAAc;AAC5C,SAAO;GAAE,UAAU;GAAM;GAAO;;CAGlC,kBAAkB,GAAc,GAAsB;AACpD,UAAQ,MAAM,oCAAoC,GAAO,EAAU;;CAGrE,oBAAoB;AAClB,MAAI,KAAK,MAAM,OAAO,SAAS,kBAAkB;AAC/C,UAAO,SAAS,QAAQ;AACxB;;AAEF,OAAK,SAAS;GAAE,UAAU;GAAO,OAAO;GAAM,CAAC;;CAGjD,SAAS;AA2BP,SA1BI,KAAK,MAAM,WAEX,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD,EAAe,WAAU,2BAA4B,CAAA;KACjD,CAAA;IACN,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,MAAD;MAAI,WAAU;gBAAwC;MAAwB,CAAA,EAC9E,kBAAC,KAAD;MAAG,WAAU;gBACV,KAAK,MAAM,OAAO,SAAS,SAAS,gBAAgB,GACjD,4EACA;MACF,CAAA,CACA;;IACN,kBAAC,UAAD;KACE,MAAK;KACL,SAAS,KAAK;KACd,WAAU;eAHZ,CAKE,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA,EAAA,YAEzB;;IACL;OAIH,KAAK,MAAM"}
|
|
@@ -56,10 +56,8 @@ function u({ sandboxId: i, workspaceId: u, pageSize: d = 50 }) {
|
|
|
56
56
|
className: "text-sm text-text-secondary",
|
|
57
57
|
children: e(f, "sandbox.activity.empty", "No activity yet.")
|
|
58
58
|
}) : /* @__PURE__ */ s("ul", {
|
|
59
|
-
role: "list",
|
|
60
59
|
className: "divide-y divide-border-subtle",
|
|
61
60
|
children: v.map((t) => /* @__PURE__ */ c("li", {
|
|
62
|
-
role: "listitem",
|
|
63
61
|
className: "py-3",
|
|
64
62
|
children: [/* @__PURE__ */ s("div", {
|
|
65
63
|
className: "text-sm font-medium text-foreground",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxActivityTab.js","names":[],"sources":["../../../src/sandbox/components/SandboxActivityTab.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\nconst RECENT_ACTIVITY = gql`\n query GetRecentSandboxActivity($context: ContextInput!, $limit: Int) {\n getRecentSandboxActivity(context: $context, limit: $limit) {\n items {\n id\n action\n sandboxName\n sandboxId\n actorId\n status\n createdAt\n }\n total\n }\n }\n`;\n\ninterface ActivityItem {\n id: string;\n action: string;\n sandboxName: string;\n sandboxId?: string | null;\n actorId: string;\n status: string;\n createdAt: string;\n}\n\ninterface Props {\n sandboxId: string;\n workspaceId: string;\n pageSize?: number;\n}\n\n/**\n * Activity / audit feed scoped to a single sandbox. Reuses the existing\n * `getRecentSandboxActivity` admin query and filters client-side by sandboxId\n * so no new backend query is needed for the v0.3.0 cycle. Server-side scoping\n * will move to a dedicated `getSandboxAuditLog(sandboxId)` query in a follow-up.\n */\nexport function SandboxActivityTab({ sandboxId, workspaceId, pageSize = 50 }: Props) {\n const { t } = useI18n();\n const client = useApolloClient();\n const [items, setItems] = useState<ActivityItem[] | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n client\n .query<{ getRecentSandboxActivity: { items: ActivityItem[] } }>({\n query: RECENT_ACTIVITY,\n variables: { context: { workspaceId }, limit: pageSize },\n fetchPolicy: 'network-only',\n })\n .then((res: { data?: { getRecentSandboxActivity?: { items?: ActivityItem[] } } }) => {\n if (cancelled) return;\n const all: ActivityItem[] = res.data?.getRecentSandboxActivity?.items ?? [];\n setItems(all.filter((entry: ActivityItem) => entry.sandboxId === sandboxId));\n })\n .catch((err: unknown) => {\n if (cancelled) return;\n setError(err instanceof Error ? err.message : String(err));\n });\n return () => {\n cancelled = true;\n };\n }, [client, sandboxId, workspaceId, pageSize]);\n\n const sorted = useMemo(\n () =>\n items\n ?.slice()\n .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) ?? null,\n [items]\n );\n\n if (error) {\n return (\n <p className=\"text-sm text-status-error-text\">\n {tWithFallback(t, 'sandbox.activity.loadFailed', \"Couldn't load activity.\")}\n </p>\n );\n }\n if (sorted == null) {\n return <p className=\"text-sm text-text-secondary\">…</p>;\n }\n if (sorted.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(t, 'sandbox.activity.empty', 'No activity yet.')}\n </p>\n );\n }\n\n return (\n <ul
|
|
1
|
+
{"version":3,"file":"SandboxActivityTab.js","names":[],"sources":["../../../src/sandbox/components/SandboxActivityTab.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\nconst RECENT_ACTIVITY = gql`\n query GetRecentSandboxActivity($context: ContextInput!, $limit: Int) {\n getRecentSandboxActivity(context: $context, limit: $limit) {\n items {\n id\n action\n sandboxName\n sandboxId\n actorId\n status\n createdAt\n }\n total\n }\n }\n`;\n\ninterface ActivityItem {\n id: string;\n action: string;\n sandboxName: string;\n sandboxId?: string | null;\n actorId: string;\n status: string;\n createdAt: string;\n}\n\ninterface Props {\n sandboxId: string;\n workspaceId: string;\n pageSize?: number;\n}\n\n/**\n * Activity / audit feed scoped to a single sandbox. Reuses the existing\n * `getRecentSandboxActivity` admin query and filters client-side by sandboxId\n * so no new backend query is needed for the v0.3.0 cycle. Server-side scoping\n * will move to a dedicated `getSandboxAuditLog(sandboxId)` query in a follow-up.\n */\nexport function SandboxActivityTab({ sandboxId, workspaceId, pageSize = 50 }: Props) {\n const { t } = useI18n();\n const client = useApolloClient();\n const [items, setItems] = useState<ActivityItem[] | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n client\n .query<{ getRecentSandboxActivity: { items: ActivityItem[] } }>({\n query: RECENT_ACTIVITY,\n variables: { context: { workspaceId }, limit: pageSize },\n fetchPolicy: 'network-only',\n })\n .then((res: { data?: { getRecentSandboxActivity?: { items?: ActivityItem[] } } }) => {\n if (cancelled) return;\n const all: ActivityItem[] = res.data?.getRecentSandboxActivity?.items ?? [];\n setItems(all.filter((entry: ActivityItem) => entry.sandboxId === sandboxId));\n })\n .catch((err: unknown) => {\n if (cancelled) return;\n setError(err instanceof Error ? err.message : String(err));\n });\n return () => {\n cancelled = true;\n };\n }, [client, sandboxId, workspaceId, pageSize]);\n\n const sorted = useMemo(\n () =>\n items\n ?.slice()\n .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) ?? null,\n [items]\n );\n\n if (error) {\n return (\n <p className=\"text-sm text-status-error-text\">\n {tWithFallback(t, 'sandbox.activity.loadFailed', \"Couldn't load activity.\")}\n </p>\n );\n }\n if (sorted == null) {\n return <p className=\"text-sm text-text-secondary\">…</p>;\n }\n if (sorted.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(t, 'sandbox.activity.empty', 'No activity yet.')}\n </p>\n );\n }\n\n return (\n <ul className=\"divide-y divide-border-subtle\">\n {sorted.map((entry) => (\n <li key={entry.id} className=\"py-3\">\n <div className=\"text-sm font-medium text-foreground\">{entry.action}</div>\n <div className=\"mt-0.5 text-xs text-text-secondary\">\n {tWithFallback(t, 'sandbox.activity.actor', `by ${entry.actorId}`, {\n actor: entry.actorId,\n })}{' '}\n ·{' '}\n {tWithFallback(\n t,\n 'sandbox.activity.atTime',\n `at ${new Date(entry.createdAt).toLocaleString()}`,\n {\n time: new Date(entry.createdAt).toLocaleString(),\n }\n )}\n </div>\n </li>\n ))}\n </ul>\n );\n}\n"],"mappings":";;;;;;;AAMA,IAAM,IAAkB,CAAG;;;;;;;;;;;;;;;;AAuC3B,SAAgB,EAAmB,EAAE,cAAW,gBAAa,cAAW,MAAa;CACnF,IAAM,EAAE,SAAM,GAAS,EACjB,IAAS,GAAiB,E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AAU,CAAC,gBAAgB,IAChD,EACE,MAAM,IAAI,KAAK,EAAM,UAAU,CAAC,gBAAgB,EACjD,CACF;KACG;MACH;KAhBI,EAAM,GAgBV,CACL;EACC,CAAA"}
|
|
@@ -4,8 +4,7 @@ import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/sandbox/components/SandboxUsageBanner.tsx
|
|
5
5
|
function i({ runningCount: i, maxConcurrent: a, minutesConsumed: o, minutesQuota: s }) {
|
|
6
6
|
let { t: c } = t(), l = a > 0 ? Math.min(100, Math.round(i / a * 100)) : 0;
|
|
7
|
-
return /* @__PURE__ */ r("
|
|
8
|
-
role: "status",
|
|
7
|
+
return /* @__PURE__ */ r("output", {
|
|
9
8
|
"aria-live": "polite",
|
|
10
9
|
className: "flex flex-wrap items-center gap-3 rounded-md border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
|
|
11
10
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxUsageBanner.js","names":[],"sources":["../../../src/sandbox/components/SandboxUsageBanner.tsx"],"sourcesContent":["import { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\ninterface Props {\n /** Concurrent running count from the live list (cheap to compute client-side). */\n runningCount: number;\n /** Workspace policy max (`SandboxConfig.maxConcurrentPerWorkspace`). */\n maxConcurrent: number;\n /** Optional consumed/quota minute counts for monthly usage. Hide block if not provided. */\n minutesConsumed?: number;\n minutesQuota?: number;\n}\n\n/**\n * Compact usage banner shown above the sandbox list. Mirrors the per-workspace\n * limits set by admins so members see why creates are blocked when they hit a cap.\n */\nexport function SandboxUsageBanner({\n runningCount,\n maxConcurrent,\n minutesConsumed,\n minutesQuota,\n}: Props) {\n const { t } = useI18n();\n\n const pct =\n maxConcurrent > 0 ? Math.min(100, Math.round((runningCount / maxConcurrent) * 100)) : 0;\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"SandboxUsageBanner.js","names":[],"sources":["../../../src/sandbox/components/SandboxUsageBanner.tsx"],"sourcesContent":["import { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\ninterface Props {\n /** Concurrent running count from the live list (cheap to compute client-side). */\n runningCount: number;\n /** Workspace policy max (`SandboxConfig.maxConcurrentPerWorkspace`). */\n maxConcurrent: number;\n /** Optional consumed/quota minute counts for monthly usage. Hide block if not provided. */\n minutesConsumed?: number;\n minutesQuota?: number;\n}\n\n/**\n * Compact usage banner shown above the sandbox list. Mirrors the per-workspace\n * limits set by admins so members see why creates are blocked when they hit a cap.\n */\nexport function SandboxUsageBanner({\n runningCount,\n maxConcurrent,\n minutesConsumed,\n minutesQuota,\n}: Props) {\n const { t } = useI18n();\n\n const pct =\n maxConcurrent > 0 ? Math.min(100, Math.round((runningCount / maxConcurrent) * 100)) : 0;\n\n return (\n <output\n aria-live=\"polite\"\n className=\"flex flex-wrap items-center gap-3 rounded-md border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary\"\n >\n <span>\n {tWithFallback(\n t,\n 'sandbox.usageBanner.concurrent',\n `${runningCount} of ${maxConcurrent} sandboxes running`,\n { count: runningCount, max: maxConcurrent }\n )}\n </span>\n <div className=\"h-1.5 w-32 overflow-hidden rounded-full bg-bg-surface\" aria-hidden=\"true\">\n <div\n className={`h-full ${pct >= 90 ? 'bg-status-error-bg-default' : pct >= 70 ? 'bg-status-warning-bg-default' : 'bg-status-success-bg-default'}`}\n style={{ width: `${pct}%` }}\n />\n </div>\n {typeof minutesConsumed === 'number' && typeof minutesQuota === 'number' && (\n <span className=\"ml-auto\">\n {tWithFallback(\n t,\n 'sandbox.usageBanner.consumed',\n `${minutesConsumed} of ${minutesQuota} minutes used this month`,\n { minutes: minutesConsumed, quota: minutesQuota }\n )}\n </span>\n )}\n </output>\n );\n}\n"],"mappings":";;;;AAiBA,SAAgB,EAAmB,EACjC,iBACA,kBACA,oBACA,mBACQ;CACR,IAAM,EAAE,SAAM,GAAS,EAEjB,IACJ,IAAgB,IAAI,KAAK,IAAI,KAAK,KAAK,MAAO,IAAe,IAAiB,IAAI,CAAC,GAAG;AAExF,QACE,kBAAC,UAAD;EACE,aAAU;EACV,WAAU;YAFZ;GAIE,kBAAC,QAAD,EAAA,UACG,EACC,GACA,kCACA,GAAG,EAAa,MAAM,EAAc,qBACpC;IAAE,OAAO;IAAc,KAAK;IAAe,CAC5C,EACI,CAAA;GACP,kBAAC,OAAD;IAAK,WAAU;IAAwD,eAAY;cACjF,kBAAC,OAAD;KACE,WAAW,UAAU,KAAO,KAAK,+BAA+B,KAAO,KAAK,iCAAiC;KAC7G,OAAO,EAAE,OAAO,GAAG,EAAI,IAAI;KAC3B,CAAA;IACE,CAAA;GACL,OAAO,KAAoB,YAAY,OAAO,KAAiB,YAC9D,kBAAC,QAAD;IAAM,WAAU;cACb,EACC,GACA,gCACA,GAAG,EAAgB,MAAM,EAAa,2BACtC;KAAE,SAAS;KAAiB,OAAO;KAAc,CAClD;IACI,CAAA;GAEF"}
|
|
@@ -69,8 +69,7 @@ var p = {
|
|
|
69
69
|
EXPIRED: t(s, "sandbox.status.expired", "Expired"),
|
|
70
70
|
FAILED: t(s, "sandbox.status.failed", "Failed")
|
|
71
71
|
}[n] ?? c.label;
|
|
72
|
-
return /* @__PURE__ */ f("
|
|
73
|
-
role: "status",
|
|
72
|
+
return /* @__PURE__ */ f("output", {
|
|
74
73
|
"aria-label": h,
|
|
75
74
|
className: e("inline-flex items-center gap-1.5 border rounded-full font-medium", o === "sm" ? "px-2.5 py-0.5 text-xs" : "px-3 py-1 text-sm", c.bg, c.color, r),
|
|
76
75
|
children: [a && /* @__PURE__ */ d(l, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/sandbox/components/StatusBadge.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport {\n Clock,\n Loader2,\n CheckCircle2,\n StopCircle,\n AlertTriangle,\n TimerOff,\n XCircle,\n Circle,\n} from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { cn } from '../utils/cn';\nimport type { SandboxStatus } from '../types';\nimport { tWithFallback } from '../utils/i18n';\n\ninterface StatusBadgeProps {\n status: SandboxStatus;\n className?: string;\n showIcon?: boolean;\n size?: 'sm' | 'md';\n}\n\nconst statusConfig: Record<\n SandboxStatus,\n { label: string; color: string; bg: string; icon: FC<{ size?: number; className?: string }> }\n> = {\n PENDING: {\n label: 'Pending',\n color: 'text-status-warning-text',\n bg: 'bg-status-warning-bg-subtle border-border-default',\n icon: Clock,\n },\n PROVISIONING: {\n label: 'Provisioning',\n color: 'text-status-info-text',\n bg: 'bg-status-info-bg-subtle border-border-default',\n icon: Loader2,\n },\n RUNNING: {\n label: 'Running',\n color: 'text-status-success-text',\n bg: 'bg-status-success-bg-subtle border-border-default',\n icon: CheckCircle2,\n },\n STOPPING: {\n label: 'Stopping',\n color: 'text-accent-orange',\n bg: 'bg-accent-orange-subtle border-border-default',\n icon: Loader2,\n },\n STOPPED: {\n label: 'Stopped',\n color: 'text-text-secondary',\n bg: 'bg-bg-sunken border-border-default',\n icon: StopCircle,\n },\n ERROR: {\n label: 'Error',\n color: 'text-status-error-text',\n bg: 'bg-status-error-bg-subtle border-border-default',\n icon: AlertTriangle,\n },\n EXPIRED: {\n label: 'Expired',\n color: 'text-text-secondary',\n bg: 'bg-bg-sunken border-border-default',\n icon: TimerOff,\n },\n FAILED: {\n label: 'Failed',\n color: 'text-status-error-text',\n bg: 'bg-status-error-bg-subtle border-border-default',\n icon: XCircle,\n },\n};\n\n/**\n * Color-coded status badge for sandbox lifecycle states\n */\nexport const StatusBadge: FC<StatusBadgeProps> = ({\n status,\n className,\n showIcon = true,\n size = 'sm',\n}) => {\n const { t } = useI18n();\n const config = statusConfig[status] || {\n label: status,\n color: 'text-muted-foreground',\n bg: 'bg-muted border-border',\n icon: Circle,\n };\n const Icon = config.icon;\n const isAnimated = status === 'PROVISIONING' || status === 'STOPPING';\n const labels: Record<SandboxStatus, string> = {\n PENDING: tWithFallback(t, 'sandbox.status.pending', 'Pending'),\n PROVISIONING: tWithFallback(t, 'sandbox.status.provisioning', 'Provisioning'),\n RUNNING: tWithFallback(t, 'sandbox.status.running', 'Running'),\n STOPPING: tWithFallback(t, 'sandbox.status.stopping', 'Stopping'),\n STOPPED: tWithFallback(t, 'sandbox.status.stopped', 'Stopped'),\n ERROR: tWithFallback(t, 'sandbox.status.error', 'Error'),\n EXPIRED: tWithFallback(t, 'sandbox.status.expired', 'Expired'),\n FAILED: tWithFallback(t, 'sandbox.status.failed', 'Failed'),\n };\n\n const label = labels[status] ?? config.label;\n return (\n <
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/sandbox/components/StatusBadge.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport {\n Clock,\n Loader2,\n CheckCircle2,\n StopCircle,\n AlertTriangle,\n TimerOff,\n XCircle,\n Circle,\n} from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { cn } from '../utils/cn';\nimport type { SandboxStatus } from '../types';\nimport { tWithFallback } from '../utils/i18n';\n\ninterface StatusBadgeProps {\n status: SandboxStatus;\n className?: string;\n showIcon?: boolean;\n size?: 'sm' | 'md';\n}\n\nconst statusConfig: Record<\n SandboxStatus,\n { label: string; color: string; bg: string; icon: FC<{ size?: number; className?: string }> }\n> = {\n PENDING: {\n label: 'Pending',\n color: 'text-status-warning-text',\n bg: 'bg-status-warning-bg-subtle border-border-default',\n icon: Clock,\n },\n PROVISIONING: {\n label: 'Provisioning',\n color: 'text-status-info-text',\n bg: 'bg-status-info-bg-subtle border-border-default',\n icon: Loader2,\n },\n RUNNING: {\n label: 'Running',\n color: 'text-status-success-text',\n bg: 'bg-status-success-bg-subtle border-border-default',\n icon: CheckCircle2,\n },\n STOPPING: {\n label: 'Stopping',\n color: 'text-accent-orange',\n bg: 'bg-accent-orange-subtle border-border-default',\n icon: Loader2,\n },\n STOPPED: {\n label: 'Stopped',\n color: 'text-text-secondary',\n bg: 'bg-bg-sunken border-border-default',\n icon: StopCircle,\n },\n ERROR: {\n label: 'Error',\n color: 'text-status-error-text',\n bg: 'bg-status-error-bg-subtle border-border-default',\n icon: AlertTriangle,\n },\n EXPIRED: {\n label: 'Expired',\n color: 'text-text-secondary',\n bg: 'bg-bg-sunken border-border-default',\n icon: TimerOff,\n },\n FAILED: {\n label: 'Failed',\n color: 'text-status-error-text',\n bg: 'bg-status-error-bg-subtle border-border-default',\n icon: XCircle,\n },\n};\n\n/**\n * Color-coded status badge for sandbox lifecycle states\n */\nexport const StatusBadge: FC<StatusBadgeProps> = ({\n status,\n className,\n showIcon = true,\n size = 'sm',\n}) => {\n const { t } = useI18n();\n const config = statusConfig[status] || {\n label: status,\n color: 'text-muted-foreground',\n bg: 'bg-muted border-border',\n icon: Circle,\n };\n const Icon = config.icon;\n const isAnimated = status === 'PROVISIONING' || status === 'STOPPING';\n const labels: Record<SandboxStatus, string> = {\n PENDING: tWithFallback(t, 'sandbox.status.pending', 'Pending'),\n PROVISIONING: tWithFallback(t, 'sandbox.status.provisioning', 'Provisioning'),\n RUNNING: tWithFallback(t, 'sandbox.status.running', 'Running'),\n STOPPING: tWithFallback(t, 'sandbox.status.stopping', 'Stopping'),\n STOPPED: tWithFallback(t, 'sandbox.status.stopped', 'Stopped'),\n ERROR: tWithFallback(t, 'sandbox.status.error', 'Error'),\n EXPIRED: tWithFallback(t, 'sandbox.status.expired', 'Expired'),\n FAILED: tWithFallback(t, 'sandbox.status.failed', 'Failed'),\n };\n\n const label = labels[status] ?? config.label;\n return (\n <output\n aria-label={label}\n className={cn(\n 'inline-flex items-center gap-1.5 border rounded-full font-medium',\n size === 'sm' ? 'px-2.5 py-0.5 text-xs' : 'px-3 py-1 text-sm',\n config.bg,\n config.color,\n className\n )}\n >\n {showIcon && (\n <Icon\n size={size === 'sm' ? 12 : 14}\n aria-hidden=\"true\"\n className={cn(isAnimated && 'animate-spin')}\n />\n )}\n {label}\n </output>\n );\n};\n"],"mappings":";;;;;;AAuBA,IAAM,IAGF;CACF,SAAS;EACP,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP;CACD,cAAc;EACZ,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP;CACD,SAAS;EACP,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP;CACD,UAAU;EACR,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP;CACD,SAAS;EACP,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP;CACD,OAAO;EACL,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP;CACD,SAAS;EACP,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP;CACD,QAAQ;EACN,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP;CACF,EAKY,KAAqC,EAChD,WACA,cACA,cAAW,IACX,UAAO,WACH;CACJ,IAAM,EAAE,SAAM,GAAS,EACjB,IAAS,EAAa,MAAW;EACrC,OAAO;EACP,OAAO;EACP,IAAI;EACJ,MAAM;EACP,EACK,IAAO,EAAO,MACd,IAAa,MAAW,kBAAkB,MAAW,YAYrD,IAXwC;EAC5C,SAAS,EAAc,GAAG,0BAA0B,UAAU;EAC9D,cAAc,EAAc,GAAG,+BAA+B,eAAe;EAC7E,SAAS,EAAc,GAAG,0BAA0B,UAAU;EAC9D,UAAU,EAAc,GAAG,2BAA2B,WAAW;EACjE,SAAS,EAAc,GAAG,0BAA0B,UAAU;EAC9D,OAAO,EAAc,GAAG,wBAAwB,QAAQ;EACxD,SAAS,EAAc,GAAG,0BAA0B,UAAU;EAC9D,QAAQ,EAAc,GAAG,yBAAyB,SAAS;EAC5D,CAEoB,MAAW,EAAO;AACvC,QACE,kBAAC,UAAD;EACE,cAAY;EACZ,WAAW,EACT,oEACA,MAAS,OAAO,0BAA0B,qBAC1C,EAAO,IACP,EAAO,OACP,EACD;YARH,CAUG,KACC,kBAAC,GAAD;GACE,MAAM,MAAS,OAAO,KAAK;GAC3B,eAAY;GACZ,WAAW,EAAG,KAAc,eAAe;GAC3C,CAAA,EAEH,EACM"}
|
|
@@ -11,8 +11,7 @@ function o({ value: o, onChange: s, placeholder: c, maxTags: l = 32, maxLength:
|
|
|
11
11
|
}, h = (e) => s(o.filter((t) => t !== e)), g = (e) => {
|
|
12
12
|
e.key === "Enter" || e.key === "," || e.key === "Tab" ? d.trim() && (e.preventDefault(), m(d), f("")) : e.key === "Backspace" && d === "" && o.length && (e.preventDefault(), h(o[o.length - 1]));
|
|
13
13
|
}, _ = c ?? e(p, "sandbox.form.tags.placeholder", "Add a tag and press Enter");
|
|
14
|
-
return /* @__PURE__ */ a("
|
|
15
|
-
role: "group",
|
|
14
|
+
return /* @__PURE__ */ a("fieldset", {
|
|
16
15
|
"aria-label": e(p, "sandbox.form.tags.label", "Tags"),
|
|
17
16
|
className: "flex flex-wrap items-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-2 py-1.5",
|
|
18
17
|
children: [o.map((t) => /* @__PURE__ */ a("span", {
|
|
@@ -36,6 +35,7 @@ function o({ value: o, onChange: s, placeholder: c, maxTags: l = 32, maxLength:
|
|
|
36
35
|
d.trim() && (m(d), f(""));
|
|
37
36
|
},
|
|
38
37
|
placeholder: o.length ? "" : _,
|
|
38
|
+
"aria-label": e(p, "sandbox.form.tags.input", "Add tag"),
|
|
39
39
|
className: "flex-1 min-w-[8rem] bg-transparent text-sm text-foreground outline-none placeholder:text-text-tertiary"
|
|
40
40
|
})]
|
|
41
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsInput.js","names":[],"sources":["../../../src/sandbox/components/TagsInput.tsx"],"sourcesContent":["import { useState, type KeyboardEvent } from 'react';\nimport { X } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\ninterface Props {\n value: string[];\n onChange: (next: string[]) => void;\n placeholder?: string;\n maxTags?: number;\n maxLength?: number;\n}\n\n/**\n * Lightweight chip-style tag input. JSON-array tags (no FK to wspace-tags-svc),\n * matching the backend `tags: String[]` on Sandbox / SandboxTemplate.\n */\nexport function TagsInput({ value, onChange, placeholder, maxTags = 32, maxLength = 64 }: Props) {\n const [draft, setDraft] = useState('');\n const { t } = useI18n();\n\n const addTag = (raw: string) => {\n const tag = raw.trim().slice(0, maxLength);\n if (!tag) return;\n if (value.includes(tag)) return;\n if (value.length >= maxTags) return;\n onChange([...value, tag]);\n };\n\n const removeTag = (tag: string) => onChange(value.filter((t) => t !== tag));\n\n const handleKey = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ',' || event.key === 'Tab') {\n if (draft.trim()) {\n event.preventDefault();\n addTag(draft);\n setDraft('');\n }\n } else if (event.key === 'Backspace' && draft === '' && value.length) {\n event.preventDefault();\n removeTag(value[value.length - 1]);\n }\n };\n\n const ph =\n placeholder ?? tWithFallback(t, 'sandbox.form.tags.placeholder', 'Add a tag and press Enter');\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"TagsInput.js","names":[],"sources":["../../../src/sandbox/components/TagsInput.tsx"],"sourcesContent":["import { useState, type KeyboardEvent } from 'react';\nimport { X } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\ninterface Props {\n value: string[];\n onChange: (next: string[]) => void;\n placeholder?: string;\n maxTags?: number;\n maxLength?: number;\n}\n\n/**\n * Lightweight chip-style tag input. JSON-array tags (no FK to wspace-tags-svc),\n * matching the backend `tags: String[]` on Sandbox / SandboxTemplate.\n */\nexport function TagsInput({ value, onChange, placeholder, maxTags = 32, maxLength = 64 }: Props) {\n const [draft, setDraft] = useState('');\n const { t } = useI18n();\n\n const addTag = (raw: string) => {\n const tag = raw.trim().slice(0, maxLength);\n if (!tag) return;\n if (value.includes(tag)) return;\n if (value.length >= maxTags) return;\n onChange([...value, tag]);\n };\n\n const removeTag = (tag: string) => onChange(value.filter((t) => t !== tag));\n\n const handleKey = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ',' || event.key === 'Tab') {\n if (draft.trim()) {\n event.preventDefault();\n addTag(draft);\n setDraft('');\n }\n } else if (event.key === 'Backspace' && draft === '' && value.length) {\n event.preventDefault();\n removeTag(value[value.length - 1]);\n }\n };\n\n const ph =\n placeholder ?? tWithFallback(t, 'sandbox.form.tags.placeholder', 'Add a tag and press Enter');\n\n return (\n <fieldset\n aria-label={tWithFallback(t, 'sandbox.form.tags.label', 'Tags')}\n className=\"flex flex-wrap items-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-2 py-1.5\"\n >\n {value.map((tag) => (\n <span\n key={tag}\n className=\"inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary\"\n >\n {tag}\n <button\n type=\"button\"\n onClick={() => removeTag(tag)}\n aria-label={tWithFallback(t, 'sandbox.form.tags.remove', `Remove tag ${tag}`, { tag })}\n className=\"text-text-tertiary hover:text-text-secondary\"\n >\n <X size={12} aria-hidden=\"true\" />\n </button>\n </span>\n ))}\n <input\n type=\"text\"\n value={draft}\n onChange={(e) => setDraft(e.target.value.slice(0, maxLength))}\n onKeyDown={handleKey}\n onBlur={() => {\n if (draft.trim()) {\n addTag(draft);\n setDraft('');\n }\n }}\n placeholder={value.length ? '' : ph}\n aria-label={tWithFallback(t, 'sandbox.form.tags.input', 'Add tag')}\n className=\"flex-1 min-w-[8rem] bg-transparent text-sm text-foreground outline-none placeholder:text-text-tertiary\"\n />\n </fieldset>\n );\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,EAAU,EAAE,UAAO,aAAU,gBAAa,aAAU,IAAI,eAAY,MAAa;CAC/F,IAAM,CAAC,GAAO,KAAY,EAAS,GAAG,EAChC,EAAE,SAAM,GAAS,EA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