@ultrst-armada/floks 1.2.5 → 1.2.7
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/package.json +13 -11
- package/packages/canvas-ui/dist/chunk-QRYNQ36L.js +123 -0
- package/packages/canvas-ui/dist/{chunk-OOTTFWXA.js → chunk-RH5NINIT.js} +1 -122
- package/packages/canvas-ui/dist/chunk-VESG3VP3.js +1522 -0
- package/packages/canvas-ui/dist/frnl-editable-node-graph/index.d.ts +110 -0
- package/packages/canvas-ui/dist/frnl-editable-node-graph/index.js +9 -0
- package/packages/canvas-ui/dist/index.d.ts +13 -2
- package/packages/canvas-ui/dist/index.js +62 -484
- package/packages/canvas-ui/dist/predictive/index.js +4 -2
- package/packages/canvas-ui/floks.manifest.json +25 -4
- package/packages/canvas-ui/package.json +11 -7
- package/packages/ui/dist/chunk-2SD6BIUX.js +0 -0
- package/packages/ui/dist/{chunk-YDOKOBRJ.js → chunk-DGZBP3ND.js} +106 -491
- package/packages/ui/dist/{chunk-2SFOC7KZ.js → chunk-KQAFKNQH.js} +77 -67
- package/packages/ui/dist/chunk-PH4NEHWR.js +99 -0
- package/packages/ui/dist/chunk-TKGKVCB7.js +323 -0
- package/packages/ui/dist/{chunk-DT6DZU63.js → chunk-X67KXI3H.js} +190 -152
- package/packages/ui/dist/chunk-YVWJ4SW7.js +394 -0
- package/packages/ui/dist/components/auth/index.d.ts +56 -14
- package/packages/ui/dist/components/auth/index.js +12 -3
- package/packages/ui/dist/components/composite/index.js +1 -1
- package/packages/ui/dist/components/graph/index.d.ts +29 -0
- package/packages/ui/dist/components/graph/index.js +10 -0
- package/packages/ui/dist/components/layout/index.js +2 -2
- package/packages/ui/dist/components/settings/index.js +2 -2
- package/packages/ui/dist/components/tiles/index.d.ts +83 -0
- package/packages/ui/dist/components/tiles/index.js +10 -0
- package/packages/ui/dist/components/workspace/index.d.ts +108 -33
- package/packages/ui/dist/components/workspace/index.js +15 -3
- package/packages/ui/dist/frnl/index.js +9 -7
- package/packages/ui/dist/hierarchy/index.js +2 -2
- package/packages/ui/dist/index.d.ts +5 -2
- package/packages/ui/dist/index.js +68 -39
- package/packages/ui/floks.manifest.json +99 -17
- package/packages/ui/package.json +18 -3
- package/packages/ui/dist/{chunk-MYXPGPI3.js → chunk-GWW3BGOB.js} +3 -3
- package/packages/ui/dist/{chunk-TORWRS3V.js → chunk-SXRIBCJX.js} +3 -3
- package/packages/ui/dist/{chunk-NPIMIWVO.js → chunk-ZPQC46RO.js} +4 -4
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TilesMenu
|
|
3
|
+
} from "./chunk-PH4NEHWR.js";
|
|
4
|
+
import {
|
|
5
|
+
useFloksFrnlStore
|
|
6
|
+
} from "./chunk-X4B3EBMY.js";
|
|
7
|
+
|
|
1
8
|
// src/components/workspace/StoragePresetTile.tsx
|
|
2
9
|
import { HardDrive, CheckCircle2 } from "lucide-react";
|
|
3
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -413,170 +420,196 @@ var WorkspaceSecondaryClonesPanel = ({ workspace, onClonesUpdated, onClose }) =>
|
|
|
413
420
|
] });
|
|
414
421
|
};
|
|
415
422
|
|
|
416
|
-
// src/components/workspace/
|
|
417
|
-
import
|
|
418
|
-
import {
|
|
423
|
+
// src/components/workspace/WorkspaceCreateDialog.tsx
|
|
424
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
425
|
+
import { Cloud as Cloud5, HardDrive as HardDrive5, Loader2 } from "lucide-react";
|
|
419
426
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
420
|
-
var
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
loading = false,
|
|
432
|
-
error = null,
|
|
433
|
-
onDismissError
|
|
434
|
-
}) => {
|
|
435
|
-
const [search, setSearch] = React5.useState("");
|
|
436
|
-
const [creating, setCreating] = React5.useState(false);
|
|
437
|
-
const [editing, setEditing] = React5.useState(null);
|
|
438
|
-
const [name, setName] = React5.useState("");
|
|
439
|
-
const [description, setDescription] = React5.useState("");
|
|
440
|
-
const [storage, setStorage] = React5.useState({ provider: "local_fs", localFolderName: "Local-Vault" });
|
|
441
|
-
const filtered = workspaces.filter(
|
|
442
|
-
(w) => w.name.toLowerCase().includes(search.toLowerCase()) || (w.description || "").toLowerCase().includes(search.toLowerCase())
|
|
443
|
-
);
|
|
444
|
-
const create = async (e) => {
|
|
445
|
-
e.preventDefault();
|
|
446
|
-
if (!name.trim()) return;
|
|
447
|
-
await onCreateWorkspace({ name: name.trim(), description: description.trim(), storage });
|
|
448
|
-
setName("");
|
|
449
|
-
setDescription("");
|
|
450
|
-
setCreating(false);
|
|
427
|
+
var WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES = ["workspace", "storage", "srkl"];
|
|
428
|
+
function createKloksWorkspaceStorageService(invoker) {
|
|
429
|
+
return {
|
|
430
|
+
listBackblazeAccounts: async (userId) => {
|
|
431
|
+
const result = await invoker.invoke("srkl", "getAccounts", { userId, service: "backblaze" });
|
|
432
|
+
return Array.isArray(result?.accounts) ? result.accounts : [];
|
|
433
|
+
},
|
|
434
|
+
listBackblazeBuckets: async (accountId, userId) => {
|
|
435
|
+
const result = await invoker.invoke("srkl", "listBackblazeBuckets", { accountId, userId });
|
|
436
|
+
return Array.isArray(result?.buckets) ? result.buckets : [];
|
|
437
|
+
}
|
|
451
438
|
};
|
|
452
|
-
|
|
439
|
+
}
|
|
440
|
+
function WorkspaceCreateDialog({ open, userId, storageService, onClose, onSubmit }) {
|
|
441
|
+
const [name, setName] = useState5("");
|
|
442
|
+
const [description, setDescription] = useState5("");
|
|
443
|
+
const [provider, setProvider] = useState5("local_fs");
|
|
444
|
+
const [accounts, setAccounts] = useState5([]);
|
|
445
|
+
const [buckets, setBuckets] = useState5([]);
|
|
446
|
+
const [accountId, setAccountId] = useState5("");
|
|
447
|
+
const [bucketName, setBucketName] = useState5("");
|
|
448
|
+
const [loading, setLoading] = useState5(false);
|
|
449
|
+
const [loadingBuckets, setLoadingBuckets] = useState5(false);
|
|
450
|
+
const [error, setError] = useState5(null);
|
|
451
|
+
useEffect3(() => {
|
|
452
|
+
if (!open || !userId) return;
|
|
453
|
+
setError(null);
|
|
454
|
+
storageService.listBackblazeAccounts(userId).then(setAccounts).catch((e) => setError(e instanceof Error ? e.message : "Failed to load SRKL accounts."));
|
|
455
|
+
}, [open, userId, storageService]);
|
|
456
|
+
useEffect3(() => {
|
|
457
|
+
if (provider !== "backblaze_b2" || !accountId) return;
|
|
458
|
+
setLoadingBuckets(true);
|
|
459
|
+
storageService.listBackblazeBuckets(accountId, userId).then((items) => {
|
|
460
|
+
setBuckets(items);
|
|
461
|
+
setBucketName("");
|
|
462
|
+
}).catch((e) => setError(e instanceof Error ? e.message : "Failed to load Backblaze buckets.")).finally(() => setLoadingBuckets(false));
|
|
463
|
+
}, [provider, accountId, storageService]);
|
|
464
|
+
if (!open) return null;
|
|
465
|
+
const submit = async (e) => {
|
|
453
466
|
e.preventDefault();
|
|
454
|
-
if (!
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
467
|
+
if (!name.trim()) return setError("Workspace name is required.");
|
|
468
|
+
if (provider === "backblaze_b2" && (!accountId || !bucketName)) return setError("Select an SRKL Backblaze account and bucket.");
|
|
469
|
+
setLoading(true);
|
|
470
|
+
try {
|
|
471
|
+
const account = accounts.find((a) => a.id === accountId);
|
|
472
|
+
await onSubmit({
|
|
473
|
+
name: name.trim(),
|
|
474
|
+
description: description.trim() || void 0,
|
|
475
|
+
storageProvider: provider,
|
|
476
|
+
storageConnectionId: accountId || void 0,
|
|
477
|
+
localFolderName: provider === "local_fs" ? name.trim() : void 0,
|
|
478
|
+
b2BucketName: provider === "backblaze_b2" ? bucketName : void 0,
|
|
479
|
+
b2Endpoint: account?.credentials?.endpoint,
|
|
480
|
+
b2Region: account?.credentials?.region
|
|
481
|
+
});
|
|
482
|
+
setName("");
|
|
483
|
+
setDescription("");
|
|
484
|
+
setProvider("local_fs");
|
|
485
|
+
setAccountId("");
|
|
486
|
+
setBucketName("");
|
|
487
|
+
onClose();
|
|
488
|
+
} catch (e2) {
|
|
489
|
+
setError(e2 instanceof Error ? e2.message : "Workspace creation failed.");
|
|
490
|
+
} finally {
|
|
491
|
+
setLoading(false);
|
|
492
|
+
}
|
|
462
493
|
};
|
|
463
|
-
return /* @__PURE__ */
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
/* @__PURE__ */ jsxs6("div", { className: "text-[10px] text-[var(--skipo-text-muted)]", children: [
|
|
475
|
-
currentUser?.email || "user",
|
|
476
|
-
" \xB7 ",
|
|
477
|
-
mode
|
|
478
|
-
] })
|
|
479
|
-
] })
|
|
480
|
-
] }),
|
|
481
|
-
onLogout && /* @__PURE__ */ jsxs6("button", { type: "button", onClick: onLogout, className: "text-xs flex items-center gap-1.5 text-red-400 hover:bg-red-500/20 border border-red-500/50 px-2.5 py-1.5 rounded", children: [
|
|
482
|
-
/* @__PURE__ */ jsx6(LogOut, { size: 14 }),
|
|
483
|
-
" LOGOUT"
|
|
484
|
-
] })
|
|
494
|
+
return /* @__PURE__ */ jsx6("div", { className: "fixed inset-0 z-[70] bg-black/75 backdrop-blur-sm flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs6("form", { onSubmit: submit, className: "w-full max-w-xl bg-[var(--skipo-surface)] border-2 border-[var(--skipo-border-color)] shadow-[7px_7px_0px_var(--skipo-border-color)] p-5 font-mono", children: [
|
|
495
|
+
/* @__PURE__ */ jsx6("h2", { className: "text-sm font-black uppercase", children: "Create Workspace" }),
|
|
496
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-[10px] text-[var(--skipo-text-muted)]", children: "Storage is selected from the authenticated user's SRKL-backed accounts." }),
|
|
497
|
+
error && /* @__PURE__ */ jsx6("div", { className: "mt-3 border border-red-500 p-2 text-xs text-red-300", children: error }),
|
|
498
|
+
/* @__PURE__ */ jsxs6("div", { className: "mt-4 space-y-3", children: [
|
|
499
|
+
/* @__PURE__ */ jsx6("input", { "aria-label": "Workspace name", value: name, onChange: (e) => setName(e.target.value), placeholder: "Workspace name", className: "w-full h-9 bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] px-3 text-xs" }),
|
|
500
|
+
/* @__PURE__ */ jsx6("textarea", { "aria-label": "Workspace description", value: description, onChange: (e) => setDescription(e.target.value), placeholder: "Description", rows: 3, className: "w-full bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] p-3 text-xs" }),
|
|
501
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
502
|
+
/* @__PURE__ */ jsxs6("button", { type: "button", onClick: () => setProvider("local_fs"), className: `p-3 border text-left text-xs ${provider === "local_fs" ? "border-[var(--skipo-accent)]" : "border-[var(--skipo-border-color)]"}`, children: [
|
|
503
|
+
/* @__PURE__ */ jsx6(HardDrive5, { size: 15 }),
|
|
504
|
+
" LOCAL FILESYSTEM"
|
|
485
505
|
] }),
|
|
486
|
-
/* @__PURE__ */ jsxs6("
|
|
487
|
-
/* @__PURE__ */
|
|
488
|
-
|
|
489
|
-
/* @__PURE__ */ jsx6("input", { value: search, onChange: (e) => setSearch(e.target.value), placeholder: "Search workspaces by name or description...", className: "w-full bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] rounded pl-9 pr-3 py-1.5 text-xs text-[var(--skipo-text)] outline-none focus:border-[var(--skipo-accent)]" })
|
|
490
|
-
] }),
|
|
491
|
-
/* @__PURE__ */ jsxs6("button", { type: "button", onClick: () => {
|
|
492
|
-
setName("");
|
|
493
|
-
setDescription("");
|
|
494
|
-
setCreating(true);
|
|
495
|
-
}, className: "text-xs flex items-center justify-center gap-1.5 font-bold px-3 py-1.5 bg-[var(--skipo-accent)] text-black rounded", children: [
|
|
496
|
-
/* @__PURE__ */ jsx6(Plus2, { size: 14 }),
|
|
497
|
-
" NEW WORKSPACE"
|
|
498
|
-
] })
|
|
506
|
+
/* @__PURE__ */ jsxs6("button", { type: "button", onClick: () => setProvider("backblaze_b2"), className: `p-3 border text-left text-xs ${provider === "backblaze_b2" ? "border-[var(--skipo-accent)]" : "border-[var(--skipo-border-color)]"}`, children: [
|
|
507
|
+
/* @__PURE__ */ jsx6(Cloud5, { size: 15 }),
|
|
508
|
+
" BACKBLAZE B2 / SRKL"
|
|
499
509
|
] })
|
|
500
510
|
] }),
|
|
501
|
-
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
w.storageProvider || "local_fs",
|
|
516
|
-
" ",
|
|
517
|
-
active && /* @__PURE__ */ jsx6("span", { className: "text-[var(--skipo-accent)]", children: "\u2605 ACTIVE" })
|
|
518
|
-
] }),
|
|
519
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex gap-1", children: [
|
|
520
|
-
onUpdateWorkspace && /* @__PURE__ */ jsx6("button", { type: "button", onClick: (e) => {
|
|
521
|
-
e.stopPropagation();
|
|
522
|
-
beginEdit(w);
|
|
523
|
-
}, className: "p-1.5 border border-[var(--skipo-border-color)] rounded hover:bg-[var(--skipo-accent)] hover:text-black", children: /* @__PURE__ */ jsx6(Edit3, { size: 13 }) }),
|
|
524
|
-
onDeleteWorkspace && /* @__PURE__ */ jsx6("button", { type: "button", onClick: (e) => {
|
|
525
|
-
e.stopPropagation();
|
|
526
|
-
if (confirm(`Delete workspace "${w.name}"?`)) onDeleteWorkspace(w.id);
|
|
527
|
-
}, className: "p-1.5 border border-[var(--skipo-border-color)] rounded hover:bg-red-600 hover:text-white", children: /* @__PURE__ */ jsx6(Trash22, { size: 13 }) })
|
|
528
|
-
] })
|
|
529
|
-
] }),
|
|
530
|
-
/* @__PURE__ */ jsx6("h3", { className: "mt-3 text-sm font-black uppercase text-[var(--skipo-text)] truncate", children: w.name }),
|
|
531
|
-
/* @__PURE__ */ jsxs6("div", { className: "mt-1 text-[10px] text-[var(--skipo-accent)] flex items-center gap-1 truncate", children: [
|
|
532
|
-
/* @__PURE__ */ jsx6(FolderOpen, { size: 11 }),
|
|
533
|
-
w.workspacePath || w.localFolderName || w.b2BucketName || w.id
|
|
534
|
-
] }),
|
|
535
|
-
/* @__PURE__ */ jsx6("p", { className: "text-xs text-[var(--skipo-text-muted)] mt-2 line-clamp-2", children: w.description || "Workspace deployment and application control plane." }),
|
|
536
|
-
/* @__PURE__ */ jsx6("div", { className: "mt-3 pt-3 border-t border-[var(--skipo-border-color)]", children: /* @__PURE__ */ jsx6(WorkspaceStorageReadonlyPanel, { workspace: w }) }),
|
|
537
|
-
/* @__PURE__ */ jsx6("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ jsxs6("button", { type: "button", onClick: (e) => {
|
|
538
|
-
e.stopPropagation();
|
|
539
|
-
onSelectWorkspace(w);
|
|
540
|
-
}, className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-black uppercase border rounded bg-[var(--skipo-bg)] hover:bg-[var(--skipo-accent)] hover:text-black", children: [
|
|
541
|
-
/* @__PURE__ */ jsx6("span", { children: "ENTER WORKSPACE" }),
|
|
542
|
-
/* @__PURE__ */ jsx6(ArrowRight, { size: 14 })
|
|
543
|
-
] }) })
|
|
544
|
-
] }, w.id);
|
|
545
|
-
}),
|
|
546
|
-
/* @__PURE__ */ jsxs6("button", { type: "button", onClick: () => {
|
|
547
|
-
setName("");
|
|
548
|
-
setDescription("");
|
|
549
|
-
setCreating(true);
|
|
550
|
-
}, className: "min-h-[220px] flex flex-col items-center justify-center p-6 border-2 border-dashed border-[var(--skipo-border-color)] bg-[var(--skipo-surface)]/50 hover:border-[var(--skipo-accent)] rounded-lg", children: [
|
|
551
|
-
/* @__PURE__ */ jsx6(FolderPlus, { size: 22, className: "mb-3 text-[var(--skipo-accent)]" }),
|
|
552
|
-
/* @__PURE__ */ jsx6("b", { className: "text-xs", children: "ADD NEW WORKSPACE" }),
|
|
553
|
-
/* @__PURE__ */ jsx6("span", { className: "text-[11px] text-[var(--skipo-text-muted)] mt-1 text-center", children: "Create an isolated workspace with dedicated storage." })
|
|
511
|
+
provider === "backblaze_b2" && /* @__PURE__ */ jsxs6("div", { className: "space-y-2 border-t border-[var(--skipo-border-color)] pt-3", children: [
|
|
512
|
+
/* @__PURE__ */ jsxs6("select", { "aria-label": "Backblaze account", value: accountId, onChange: (e) => setAccountId(e.target.value), className: "w-full h-9 bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] px-2 text-xs", children: [
|
|
513
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: "Select SRKL Backblaze account" }),
|
|
514
|
+
accounts.map((a) => /* @__PURE__ */ jsx6("option", { value: a.id, children: a.name }, a.id))
|
|
515
|
+
] }),
|
|
516
|
+
loadingBuckets ? /* @__PURE__ */ jsxs6("div", { className: "text-xs flex items-center gap-2", children: [
|
|
517
|
+
/* @__PURE__ */ jsx6(Loader2, { size: 13, className: "animate-spin" }),
|
|
518
|
+
" Loading buckets..."
|
|
519
|
+
] }) : /* @__PURE__ */ jsxs6("select", { "aria-label": "Backblaze bucket", value: bucketName, onChange: (e) => setBucketName(e.target.value), className: "w-full h-9 bg-[var(--skipo-bg)] border border-[var(--skipo-border-color)] px-2 text-xs", children: [
|
|
520
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: "Select bucket" }),
|
|
521
|
+
buckets.map((b) => {
|
|
522
|
+
const n = b.bucketName ?? b.name ?? "";
|
|
523
|
+
return /* @__PURE__ */ jsx6("option", { value: n, children: n }, b.bucketId ?? b.id ?? n);
|
|
524
|
+
})
|
|
554
525
|
] })
|
|
555
526
|
] })
|
|
556
527
|
] }),
|
|
557
|
-
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
528
|
+
/* @__PURE__ */ jsxs6("div", { className: "mt-5 flex justify-end gap-2", children: [
|
|
529
|
+
/* @__PURE__ */ jsx6("button", { type: "button", onClick: onClose, className: "h-8 px-3 border border-[var(--skipo-border-color)] text-xs", children: "CANCEL" }),
|
|
530
|
+
/* @__PURE__ */ jsx6("button", { type: "submit", disabled: loading, className: "h-8 px-3 bg-[var(--skipo-accent)] text-black text-xs font-black", children: loading ? "CREATING..." : "CREATE WORKSPACE" })
|
|
531
|
+
] })
|
|
532
|
+
] }) });
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// src/components/workspace/WorkspaceTilesMenu.tsx
|
|
536
|
+
import { useId, useMemo, useState as useState6 } from "react";
|
|
537
|
+
import { FolderOpen, HardDrive as HardDrive6, Cloud as Cloud6, LogOut } from "lucide-react";
|
|
538
|
+
import { defineFrnlComponent } from "@ultrst-armada/frnlts";
|
|
539
|
+
import { useFrnlComponent } from "@ultrst-armada/frnlts/react";
|
|
540
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
541
|
+
var WORKSPACE_TILES_MENU_REQUIRED_SERVICES = ["auth", "workspace", "storage", "srkl"];
|
|
542
|
+
var workspaceTilesMenuDefinition = defineFrnlComponent({
|
|
543
|
+
name: "workspaceTilesMenu",
|
|
544
|
+
states: {
|
|
545
|
+
idle: { name: "idle", events: { select: { functionId: "workspaceTilesMenu.idle.select" }, create: { functionId: "workspaceTilesMenu.idle.create" }, logout: { functionId: "workspaceTilesMenu.idle.logout" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
|
|
546
|
+
loading: { name: "loading", events: {}, visualParameters: { opacity: 0.7 }, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
|
|
547
|
+
error: { name: "error", events: {}, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } }
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
function WorkspaceTilesMenu({
|
|
551
|
+
workspaces,
|
|
552
|
+
userId,
|
|
553
|
+
activeWorkspaceId = null,
|
|
554
|
+
storageService,
|
|
555
|
+
onSelectWorkspace,
|
|
556
|
+
onCreateWorkspace,
|
|
557
|
+
onUpdateWorkspace: _onUpdateWorkspace,
|
|
558
|
+
onDeleteWorkspace: _onDeleteWorkspace,
|
|
559
|
+
onLogout,
|
|
560
|
+
loading = false,
|
|
561
|
+
error = null
|
|
562
|
+
}) {
|
|
563
|
+
const store = useFloksFrnlStore();
|
|
564
|
+
const generated = useId().replace(/[:/]/g, "");
|
|
565
|
+
const componentId = `workspaceTilesMenu.${generated}`;
|
|
566
|
+
const [creating, setCreating] = useState6(false);
|
|
567
|
+
const handlers = useMemo(() => ({
|
|
568
|
+
"workspaceTilesMenu.idle.select": (value) => onSelectWorkspace(value),
|
|
569
|
+
"workspaceTilesMenu.idle.create": () => setCreating(true),
|
|
570
|
+
"workspaceTilesMenu.idle.logout": () => onLogout?.()
|
|
571
|
+
}), [onLogout, onSelectWorkspace]);
|
|
572
|
+
const frnl = useFrnlComponent({
|
|
573
|
+
id: componentId,
|
|
574
|
+
definition: workspaceTilesMenuDefinition,
|
|
575
|
+
store,
|
|
576
|
+
state: error ? "error" : loading ? "loading" : "idle",
|
|
577
|
+
properties: { activeWorkspaceId, workspaceCount: workspaces.length },
|
|
578
|
+
handlers
|
|
579
|
+
});
|
|
580
|
+
return /* @__PURE__ */ jsxs7("section", { id: componentId, "data-frnl-component": "workspaceTilesMenu", "data-frnl-state": frnl.state, className: "space-y-3", children: [
|
|
581
|
+
/* @__PURE__ */ jsx7("div", { className: "flex justify-end gap-2", children: onLogout && /* @__PURE__ */ jsxs7("button", { type: "button", onClick: () => frnl.events.logout(void 0), className: "h-8 px-3 border border-red-500/60 text-red-300 text-[10px] font-black flex items-center gap-1", children: [
|
|
582
|
+
/* @__PURE__ */ jsx7(LogOut, { size: 12 }),
|
|
583
|
+
" LOGOUT"
|
|
584
|
+
] }) }),
|
|
585
|
+
/* @__PURE__ */ jsx7(
|
|
586
|
+
TilesMenu,
|
|
587
|
+
{
|
|
588
|
+
id: componentId + ".tiles",
|
|
589
|
+
title: "Workspaces",
|
|
590
|
+
subtitle: "Workspace isolation and storage selection.",
|
|
591
|
+
tiles: workspaces,
|
|
592
|
+
loading,
|
|
593
|
+
error,
|
|
594
|
+
createLabel: "NEW WORKSPACE",
|
|
595
|
+
onSelect: (ws) => frnl.events.select(ws),
|
|
596
|
+
onCreate: () => frnl.events.create(void 0),
|
|
597
|
+
renderTile: (ws, selected) => /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
598
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 text-xs font-black uppercase", children: [
|
|
599
|
+
ws.storageProvider === "backblaze_b2" ? /* @__PURE__ */ jsx7(Cloud6, { size: 14 }) : /* @__PURE__ */ jsx7(HardDrive6, { size: 14 }),
|
|
600
|
+
ws.title
|
|
601
|
+
] }),
|
|
602
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-2 text-[11px] text-[var(--skipo-text-muted)]", children: ws.description }),
|
|
603
|
+
/* @__PURE__ */ jsxs7("div", { className: `mt-2 text-[10px] ${selected || ws.id === activeWorkspaceId ? "text-[var(--skipo-accent)]" : "text-[var(--skipo-text-muted)]"}`, children: [
|
|
604
|
+
/* @__PURE__ */ jsx7(FolderOpen, { size: 11, className: "inline mr-1" }),
|
|
605
|
+
ws.workspacePath ?? ws.b2BucketName ?? ws.id
|
|
606
|
+
] })
|
|
575
607
|
] })
|
|
576
|
-
|
|
577
|
-
|
|
608
|
+
}
|
|
609
|
+
),
|
|
610
|
+
/* @__PURE__ */ jsx7(WorkspaceCreateDialog, { open: creating, userId, storageService, onClose: () => setCreating(false), onSubmit: onCreateWorkspace })
|
|
578
611
|
] });
|
|
579
|
-
}
|
|
612
|
+
}
|
|
580
613
|
|
|
581
614
|
export {
|
|
582
615
|
StoragePresetTile,
|
|
@@ -584,5 +617,10 @@ export {
|
|
|
584
617
|
StorageOptionTiles,
|
|
585
618
|
WorkspaceStorageReadonlyPanel,
|
|
586
619
|
WorkspaceSecondaryClonesPanel,
|
|
620
|
+
WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES,
|
|
621
|
+
createKloksWorkspaceStorageService,
|
|
622
|
+
WorkspaceCreateDialog,
|
|
623
|
+
WORKSPACE_TILES_MENU_REQUIRED_SERVICES,
|
|
624
|
+
workspaceTilesMenuDefinition,
|
|
587
625
|
WorkspaceTilesMenu
|
|
588
626
|
};
|