@powerhousedao/network-admin 1.1.0 → 1.2.0

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.
@@ -14,7 +14,13 @@ describe("WorkstreamOperations", () => {
14
14
  });
15
15
  it("should handle editClientInfo operation", () => {
16
16
  const document = utils.createDocument();
17
- const input = generateMock(EditClientInfoInputSchema());
17
+ const mockInput = generateMock(EditClientInfoInputSchema());
18
+ const input = {
19
+ ...mockInput,
20
+ // Override icon with a valid URL if provided, otherwise undefined
21
+ // The state schema requires icon to be a valid URL (z.url()) or null
22
+ icon: mockInput.icon ? "https://example.com/icon.png" : undefined,
23
+ };
18
24
  const updatedDocument = reducer(document, editClientInfo(input));
19
25
  expect(isWorkstreamDocument(updatedDocument)).toBe(true);
20
26
  expect(updatedDocument.operations.global).toHaveLength(1);
@@ -1 +1 @@
1
- {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/DriveExplorer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA2BlD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,2CAugBtD"}
1
+ {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/DriveExplorer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA4BlD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,2CA4gBtD"}
@@ -1,9 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useCallback, useRef } from "react";
3
3
  import { setSelectedNode, useSelectedDriveSafe, useSelectedFolder, useUserPermissions, useDocumentsInSelectedDrive, useFileNodesInSelectedDrive, useNodeActions, useSelectedDocumentSafe, showDeleteNodeModal, addDocument, dispatchActions, } from "@powerhousedao/reactor-browser";
4
4
  import { Button } from "@powerhousedao/document-engineering";
5
5
  import { CreateDocumentModal } from "@powerhousedao/design-system/connect";
6
6
  import {} from "document-model";
7
+ import { isValidName } from "document-drive";
7
8
  import { WorkstreamIcon } from "./icons/WorkstreamIcon.js";
8
9
  import { editClientInfo, editWorkstream, } from "../../../document-models/workstream/gen/creators.js";
9
10
  import { setProfileName } from "../../../document-models/network-profile/gen/creators.js";
@@ -65,7 +66,7 @@ export function DriveExplorer({ children }) {
65
66
  const networkProfileDoc = networkAdminDocuments?.find((doc) => doc.header.documentType === "powerhouse/network-profile");
66
67
  switch (nodeType) {
67
68
  case "workstreams":
68
- return (_jsx("div", { className: "w-full h-full p-6 overflow-auto", children: _jsxs("div", { className: "max-w-7xl mx-auto", children: [_jsxs("div", { className: "space-y-6 flex flex-col items-center justify-center mb-10", children: [_jsx("h1", { className: "text-2xl font-bold", children: "Welcome to the Network Admin" }), networkProfileDoc?.state.global.logo && (_jsxs("div", { className: "bg-white rounded-lg shadow-md border border-gray-300 p-4 max-w-lg mx-auto text-sm", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [networkProfileDoc?.state.global.logo ? (_jsx("img", { src: networkProfileDoc?.state.global.logo, alt: "Network Profile Logo", className: "mb-4 max-w-64 max-h-12 w-auto h-auto object-contain flex-shrink-0" })) : (_jsx("div", {})), _jsx("div", { className: "flex flex-wrap gap-2 justify-end flex-shrink-0", children: networkProfileDoc?.state.global.category.map((category) => (_jsx("span", { className: `inline-flex items-center justify-center rounded-md w-fit whitespace-nowrap shrink-0 border-2 px-2 py-0 text-sm font-extrabold ${category.toLowerCase() === "oss"
69
+ return (_jsx("div", { className: "w-full h-full p-6 overflow-auto", children: _jsxs("div", { className: "max-w-7xl mx-auto", children: [_jsxs("div", { className: "space-y-6 flex flex-col items-center justify-center mb-10", children: [_jsxs("h1", { className: "text-2xl font-bold", children: ["Welcome to the ", networkProfileDoc?.state.global.name || "", " Network Admin"] }), networkProfileDoc?.state.global.logo && (_jsxs("div", { className: "bg-white rounded-lg shadow-md border border-gray-300 p-4 max-w-lg mx-auto text-sm", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [networkProfileDoc?.state.global.logo ? (_jsx("img", { src: networkProfileDoc?.state.global.logo, alt: "Network Profile Logo", className: "mb-4 max-w-64 max-h-12 w-auto h-auto object-contain flex-shrink-0" })) : (_jsx("div", {})), _jsx("div", { className: "flex flex-wrap gap-2 justify-end flex-shrink-0", children: networkProfileDoc?.state.global.category.map((category) => (_jsx("span", { className: `inline-flex items-center justify-center rounded-md w-fit whitespace-nowrap shrink-0 border-2 px-2 py-0 text-sm font-extrabold ${category.toLowerCase() === "oss"
69
70
  ? "bg-purple-600/30 text-purple-600 border-purple-600/70"
70
71
  : category.toLowerCase() === "defi"
71
72
  ? "bg-blue-600/30 text-blue-600 border-blue-600/70"
@@ -200,8 +201,8 @@ export function DriveExplorer({ children }) {
200
201
  // === RENDER ===
201
202
  // If no network profile exists, show the creation form (no sidebar)
202
203
  if (!isNetworkProfileCreated) {
203
- const isValid = profileNameInput.trim().length > 0;
204
- return (_jsx("div", { className: "flex h-full items-center justify-center px-4 py-12", children: _jsxs("div", { className: "relative w-full max-w-2xl overflow-hidden rounded-2xl border border-slate-200/50 bg-gradient-to-br from-slate-50 via-purple-50/30 to-indigo-50/40 p-12 shadow-xl shadow-slate-200/50 backdrop-blur-sm", children: [_jsx("div", { className: "absolute -right-20 -top-20 h-64 w-64 rounded-full bg-gradient-to-br from-purple-400/20 to-indigo-400/20 blur-3xl" }), _jsx("div", { className: "absolute -bottom-16 -left-16 h-48 w-48 rounded-full bg-gradient-to-br from-indigo-300/20 to-purple-300/20 blur-2xl" }), _jsxs("div", { className: "relative z-10 text-center", children: [_jsx("div", { className: "mb-6 inline-flex items-center justify-center rounded-full bg-gradient-to-r from-purple-600 to-indigo-600 p-3 shadow-lg shadow-purple-500/30", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", className: "text-white", children: _jsx("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }) }) }), _jsx("h2", { className: "mb-4 text-3xl font-bold tracking-tight text-slate-900", children: "Create your Network Profile" }), _jsx("p", { className: "mb-8 text-lg leading-relaxed text-slate-600", children: "Get started by creating a network profile to manage workstreams, builders, and documents." }), _jsxs("form", { onSubmit: handleCreateProfile, className: "mx-auto max-w-md", children: [_jsx("input", { type: "text", value: profileNameInput, onChange: (e) => setProfileNameInput(e.target.value), placeholder: "Network profile name", maxLength: 100, disabled: isCreatingProfile, className: "mb-6 w-full rounded-xl border border-slate-200 bg-white px-4 py-3 text-base text-slate-900 placeholder-slate-400 shadow-sm outline-none transition-all focus:border-purple-500 focus:ring-2 focus:ring-purple-500/20 disabled:opacity-50" }), _jsxs("button", { type: "submit", disabled: !isValid || isCreatingProfile, className: "group relative w-full overflow-hidden rounded-xl bg-gradient-to-r from-purple-600 to-indigo-600 px-8 py-4 text-base font-semibold text-white shadow-lg shadow-purple-500/40 transition-all duration-300 hover:scale-105 hover:shadow-xl hover:shadow-purple-500/50 active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:scale-100 disabled:hover:shadow-lg", children: [_jsxs("span", { className: "relative z-10 flex items-center justify-center gap-2", children: [_jsx("span", { children: isCreatingProfile
204
+ const isValid = isValidName(profileNameInput);
205
+ return (_jsx("div", { className: "flex h-full items-center justify-center px-4 py-12", children: _jsxs("div", { className: "relative w-full max-w-2xl overflow-hidden rounded-2xl border border-slate-200/50 bg-gradient-to-br from-slate-50 via-purple-50/30 to-indigo-50/40 p-12 shadow-xl shadow-slate-200/50 backdrop-blur-sm", children: [_jsx("div", { className: "absolute -right-20 -top-20 h-64 w-64 rounded-full bg-gradient-to-br from-purple-400/20 to-indigo-400/20 blur-3xl" }), _jsx("div", { className: "absolute -bottom-16 -left-16 h-48 w-48 rounded-full bg-gradient-to-br from-indigo-300/20 to-purple-300/20 blur-2xl" }), _jsxs("div", { className: "relative z-10 text-center", children: [_jsx("div", { className: "mb-6 inline-flex items-center justify-center rounded-full bg-gradient-to-r from-purple-600 to-indigo-600 p-3 shadow-lg shadow-purple-500/30", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", className: "text-white", children: _jsx("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }) }) }), _jsx("h2", { className: "mb-4 text-3xl font-bold tracking-tight text-slate-900", children: "Create your Network Profile" }), _jsx("p", { className: "mb-8 text-lg leading-relaxed text-slate-600", children: "Get started by creating a network profile to manage workstreams, builders, and documents." }), _jsxs("form", { onSubmit: handleCreateProfile, className: "mx-auto max-w-md", children: [!isValid && profileNameInput && (_jsx("div", { className: "mb-2 text-sm text-red-500", children: "Document name must be valid URL characters." })), _jsx("input", { type: "text", value: profileNameInput, onChange: (e) => setProfileNameInput(e.target.value), placeholder: "Network profile name", maxLength: 100, disabled: isCreatingProfile, className: "mb-6 w-full rounded-xl border border-slate-200 bg-white px-4 py-3 text-base text-slate-900 placeholder-slate-400 shadow-sm outline-none transition-all focus:border-purple-500 focus:ring-2 focus:ring-purple-500/20 disabled:opacity-50" }), _jsxs("button", { type: "submit", disabled: !isValid || isCreatingProfile, className: "group relative w-full overflow-hidden rounded-xl bg-gradient-to-r from-purple-600 to-indigo-600 px-8 py-4 text-base font-semibold text-white shadow-lg shadow-purple-500/40 transition-all duration-300 hover:scale-105 hover:shadow-xl hover:shadow-purple-500/50 active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:scale-100 disabled:hover:shadow-lg", children: [_jsxs("span", { className: "relative z-10 flex items-center justify-center gap-2", children: [_jsx("span", { children: isCreatingProfile
205
206
  ? "Creating..."
206
207
  : "Create Network Profile" }), !isCreatingProfile && (_jsx("svg", { className: "h-5 w-5 transition-transform duration-300 group-hover:translate-x-1", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13 7l5 5m0 0l-5 5m5-5H6" }) }))] }), _jsx("div", { className: "absolute inset-0 bg-gradient-to-r from-purple-700 to-indigo-700 opacity-0 transition-opacity duration-300 group-hover:opacity-100" })] })] })] })] }) }));
207
208
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FolderTree.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/FolderTree.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA0B/C,UAAU,eAAe;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,sBAAsB,EAAE,MAAM,OAAO,CAAC,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACpE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,GACvB,EAAE,eAAe,2CA+QjB"}
1
+ {"version":3,"file":"FolderTree.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/FolderTree.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA0B/C,UAAU,eAAe;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,sBAAsB,EAAE,MAAM,OAAO,CAAC,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACpE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,GACvB,EAAE,eAAe,2CAsRjB"}
@@ -175,6 +175,10 @@ export function FolderTree({ activeSidebarNodeId, setActiveSidebarNodeId, setSel
175
175
  };
176
176
  return [workstreamsNode, networkInfoNode, buildersNode];
177
177
  }, [networkAdminDocuments, allDocuments]);
178
+ const sidebarTitle = useMemo(() => {
179
+ const networkProfileDoc = networkAdminDocuments?.find((doc) => doc.header.documentType === "powerhouse/network-profile");
180
+ return networkProfileDoc?.state.global.name || "Network Admin";
181
+ }, [networkAdminDocuments]);
178
182
  // Handle sidebar node selection
179
183
  const handleActiveNodeChange = useCallback((nodeId) => {
180
184
  // Find the node by ID
@@ -218,7 +222,7 @@ export function FolderTree({ activeSidebarNodeId, setActiveSidebarNodeId, setSel
218
222
  setSelectedRootNode,
219
223
  createBuildersDocument,
220
224
  ]);
221
- return (_jsx(SidebarProvider, { nodes: sidebarNodes, children: _jsx(Sidebar, { nodes: sidebarNodes, activeNodeId: activeSidebarNodeId, onActiveNodeChange: (node) => handleActiveNodeChange(node.id), sidebarTitle: "Network Admin", showSearchBar: true, allowPinning: true, resizable: true, initialWidth: 300, maxWidth: 500, enableMacros: 4, handleOnTitleClick: () => {
225
+ return (_jsx(SidebarProvider, { nodes: sidebarNodes, children: _jsx(Sidebar, { nodes: sidebarNodes, activeNodeId: activeSidebarNodeId, onActiveNodeChange: (node) => handleActiveNodeChange(node.id), sidebarTitle: sidebarTitle, showSearchBar: true, allowPinning: true, resizable: true, initialWidth: 300, maxWidth: 500, enableMacros: 4, handleOnTitleClick: () => {
222
226
  setSelectedNode(undefined);
223
227
  setActiveSidebarNodeId("workstreams");
224
228
  setSelectedRootNode("workstreams");
package/dist/style.css CHANGED
@@ -346,6 +346,24 @@
346
346
  .col-span-2 {
347
347
  grid-column: span 2 / span 2;
348
348
  }
349
+ .container {
350
+ width: 100%;
351
+ @media (width >= 40rem) {
352
+ max-width: 40rem;
353
+ }
354
+ @media (width >= 48rem) {
355
+ max-width: 48rem;
356
+ }
357
+ @media (width >= 64rem) {
358
+ max-width: 64rem;
359
+ }
360
+ @media (width >= 80rem) {
361
+ max-width: 80rem;
362
+ }
363
+ @media (width >= 96rem) {
364
+ max-width: 96rem;
365
+ }
366
+ }
349
367
  .mx-2 {
350
368
  margin-inline: calc(var(--spacing) * 2);
351
369
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/network-admin",
3
3
  "description": "Network Admin package for Powerhouse",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
7
7
  "type": "git",