@burdenoff/microfe-sandbox 2026.525.3 → 2026.527.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/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 +294 -249
- 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 +1 -1
|
@@ -1,75 +1,67 @@
|
|
|
1
1
|
import { tWithFallback as e } from "../utils/i18n.js";
|
|
2
2
|
import { useRemainingSeconds as t } from "../hooks/useRemainingSeconds.js";
|
|
3
|
-
import {
|
|
4
|
-
import { AlertTriangle as
|
|
5
|
-
import { useI18n as
|
|
6
|
-
import { jsx as
|
|
3
|
+
import { useRef as n } from "react";
|
|
4
|
+
import { AlertTriangle as r, Plus as i, Timer as a } from "lucide-react";
|
|
5
|
+
import { useI18n as o } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
7
|
//#region src/sandbox/components/CountdownTimer.tsx
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
m,
|
|
17
|
-
h,
|
|
18
|
-
_
|
|
19
|
-
]), n(() => {
|
|
20
|
-
g(!1);
|
|
21
|
-
}, [u]);
|
|
22
|
-
let v = Math.floor(m / 3600), y = Math.floor(m % 3600 / 60), b = m % 60, x = (e) => String(e).padStart(2, "0"), S = v > 0 ? `${x(v)}:${x(y)}:${x(b)}` : `${x(y)}:${x(b)}`, C = m <= 0 ? "text-text-secondary" : m <= 30 ? "text-status-error-text animate-pulse" : m <= 60 ? "text-status-error-text" : m <= 300 ? "text-status-warning-text" : "text-status-success-text", w = m <= 0 ? "bg-bg-sunken border-border-subtle" : m <= 60 ? "bg-status-error-bg-subtle border-border-default" : m <= 300 ? "bg-status-warning-bg-subtle border-border-default" : "bg-status-success-bg-subtle border-border-default", T = Math.max(1, Math.ceil(m / 60)), E = m <= 0 ? e(_, "sandbox.timer.expired", "Expired") : e(_, "sandbox.timer.remaining", `${T} minutes remaining`, { count: T });
|
|
23
|
-
return p ? /* @__PURE__ */ l("span", {
|
|
8
|
+
function l({ expiresAt: l, onExpired: u, onExtend: d, compact: f = !1 }) {
|
|
9
|
+
let p = t(l, u), { t: m } = o(), h = n(null);
|
|
10
|
+
h.current !== l && p <= 60 && p > 0 && typeof window < "u" && "Notification" in window && Notification.permission === "granted" && (h.current = l, new Notification(e(m, "sandbox.timer.alertTitle", "Sandbox expiring"), {
|
|
11
|
+
body: e(m, "sandbox.timer.alertBody", "Your sandbox will be destroyed in less than 1 minute. Extend it to continue working."),
|
|
12
|
+
icon: "/favicon.ico"
|
|
13
|
+
}));
|
|
14
|
+
let g = Math.floor(p / 3600), _ = Math.floor(p % 3600 / 60), v = p % 60, y = (e) => String(e).padStart(2, "0"), b = g > 0 ? `${y(g)}:${y(_)}:${y(v)}` : `${y(_)}:${y(v)}`, x = p <= 0 ? "text-text-secondary" : p <= 30 ? "text-status-error-text animate-pulse" : p <= 60 ? "text-status-error-text" : p <= 300 ? "text-status-warning-text" : "text-status-success-text", S = p <= 0 ? "bg-bg-sunken border-border-subtle" : p <= 60 ? "bg-status-error-bg-subtle border-border-default" : p <= 300 ? "bg-status-warning-bg-subtle border-border-default" : "bg-status-success-bg-subtle border-border-default", C = Math.max(1, Math.ceil(p / 60)), w = p <= 0 ? e(m, "sandbox.timer.expired", "Expired") : e(m, "sandbox.timer.remaining", `${C} minutes remaining`, { count: C });
|
|
15
|
+
return f ? /* @__PURE__ */ c("span", {
|
|
24
16
|
role: "timer",
|
|
25
17
|
"aria-live": "polite",
|
|
26
|
-
"aria-label":
|
|
27
|
-
className: `inline-flex items-center gap-1 text-sm font-mono ${
|
|
28
|
-
children: [/* @__PURE__ */
|
|
18
|
+
"aria-label": w,
|
|
19
|
+
className: `inline-flex items-center gap-1 text-sm font-mono ${x}`,
|
|
20
|
+
children: [/* @__PURE__ */ s(a, {
|
|
29
21
|
"aria-hidden": "true",
|
|
30
|
-
className: "
|
|
31
|
-
}),
|
|
32
|
-
}) : /* @__PURE__ */
|
|
22
|
+
className: "size-3.5"
|
|
23
|
+
}), b]
|
|
24
|
+
}) : /* @__PURE__ */ c("div", {
|
|
33
25
|
role: "timer",
|
|
34
26
|
"aria-live": "polite",
|
|
35
|
-
"aria-label":
|
|
36
|
-
className: `flex items-center gap-3 rounded-lg border px-4 py-2 ${
|
|
27
|
+
"aria-label": w,
|
|
28
|
+
className: `flex items-center gap-3 rounded-lg border px-4 py-2 ${S}`,
|
|
37
29
|
children: [
|
|
38
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ s(a, {
|
|
39
31
|
"aria-hidden": "true",
|
|
40
|
-
className: `
|
|
32
|
+
className: `size-5 ${x}`
|
|
41
33
|
}),
|
|
42
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ c("div", {
|
|
43
35
|
className: "flex flex-col",
|
|
44
|
-
children: [/* @__PURE__ */
|
|
45
|
-
className: `text-lg font-mono font-semibold ${
|
|
46
|
-
children:
|
|
47
|
-
}), /* @__PURE__ */
|
|
36
|
+
children: [/* @__PURE__ */ s("span", {
|
|
37
|
+
className: `text-lg font-mono font-semibold ${x}`,
|
|
38
|
+
children: b
|
|
39
|
+
}), /* @__PURE__ */ s("span", {
|
|
48
40
|
className: "text-xs text-text-secondary",
|
|
49
|
-
children:
|
|
41
|
+
children: p <= 0 ? e(m, "sandbox.timer.expired", "Expired") : e(m, "sandbox.timer.label", "Time remaining")
|
|
50
42
|
})]
|
|
51
43
|
}),
|
|
52
|
-
|
|
44
|
+
p <= 60 && p > 0 && /* @__PURE__ */ c("div", {
|
|
53
45
|
className: "flex items-center gap-1 text-xs text-status-error-text font-medium",
|
|
54
|
-
children: [/* @__PURE__ */
|
|
46
|
+
children: [/* @__PURE__ */ s(r, {
|
|
55
47
|
"aria-hidden": "true",
|
|
56
|
-
className: "
|
|
57
|
-
}), e(
|
|
48
|
+
className: "size-3.5"
|
|
49
|
+
}), e(m, "sandbox.timer.expiringSoon", "Expiring soon")]
|
|
58
50
|
}),
|
|
59
|
-
|
|
51
|
+
d && p > 0 && /* @__PURE__ */ c("button", {
|
|
60
52
|
type: "button",
|
|
61
|
-
onClick:
|
|
62
|
-
"aria-label": e(
|
|
53
|
+
onClick: d,
|
|
54
|
+
"aria-label": e(m, "sandbox.timer.extend", "Extend sandbox duration"),
|
|
63
55
|
className: "ml-auto flex items-center gap-1 rounded-md bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-secondary shadow-sm border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ s(i, {
|
|
65
57
|
"aria-hidden": "true",
|
|
66
|
-
className: "
|
|
67
|
-
}), e(
|
|
58
|
+
className: "size-3.5"
|
|
59
|
+
}), e(m, "sandbox.timer.extend", "Extend")]
|
|
68
60
|
})
|
|
69
61
|
]
|
|
70
62
|
});
|
|
71
63
|
}
|
|
72
64
|
//#endregion
|
|
73
|
-
export {
|
|
65
|
+
export { l as CountdownTimer };
|
|
74
66
|
|
|
75
67
|
//# sourceMappingURL=CountdownTimer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CountdownTimer.js","names":[],"sources":["../../../src/sandbox/components/CountdownTimer.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"CountdownTimer.js","names":[],"sources":["../../../src/sandbox/components/CountdownTimer.tsx"],"sourcesContent":["import { useRef } from 'react';\nimport { Timer, Plus, AlertTriangle } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useRemainingSeconds } from '../hooks/useRemainingSeconds';\n\ninterface CountdownTimerProps {\n expiresAt: string;\n onExpired?: () => void;\n onExtend?: () => void;\n compact?: boolean;\n}\n\nexport function CountdownTimer({\n expiresAt,\n onExpired,\n onExtend,\n compact = false,\n}: CountdownTimerProps) {\n const remainingSeconds = useRemainingSeconds(expiresAt, onExpired);\n const { t } = useI18n();\n\n // Browser notification at 60 seconds remaining, once per expiresAt window.\n // Ref-based flag avoids a render cycle and tracks the active expiresAt directly.\n const alertedForRef = useRef<string | null>(null);\n if (\n alertedForRef.current !== expiresAt &&\n remainingSeconds <= 60 &&\n remainingSeconds > 0 &&\n typeof window !== 'undefined' &&\n 'Notification' in window &&\n Notification.permission === 'granted'\n ) {\n alertedForRef.current = expiresAt;\n new Notification(tWithFallback(t, 'sandbox.timer.alertTitle', 'Sandbox expiring'), {\n body: tWithFallback(\n t,\n 'sandbox.timer.alertBody',\n 'Your sandbox will be destroyed in less than 1 minute. Extend it to continue working.'\n ),\n icon: '/favicon.ico',\n });\n }\n\n const hours = Math.floor(remainingSeconds / 3600);\n const minutes = Math.floor((remainingSeconds % 3600) / 60);\n const seconds = remainingSeconds % 60;\n const fmt = (n: number) => String(n).padStart(2, '0');\n const timeString =\n hours > 0 ? `${fmt(hours)}:${fmt(minutes)}:${fmt(seconds)}` : `${fmt(minutes)}:${fmt(seconds)}`;\n\n const color = (() => {\n if (remainingSeconds <= 0) return 'text-text-secondary';\n if (remainingSeconds <= 30) return 'text-status-error-text animate-pulse';\n if (remainingSeconds <= 60) return 'text-status-error-text';\n if (remainingSeconds <= 300) return 'text-status-warning-text';\n return 'text-status-success-text';\n })();\n\n const bg = (() => {\n if (remainingSeconds <= 0) return 'bg-bg-sunken border-border-subtle';\n if (remainingSeconds <= 60) return 'bg-status-error-bg-subtle border-border-default';\n if (remainingSeconds <= 300) return 'bg-status-warning-bg-subtle border-border-default';\n return 'bg-status-success-bg-subtle border-border-default';\n })();\n\n const remainingMinutes = Math.max(1, Math.ceil(remainingSeconds / 60));\n const accessibleLabel =\n remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.remaining', `${remainingMinutes} minutes remaining`, {\n count: remainingMinutes,\n });\n\n if (compact) {\n return (\n <span\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`inline-flex items-center gap-1 text-sm font-mono ${color}`}\n >\n <Timer aria-hidden=\"true\" className=\"size-3.5\" />\n {timeString}\n </span>\n );\n }\n\n return (\n <div\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`flex items-center gap-3 rounded-lg border px-4 py-2 ${bg}`}\n >\n <Timer aria-hidden=\"true\" className={`size-5 ${color}`} />\n <div className=\"flex flex-col\">\n <span className={`text-lg font-mono font-semibold ${color}`}>{timeString}</span>\n <span className=\"text-xs text-text-secondary\">\n {remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.label', 'Time remaining')}\n </span>\n </div>\n\n {remainingSeconds <= 60 && remainingSeconds > 0 && (\n <div className=\"flex items-center gap-1 text-xs text-status-error-text font-medium\">\n <AlertTriangle aria-hidden=\"true\" className=\"size-3.5\" />\n {tWithFallback(t, 'sandbox.timer.expiringSoon', 'Expiring soon')}\n </div>\n )}\n\n {onExtend && remainingSeconds > 0 && (\n <button\n type=\"button\"\n onClick={onExtend}\n aria-label={tWithFallback(t, 'sandbox.timer.extend', 'Extend sandbox duration')}\n className=\"ml-auto flex items-center gap-1 rounded-md bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-secondary shadow-sm border border-border-subtle hover:bg-bg-sunken transition-colors\"\n >\n <Plus aria-hidden=\"true\" className=\"size-3.5\" />\n {tWithFallback(t, 'sandbox.timer.extend', 'Extend')}\n </button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,EAAe,EAC7B,cACA,cACA,aACA,aAAU,MACY;CACtB,IAAM,IAAmB,EAAoB,GAAW,EAAU,EAC5D,EAAE,SAAM,GAAS,EAIjB,IAAgB,EAAsB,KAAK;AACjD,CACE,EAAc,YAAY,KAC1B,KAAoB,MACpB,IAAmB,KACnB,OAAO,SAAW,OAClB,kBAAkB,UAClB,aAAa,eAAe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,KAAoB,IACjB,EAAc,GAAG,yBAAyB,UAAU,GACpD,EAAc,GAAG,uBAAuB,iBAAiB;KACxD,CAAA,CACH;;GAEL,KAAoB,MAAM,IAAmB,KAC5C,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAe,eAAY;KAAO,WAAU;KAAa,CAAA,EACxD,EAAc,GAAG,8BAA8B,gBAAgB,CAC5D;;GAGP,KAAY,IAAmB,KAC9B,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,EAAc,GAAG,wBAAwB,0BAA0B;IAC/E,WAAU;cAJZ,CAME,kBAAC,GAAD;KAAM,eAAY;KAAO,WAAU;KAAa,CAAA,EAC/C,EAAc,GAAG,wBAAwB,SAAS,CAC5C;;GAEP"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { tWithFallback as e } from "../utils/i18n.js";
|
|
2
2
|
import { useSandboxEvents as t } from "../utils/sandboxEvents.js";
|
|
3
|
-
import {
|
|
4
|
-
import { gql as
|
|
5
|
-
import { useMutation as
|
|
6
|
-
import { useI18n as
|
|
7
|
-
import { Fragment as
|
|
3
|
+
import { useRef as n, useState as r } from "react";
|
|
4
|
+
import { gql as i } from "@apollo/client";
|
|
5
|
+
import { useMutation as a, useSubscription as o } from "@apollo/client/react";
|
|
6
|
+
import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
8
|
//#region src/sandbox/components/ExportSandboxesDialog.tsx
|
|
9
|
-
var
|
|
9
|
+
var d = i`
|
|
10
10
|
mutation ExportSandboxes($input: ExportSandboxesInput!) {
|
|
11
11
|
exportSandboxes(input: $input) {
|
|
12
12
|
id
|
|
@@ -18,7 +18,7 @@ var u = r`
|
|
|
18
18
|
errorMessage
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
`,
|
|
21
|
+
`, f = i`
|
|
22
22
|
subscription OnSandboxExportJobChanged($workspaceId: ID!, $jobId: ID!) {
|
|
23
23
|
onSandboxExportJobChanged(workspaceId: $workspaceId, jobId: $jobId) {
|
|
24
24
|
id
|
|
@@ -31,93 +31,95 @@ var u = r`
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
`;
|
|
34
|
-
function
|
|
35
|
-
let { t:
|
|
36
|
-
if (
|
|
34
|
+
function p({ workspaceId: i, open: p, onClose: m }) {
|
|
35
|
+
let { t: h } = s(), g = t(), [_, v] = r("CSV"), [y, b] = r(!1), x = n(null), [S, C] = r(!1), [w, T] = r(null), [E, { loading: D }] = a(d);
|
|
36
|
+
if (o(f, {
|
|
37
37
|
variables: {
|
|
38
|
-
workspaceId:
|
|
39
|
-
jobId:
|
|
38
|
+
workspaceId: i,
|
|
39
|
+
jobId: x.current
|
|
40
40
|
},
|
|
41
|
-
skip: !
|
|
41
|
+
skip: !S,
|
|
42
42
|
onData: ({ data: e }) => {
|
|
43
43
|
let t = e.data?.onSandboxExportJobChanged;
|
|
44
|
-
t &&
|
|
44
|
+
t && T(t);
|
|
45
45
|
}
|
|
46
|
-
}), !
|
|
47
|
-
let
|
|
48
|
-
let { data: e } = await
|
|
49
|
-
workspaceId:
|
|
50
|
-
format:
|
|
51
|
-
includeUsageEvents:
|
|
52
|
-
context: { workspaceId:
|
|
46
|
+
}), !p) return null;
|
|
47
|
+
let O = async () => {
|
|
48
|
+
let { data: e } = await E({ variables: { input: {
|
|
49
|
+
workspaceId: i,
|
|
50
|
+
format: _,
|
|
51
|
+
includeUsageEvents: y,
|
|
52
|
+
context: { workspaceId: i }
|
|
53
53
|
} } });
|
|
54
|
-
e?.exportSandboxes && (x
|
|
54
|
+
e?.exportSandboxes && (x.current = e.exportSandboxes.id, C(!0), T(e.exportSandboxes), g.sandboxExportRequested({
|
|
55
55
|
jobId: e.exportSandboxes.id,
|
|
56
|
-
format:
|
|
56
|
+
format: _
|
|
57
57
|
}));
|
|
58
|
-
},
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
|
|
58
|
+
}, k = e(h, "sandbox.exportDialog.title", "Export sandboxes");
|
|
59
|
+
return /* @__PURE__ */ l("dialog", {
|
|
60
|
+
open: !0,
|
|
61
61
|
"aria-modal": "true",
|
|
62
|
-
"aria-label":
|
|
63
|
-
className: "fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay/40 p-4",
|
|
64
|
-
children: /* @__PURE__ */
|
|
62
|
+
"aria-label": k,
|
|
63
|
+
className: "fixed inset-0 z-50 m-0 flex h-full w-full items-center justify-center bg-bg-overlay/40 p-4",
|
|
64
|
+
children: /* @__PURE__ */ u("div", {
|
|
65
65
|
className: "w-full max-w-md rounded-lg border border-border-default bg-bg-surface p-5 shadow-lg",
|
|
66
66
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ l("h2", {
|
|
68
68
|
className: "text-base font-semibold text-foreground",
|
|
69
|
-
children:
|
|
69
|
+
children: k
|
|
70
70
|
}),
|
|
71
|
-
|
|
71
|
+
w ? /* @__PURE__ */ l("div", {
|
|
72
72
|
className: "mt-4 space-y-3 text-sm text-text-secondary",
|
|
73
|
-
children:
|
|
74
|
-
href:
|
|
73
|
+
children: w.status === "COMPLETED" && w.downloadUrl ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("p", { children: e(h, "sandbox.exportDialog.ready", "Export ready") }), /* @__PURE__ */ l("a", {
|
|
74
|
+
href: w.downloadUrl,
|
|
75
75
|
target: "_blank",
|
|
76
76
|
rel: "noopener noreferrer",
|
|
77
77
|
className: "inline-block rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text",
|
|
78
|
-
children: e(
|
|
79
|
-
})] }) :
|
|
78
|
+
children: e(h, "sandbox.exportDialog.download", "Download")
|
|
79
|
+
})] }) : w.status === "FAILED" ? /* @__PURE__ */ l("p", {
|
|
80
80
|
className: "text-status-error-text",
|
|
81
|
-
children: e(
|
|
82
|
-
}) : /* @__PURE__ */
|
|
83
|
-
}) : /* @__PURE__ */
|
|
81
|
+
children: e(h, "sandbox.exportDialog.failed", `Export failed: ${w.errorMessage}`, { error: w.errorMessage ?? "unknown" })
|
|
82
|
+
}) : /* @__PURE__ */ l("p", { children: e(h, "sandbox.exportDialog.preparing", "Preparing export…") })
|
|
83
|
+
}) : /* @__PURE__ */ u("div", {
|
|
84
84
|
className: "mt-4 space-y-3",
|
|
85
|
-
children: [/* @__PURE__ */
|
|
85
|
+
children: [/* @__PURE__ */ u("fieldset", { children: [/* @__PURE__ */ l("legend", {
|
|
86
86
|
className: "text-sm font-medium text-text-secondary",
|
|
87
|
-
children: e(
|
|
88
|
-
}), /* @__PURE__ */
|
|
87
|
+
children: e(h, "sandbox.exportDialog.format.label", "Format")
|
|
88
|
+
}), /* @__PURE__ */ l("div", {
|
|
89
89
|
className: "mt-2 flex gap-3",
|
|
90
|
-
children: ["CSV", "JSON"].map((e) => /* @__PURE__ */
|
|
90
|
+
children: ["CSV", "JSON"].map((e) => /* @__PURE__ */ u("label", {
|
|
91
91
|
className: "inline-flex items-center gap-1.5 text-sm",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
92
|
+
children: [/* @__PURE__ */ l("input", {
|
|
93
93
|
type: "radio",
|
|
94
94
|
name: "format",
|
|
95
|
-
checked:
|
|
96
|
-
onChange: () =>
|
|
95
|
+
checked: _ === e,
|
|
96
|
+
onChange: () => v(e),
|
|
97
|
+
"aria-label": e
|
|
97
98
|
}), e]
|
|
98
99
|
}, e))
|
|
99
|
-
})] }), /* @__PURE__ */
|
|
100
|
+
})] }), /* @__PURE__ */ u("label", {
|
|
100
101
|
className: "flex items-center gap-2 text-sm text-text-secondary",
|
|
101
|
-
children: [/* @__PURE__ */
|
|
102
|
+
children: [/* @__PURE__ */ l("input", {
|
|
102
103
|
type: "checkbox",
|
|
103
|
-
checked:
|
|
104
|
-
onChange: (e) =>
|
|
105
|
-
|
|
104
|
+
checked: y,
|
|
105
|
+
onChange: (e) => b(e.target.checked),
|
|
106
|
+
"aria-label": e(h, "sandbox.exportDialog.includeUsage", "Include usage events")
|
|
107
|
+
}), e(h, "sandbox.exportDialog.includeUsage", "Include usage events")]
|
|
106
108
|
})]
|
|
107
109
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ u("div", {
|
|
109
111
|
className: "mt-5 flex justify-end gap-2",
|
|
110
|
-
children: [/* @__PURE__ */
|
|
112
|
+
children: [/* @__PURE__ */ l("button", {
|
|
111
113
|
type: "button",
|
|
112
|
-
onClick:
|
|
114
|
+
onClick: m,
|
|
113
115
|
className: "rounded-md border border-border-subtle px-3 py-1.5 text-sm text-text-secondary hover:bg-bg-sunken",
|
|
114
|
-
children: e(
|
|
115
|
-
}), !
|
|
116
|
+
children: e(h, "sandbox.exportDialog.cancel", "Cancel")
|
|
117
|
+
}), !w && /* @__PURE__ */ l("button", {
|
|
116
118
|
type: "button",
|
|
117
|
-
onClick:
|
|
118
|
-
disabled:
|
|
119
|
+
onClick: O,
|
|
120
|
+
disabled: D,
|
|
119
121
|
className: "rounded-md bg-status-info-bg-default px-3 py-1.5 text-sm text-status-info-text-inverse disabled:opacity-50",
|
|
120
|
-
children: e(
|
|
122
|
+
children: e(h, "sandbox.exportDialog.submit", "Export")
|
|
121
123
|
})]
|
|
122
124
|
})
|
|
123
125
|
]
|
|
@@ -125,6 +127,6 @@ function f({ workspaceId: r, open: f, onClose: p }) {
|
|
|
125
127
|
});
|
|
126
128
|
}
|
|
127
129
|
//#endregion
|
|
128
|
-
export {
|
|
130
|
+
export { p as ExportSandboxesDialog };
|
|
129
131
|
|
|
130
132
|
//# sourceMappingURL=ExportSandboxesDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportSandboxesDialog.js","names":[],"sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useSubscription } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useSandboxEvents } from '../utils/sandboxEvents';\n\nconst EXPORT_MUTATION = gql`\n mutation ExportSandboxes($input: ExportSandboxesInput!) {\n exportSandboxes(input: $input) {\n id\n workspaceId\n status\n format\n downloadUrl\n expiresAt\n errorMessage\n }\n }\n`;\n\nconst EXPORT_SUBSCRIPTION = gql`\n subscription OnSandboxExportJobChanged($workspaceId: ID!, $jobId: ID!) {\n onSandboxExportJobChanged(workspaceId: $workspaceId, jobId: $jobId) {\n id\n status\n format\n rowCount\n downloadUrl\n expiresAt\n errorMessage\n }\n }\n`;\n\ntype ExportFormat = 'CSV' | 'JSON';\ntype Job = {\n id: string;\n status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';\n format: ExportFormat;\n rowCount?: number | null;\n downloadUrl?: string | null;\n expiresAt?: string | null;\n errorMessage?: string | null;\n};\n\ninterface Props {\n workspaceId: string;\n open: boolean;\n onClose: () => void;\n}\n\nexport function ExportSandboxesDialog({ workspaceId, open, onClose }: Props) {\n const { t } = useI18n();\n const events = useSandboxEvents();\n const [format, setFormat] = useState<ExportFormat>('CSV');\n const [includeUsage, setIncludeUsage] = useState(false);\n const
|
|
1
|
+
{"version":3,"file":"ExportSandboxesDialog.js","names":[],"sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"sourcesContent":["import { useState, useRef } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useSubscription } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useSandboxEvents } from '../utils/sandboxEvents';\n\nconst EXPORT_MUTATION = gql`\n mutation ExportSandboxes($input: ExportSandboxesInput!) {\n exportSandboxes(input: $input) {\n id\n workspaceId\n status\n format\n downloadUrl\n expiresAt\n errorMessage\n }\n }\n`;\n\nconst EXPORT_SUBSCRIPTION = gql`\n subscription OnSandboxExportJobChanged($workspaceId: ID!, $jobId: ID!) {\n onSandboxExportJobChanged(workspaceId: $workspaceId, jobId: $jobId) {\n id\n status\n format\n rowCount\n downloadUrl\n expiresAt\n errorMessage\n }\n }\n`;\n\ntype ExportFormat = 'CSV' | 'JSON';\ntype Job = {\n id: string;\n status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';\n format: ExportFormat;\n rowCount?: number | null;\n downloadUrl?: string | null;\n expiresAt?: string | null;\n errorMessage?: string | null;\n};\n\ninterface Props {\n workspaceId: string;\n open: boolean;\n onClose: () => void;\n}\n\nexport function ExportSandboxesDialog({ workspaceId, open, onClose }: Props) {\n const { t } = useI18n();\n const events = useSandboxEvents();\n const [format, setFormat] = useState<ExportFormat>('CSV');\n const [includeUsage, setIncludeUsage] = useState(false);\n // Job id is only read inside the subscription callback (not the render),\n // so keep it in a ref to avoid an unused-state re-render per status tick.\n const jobIdRef = useRef<string | null>(null);\n const [jobIdActive, setJobIdActive] = useState(false);\n const [job, setJob] = useState<Job | null>(null);\n\n const [trigger, { loading }] = useMutation<{ exportSandboxes: Job }>(EXPORT_MUTATION);\n\n useSubscription<{ onSandboxExportJobChanged: Job }>(EXPORT_SUBSCRIPTION, {\n variables: { workspaceId, jobId: jobIdRef.current! },\n skip: !jobIdActive,\n onData: ({ data }: { data: { data?: { onSandboxExportJobChanged?: Job } | null } }) => {\n const next = data.data?.onSandboxExportJobChanged;\n if (next) setJob(next);\n },\n });\n\n if (!open) return null;\n\n const start = async () => {\n const { data } = await trigger({\n variables: {\n input: { workspaceId, format, includeUsageEvents: includeUsage, context: { workspaceId } },\n },\n });\n if (data?.exportSandboxes) {\n jobIdRef.current = data.exportSandboxes.id;\n setJobIdActive(true);\n setJob(data.exportSandboxes);\n events.sandboxExportRequested({ jobId: data.exportSandboxes.id, format });\n }\n };\n\n const heading = tWithFallback(t, 'sandbox.exportDialog.title', 'Export sandboxes');\n\n return (\n <dialog\n open\n aria-modal=\"true\"\n aria-label={heading}\n className=\"fixed inset-0 z-50 m-0 flex h-full w-full items-center justify-center bg-bg-overlay/40 p-4\"\n >\n <div className=\"w-full max-w-md rounded-lg border border-border-default bg-bg-surface p-5 shadow-lg\">\n <h2 className=\"text-base font-semibold text-foreground\">{heading}</h2>\n {job ? (\n <div className=\"mt-4 space-y-3 text-sm text-text-secondary\">\n {job.status === 'COMPLETED' && job.downloadUrl ? (\n <>\n <p>{tWithFallback(t, 'sandbox.exportDialog.ready', 'Export ready')}</p>\n <a\n href={job.downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-block rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.download', 'Download')}\n </a>\n </>\n ) : job.status === 'FAILED' ? (\n <p className=\"text-status-error-text\">\n {tWithFallback(\n t,\n 'sandbox.exportDialog.failed',\n `Export failed: ${job.errorMessage}`,\n {\n error: job.errorMessage ?? 'unknown',\n }\n )}\n </p>\n ) : (\n <p>{tWithFallback(t, 'sandbox.exportDialog.preparing', 'Preparing export…')}</p>\n )}\n </div>\n ) : (\n <div className=\"mt-4 space-y-3\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-secondary\">\n {tWithFallback(t, 'sandbox.exportDialog.format.label', 'Format')}\n </legend>\n <div className=\"mt-2 flex gap-3\">\n {(['CSV', 'JSON'] as const).map((f) => (\n <label key={f} className=\"inline-flex items-center gap-1.5 text-sm\">\n <input\n type=\"radio\"\n name=\"format\"\n checked={format === f}\n onChange={() => setFormat(f)}\n aria-label={f}\n />\n {f}\n </label>\n ))}\n </div>\n </fieldset>\n <label className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <input\n type=\"checkbox\"\n checked={includeUsage}\n onChange={(e) => setIncludeUsage(e.target.checked)}\n aria-label={tWithFallback(\n t,\n 'sandbox.exportDialog.includeUsage',\n 'Include usage events'\n )}\n />\n {tWithFallback(t, 'sandbox.exportDialog.includeUsage', 'Include usage events')}\n </label>\n </div>\n )}\n <div className=\"mt-5 flex justify-end gap-2\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-sm text-text-secondary hover:bg-bg-sunken\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.cancel', 'Cancel')}\n </button>\n {!job && (\n <button\n type=\"button\"\n onClick={start}\n disabled={loading}\n className=\"rounded-md bg-status-info-bg-default px-3 py-1.5 text-sm text-status-info-text-inverse disabled:opacity-50\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.submit', 'Export')}\n </button>\n )}\n </div>\n </div>\n </dialog>\n );\n}\n"],"mappings":";;;;;;;;AAOA,IAAM,IAAkB,CAAG;;;;;;;;;;;;GAcrB,IAAsB,CAAG;;;;;;;;;;;;;AA+B/B,SAAgB,EAAsB,EAAE,gBAAa,SAAM,cAAkB;CAC3E,IAAM,EAAE,SAAM,GAAS,EACjB,IAAS,GAAkB,EAC3B,CAAC,GAAQ,KAAa,EAAuB,MAAM,EACnD,CAAC,GAAc,KAAmB,EAAS,GAAM,EAGjD,IAAW,EAAsB,KAAK,EACtC,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,CAAC,GAAK,KAAU,EAAqB,KAAK,EAE1C,CAAC,GAAS,EAAE,gBAAa,EAAsC,EAAgB;AAWrF,KATA,EAAoD,GAAqB;EACvE,WAAW;GAAE;GAAa,OAAO,EAAS;GAAU;EACpD,MAAM,CAAC;EACP,SAAS,EAAE,cAA4E;GACrF,IAAM,IAAO,EAAK,MAAM;AACxB,GAAI,KAAM,EAAO,EAAK;;EAEzB,CAAC,EAEE,CAAC,EAAM,QAAO;CAElB,IAAM,IAAQ,YAAY;EACxB,IAAM,EAAE,YAAS,MAAM,EAAQ,EAC7B,WAAW,EACT,OAAO;GAAE;GAAa;GAAQ,oBAAoB;GAAc,SAAS,EAAE,gBAAa;GAAE,EAC3F,EACF,CAAC;AACF,EAAI,GAAM,oBACR,EAAS,UAAU,EAAK,gBAAgB,IACxC,EAAe,GAAK,EACpB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C,SAAD;MAAO,WAAU;gBAAjB,CACE,kBAAC,SAAD;OACE,MAAK;OACL,SAAS;OACT,WAAW,MAAM,EAAgB,EAAE,OAAO,QAAQ;OAClD,cAAY,EACV,GACA,qCACA,uBACD;OACD,CAAA,EACD,EAAc,GAAG,qCAAqC,uBAAuB,CACxE;QACJ;;IAER,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;gBAET,EAAc,GAAG,+BAA+B,SAAS;MACnD,CAAA,EACR,CAAC,KACA,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,UAAU;MACV,WAAU;gBAET,EAAc,GAAG,+BAA+B,SAAS;MACnD,CAAA,CAEP;;IACF;;EACC,CAAA"}
|
|
@@ -34,14 +34,16 @@ function s({ isOpen: s, onClose: c, onExtend: l, currentExpiresAt: u, isLoading:
|
|
|
34
34
|
className: "flex items-center justify-between mb-4",
|
|
35
35
|
children: [/* @__PURE__ */ a("div", {
|
|
36
36
|
className: "flex items-center gap-2",
|
|
37
|
-
children: [/* @__PURE__ */ i(n, { className: "
|
|
37
|
+
children: [/* @__PURE__ */ i(n, { className: "size-5 text-accent-blue" }), /* @__PURE__ */ i("h3", {
|
|
38
38
|
className: "text-lg font-semibold",
|
|
39
39
|
children: "Extend Sandbox Duration"
|
|
40
40
|
})]
|
|
41
41
|
}), /* @__PURE__ */ i("button", {
|
|
42
|
+
type: "button",
|
|
42
43
|
onClick: c,
|
|
44
|
+
"aria-label": "Close dialog",
|
|
43
45
|
className: "text-text-tertiary hover:text-text-secondary",
|
|
44
|
-
children: /* @__PURE__ */ i(r, { className: "
|
|
46
|
+
children: /* @__PURE__ */ i(r, { className: "size-5" })
|
|
45
47
|
})]
|
|
46
48
|
}),
|
|
47
49
|
/* @__PURE__ */ a("p", {
|
|
@@ -54,6 +56,7 @@ function s({ isOpen: s, onClose: c, onExtend: l, currentExpiresAt: u, isLoading:
|
|
|
54
56
|
/* @__PURE__ */ i("div", {
|
|
55
57
|
className: "space-y-2 mb-4",
|
|
56
58
|
children: o.map((e, t) => /* @__PURE__ */ a("button", {
|
|
59
|
+
type: "button",
|
|
57
60
|
onClick: () => {
|
|
58
61
|
p(t), h("");
|
|
59
62
|
},
|
|
@@ -64,9 +67,11 @@ function s({ isOpen: s, onClose: c, onExtend: l, currentExpiresAt: u, isLoading:
|
|
|
64
67
|
/* @__PURE__ */ a("div", {
|
|
65
68
|
className: "mb-6",
|
|
66
69
|
children: [/* @__PURE__ */ i("label", {
|
|
70
|
+
htmlFor: "extend-ttl-custom-minutes",
|
|
67
71
|
className: "block text-sm font-medium text-text-secondary mb-1",
|
|
68
72
|
children: "Custom duration (minutes)"
|
|
69
73
|
}), /* @__PURE__ */ i("input", {
|
|
74
|
+
id: "extend-ttl-custom-minutes",
|
|
70
75
|
type: "number",
|
|
71
76
|
min: "1",
|
|
72
77
|
max: "1440",
|
|
@@ -75,6 +80,7 @@ function s({ isOpen: s, onClose: c, onExtend: l, currentExpiresAt: u, isLoading:
|
|
|
75
80
|
h(e.target.value), p(null);
|
|
76
81
|
},
|
|
77
82
|
placeholder: "Enter minutes",
|
|
83
|
+
"aria-label": "Custom duration in minutes",
|
|
78
84
|
className: "w-full rounded-lg border border-border-subtle px-3 py-2 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"
|
|
79
85
|
})]
|
|
80
86
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtendTTLModal.js","names":[],"sources":["../../../src/sandbox/components/ExtendTTLModal.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Clock, X } from 'lucide-react';\nimport { Button } from './ui';\n\ninterface ExtendTTLModalProps {\n isOpen: boolean;\n onClose: () => void;\n onExtend: (additionalSeconds: number) => void;\n currentExpiresAt: string;\n isLoading?: boolean;\n}\n\nconst PRESET_DURATIONS = [\n { label: '15 minutes', seconds: 15 * 60 },\n { label: '30 minutes', seconds: 30 * 60 },\n { label: '1 hour', seconds: 60 * 60 },\n { label: '2 hours', seconds: 2 * 60 * 60 },\n];\n\nexport function ExtendTTLModal({\n isOpen,\n onClose,\n onExtend,\n currentExpiresAt,\n isLoading,\n}: ExtendTTLModalProps) {\n const [selectedPreset, setSelectedPreset] = useState<number | null>(null);\n const [customMinutes, setCustomMinutes] = useState('');\n\n if (!isOpen) return null;\n\n const remainingMs = new Date(currentExpiresAt).getTime() - Date.now();\n const remainingMinutes = Math.max(0, Math.floor(remainingMs / 60000));\n\n const handleExtend = () => {\n let seconds: number;\n if (selectedPreset !== null) {\n seconds = PRESET_DURATIONS[selectedPreset].seconds;\n } else if (customMinutes) {\n seconds = parseInt(customMinutes, 10) * 60;\n if (isNaN(seconds) || seconds <= 0) return;\n } else {\n return;\n }\n onExtend(seconds);\n };\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50\">\n <div className=\"w-full max-w-md rounded-xl bg-bg-surface p-6 shadow-xl\">\n <div className=\"flex items-center justify-between mb-4\">\n <div className=\"flex items-center gap-2\">\n <Clock className=\"
|
|
1
|
+
{"version":3,"file":"ExtendTTLModal.js","names":[],"sources":["../../../src/sandbox/components/ExtendTTLModal.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Clock, X } from 'lucide-react';\nimport { Button } from './ui';\n\ninterface ExtendTTLModalProps {\n isOpen: boolean;\n onClose: () => void;\n onExtend: (additionalSeconds: number) => void;\n currentExpiresAt: string;\n isLoading?: boolean;\n}\n\nconst PRESET_DURATIONS = [\n { label: '15 minutes', seconds: 15 * 60 },\n { label: '30 minutes', seconds: 30 * 60 },\n { label: '1 hour', seconds: 60 * 60 },\n { label: '2 hours', seconds: 2 * 60 * 60 },\n];\n\nexport function ExtendTTLModal({\n isOpen,\n onClose,\n onExtend,\n currentExpiresAt,\n isLoading,\n}: ExtendTTLModalProps) {\n const [selectedPreset, setSelectedPreset] = useState<number | null>(null);\n const [customMinutes, setCustomMinutes] = useState('');\n\n if (!isOpen) return null;\n\n const remainingMs = new Date(currentExpiresAt).getTime() - Date.now();\n const remainingMinutes = Math.max(0, Math.floor(remainingMs / 60000));\n\n const handleExtend = () => {\n let seconds: number;\n if (selectedPreset !== null) {\n seconds = PRESET_DURATIONS[selectedPreset].seconds;\n } else if (customMinutes) {\n seconds = parseInt(customMinutes, 10) * 60;\n if (isNaN(seconds) || seconds <= 0) return;\n } else {\n return;\n }\n onExtend(seconds);\n };\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50\">\n <div className=\"w-full max-w-md rounded-xl bg-bg-surface p-6 shadow-xl\">\n <div className=\"flex items-center justify-between mb-4\">\n <div className=\"flex items-center gap-2\">\n <Clock className=\"size-5 text-accent-blue\" />\n <h3 className=\"text-lg font-semibold\">Extend Sandbox Duration</h3>\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close dialog\"\n className=\"text-text-tertiary hover:text-text-secondary\"\n >\n <X className=\"size-5\" />\n </button>\n </div>\n\n <p className=\"text-sm text-text-secondary mb-4\">\n Current remaining time: <span className=\"font-medium\">{remainingMinutes} minutes</span>\n </p>\n\n <div className=\"space-y-2 mb-4\">\n {PRESET_DURATIONS.map((preset, i) => (\n <button\n key={preset.seconds}\n type=\"button\"\n onClick={() => {\n setSelectedPreset(i);\n setCustomMinutes('');\n }}\n className={`w-full rounded-lg border px-4 py-2.5 text-left text-sm font-medium transition-colors ${\n selectedPreset === i\n ? 'border-primary bg-status-info-bg-subtle text-status-info-text'\n : 'border-border-subtle hover:bg-bg-sunken text-text-secondary'\n }`}\n >\n + {preset.label}\n </button>\n ))}\n </div>\n\n <div className=\"mb-6\">\n <label\n htmlFor=\"extend-ttl-custom-minutes\"\n className=\"block text-sm font-medium text-text-secondary mb-1\"\n >\n Custom duration (minutes)\n </label>\n <input\n id=\"extend-ttl-custom-minutes\"\n type=\"number\"\n min=\"1\"\n max=\"1440\"\n value={customMinutes}\n onChange={(e) => {\n setCustomMinutes(e.target.value);\n setSelectedPreset(null);\n }}\n placeholder=\"Enter minutes\"\n aria-label=\"Custom duration in minutes\"\n className=\"w-full rounded-lg border border-border-subtle px-3 py-2 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary\"\n />\n </div>\n\n <div className=\"flex gap-3\">\n <Button variant=\"outline\" onClick={onClose} className=\"flex-1\">\n Cancel\n </Button>\n <Button\n onClick={handleExtend}\n disabled={isLoading || (selectedPreset === null && !customMinutes)}\n className=\"flex-1\"\n >\n {isLoading ? 'Extending...' : 'Extend'}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AAYA,IAAM,IAAmB;CACvB;EAAE,OAAO;EAAc,SAAS;EAAS;CACzC;EAAE,OAAO;EAAc,SAAS;EAAS;CACzC;EAAE,OAAO;EAAU,SAAS;EAAS;CACrC;EAAE,OAAO;EAAW,SAAS;EAAa;CAC3C;AAED,SAAgB,EAAe,EAC7B,WACA,YACA,aACA,qBACA,gBACsB;CACtB,IAAM,CAAC,GAAgB,KAAqB,EAAwB,KAAK,EACnE,CAAC,GAAe,KAAoB,EAAS,GAAG;AAEtD,KAAI,CAAC,EAAQ,QAAO;CAEpB,IAAM,IAAc,IAAI,KAAK,EAAiB,CAAC,SAAS,GAAG,KAAK,KAAK,EAC/D,IAAmB,KAAK,IAAI,GAAG,KAAK,MAAM,IAAc,IAAM,CAAC;AAerE,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,GAAD,EAAO,WAAU,2BAA4B,CAAA,EAC7C,kBAAC,MAAD;OAAI,WAAU;iBAAwB;OAA4B,CAAA,CAC9D;SACN,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,cAAW;MACX,WAAU;gBAEV,kBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;MACjB,CAAA,CACL;;IAEN,kBAAC,KAAD;KAA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