@powerhousedao/network-admin 0.0.11 → 0.0.12

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.
@@ -1 +1 @@
1
- {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/DriveExplorer.tsx"],"names":[],"mappings":"AAwCA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,2CAkmCvC"}
1
+ {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/DriveExplorer.tsx"],"names":[],"mappings":"AAyCA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,2CAylCvC"}
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, CreateDocumentModal, useDrop, } from "@powerhousedao/design-system";
3
- import { addDocument, setSelectedNode, useAllFolderNodes, useDocumentModelModules, useDriveContext, useDriveSharingType, useEditorModules, useFileChildNodes, useFolderChildNodes, useSelectedDrive, useSelectedFolder, useSelectedNodePath, useUserPermissions, useAllDocuments, } from "@powerhousedao/reactor-browser";
3
+ import { addDocument, setSelectedNode, useAllFolderNodes, useDocumentModelModules, useDriveContext, useDriveSharingType, useEditorModules, useFileChildNodes, useFolderChildNodes, useSelectedDrive, useSelectedFolder, useSelectedNodePath, useUserPermissions, useAllDocuments, dispatchActions, } from "@powerhousedao/reactor-browser";
4
4
  import { twMerge } from "tailwind-merge";
5
5
  import { useCallback, useRef, useState, useMemo } from "react";
6
6
  import { EditorContainer } from "./EditorContainer.js";
7
- import { createDocument as createNewWorkstreamDocument } from "../../../document-models/workstream/gen/utils.js";
8
7
  import { IsolatedSidebarProvider } from "./IsolatedSidebarProvider.js";
9
8
  import { IsolatedSidebar } from "./IsolatedSidebar.js";
9
+ import { editWorkstream } from "../../../document-models/workstream/gen/creators.js";
10
10
  /**
11
11
  * Main drive explorer component with sidebar navigation and content area.
12
12
  * Layout: Left sidebar (folder tree) + Right content area (files/folders + document editor)
@@ -122,7 +122,7 @@ export function DriveExplorer(props) {
122
122
  file.documentType !== "powerhouse/network-profile")
123
123
  .map((file) => ({
124
124
  id: `editor-${file.id}`,
125
- title: `📄 ${file.state?.code || ""} - ${file.state?.title || file.name}`,
125
+ title: `${file.state?.code || ""} - ${file.state?.title || file.name}`,
126
126
  })),
127
127
  ],
128
128
  })),
@@ -132,7 +132,7 @@ export function DriveExplorer(props) {
132
132
  file.documentType !== "powerhouse/network-profile")
133
133
  .map((file) => ({
134
134
  id: `editor-${file.id}`,
135
- title: `📄 ${file.state?.code || ""} - ${file.state?.title || file.name}`,
135
+ title: `${file.state?.code || ""} - ${file.state?.title || file.name}`,
136
136
  })),
137
137
  ],
138
138
  })),
@@ -142,7 +142,7 @@ export function DriveExplorer(props) {
142
142
  file.documentType !== "powerhouse/network-profile")
143
143
  .map((file) => ({
144
144
  id: `editor-${file.id}`,
145
- title: `📄 ${file.state?.code || ""} - ${file.state?.title || file.name}`,
145
+ title: `${file.state?.code || ""} - ${file.state?.title || file.name}`,
146
146
  })),
147
147
  ],
148
148
  };
@@ -179,7 +179,7 @@ export function DriveExplorer(props) {
179
179
  file.parentFolder === childFolder.id)
180
180
  .map((file) => ({
181
181
  id: `editor-${file.id}`,
182
- title: `📄 ${file.name}`,
182
+ title: `${file.name}`,
183
183
  })),
184
184
  ],
185
185
  })),
@@ -189,7 +189,7 @@ export function DriveExplorer(props) {
189
189
  file.parentFolder === folder.id)
190
190
  .map((file) => ({
191
191
  id: `editor-${file.id}`,
192
- title: `📄 ${file.name}`,
192
+ title: `${file.name}`,
193
193
  })),
194
194
  ],
195
195
  })),
@@ -199,7 +199,7 @@ export function DriveExplorer(props) {
199
199
  file.documentType === "powerhouse/network-profile")
200
200
  .map((file) => ({
201
201
  id: `editor-${file.id}`,
202
- title: `📄 ${file.name}`,
202
+ title: `${file.name}`,
203
203
  })),
204
204
  ],
205
205
  };
@@ -453,22 +453,12 @@ export function DriveExplorer(props) {
453
453
  console.log("Created workstream folder:", folder);
454
454
  setLastCreatedFolder(folder);
455
455
  }
456
- const createdDocument = createNewWorkstreamDocument({
457
- global: {
458
- code: "",
459
- title: fileName,
460
- status: "RFP_DRAFT",
461
- client: null,
462
- rfp: null,
463
- initialProposal: null,
464
- alternativeProposals: [],
465
- sow: null,
466
- paymentTerms: null,
467
- paymentRequests: [],
468
- },
469
- local: {},
470
- });
471
- const node = await addDocument(selectedDrive?.header.id || "", fileName, documentType, folder?.id, createdDocument, undefined, editorType);
456
+ const node = await addDocument(selectedDrive?.header.id || "", fileName, documentType, folder?.id, undefined, undefined, editorType);
457
+ if (!node?.id) {
458
+ console.error("Error creating document", fileName);
459
+ return;
460
+ }
461
+ await dispatchActions(editWorkstream({ title: fileName }), node.id);
472
462
  selectedDocumentModel.current = null;
473
463
  console.log("Created document node", node);
474
464
  if (node) {
@@ -1 +1 @@
1
- {"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/EditorContainer.tsx"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO;IACrC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,4CA6NA,CAAC"}
1
+ {"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/EditorContainer.tsx"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO;IACrC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,4CA+LA,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getRevisionFromDate, useTimelineItems } from "@powerhousedao/common";
3
3
  import { DocumentToolbar, RevisionHistory, } from "@powerhousedao/design-system";
4
- import { exportFile, useEditorModuleById, useSelectedDrive, useDocumentById, addDocument, useNodes, useFallbackEditorModule, } from "@powerhousedao/reactor-browser";
4
+ import { exportFile, useEditorModuleById, useSelectedDrive, useDocumentById, addDocument, useNodes, useFallbackEditorModule, dispatchActions, } from "@powerhousedao/reactor-browser";
5
5
  import { Suspense, useCallback, useState } from "react";
6
- import { createDocument as createNewRFPDocument } from "../../../document-models/request-for-proposals/gen/utils.js";
6
+ import { actions as rfpActions } from "../../../document-models/request-for-proposals/index.js";
7
7
  import { ScopeOfWork } from "@powerhousedao/project-management/document-models";
8
- import { createDocument as createNewPaymentTermsDocument } from "../../../document-models/payment-terms/gen/utils.js";
9
8
  /**
10
9
  * Document editor container that wraps individual document editors.
11
10
  * Handles document loading, toolbar, revision history, and dynamic editor loading.
@@ -25,30 +24,12 @@ export const EditorContainer = (props) => {
25
24
  const rfpDocName = `RFP-${(selectedDocument?.state).global?.title || "Untitled"}`;
26
25
  const rfpDocCode = `RFP-${(selectedDocument?.state).global?.code || ""}`;
27
26
  try {
28
- const createdDocument = createNewRFPDocument({
29
- global: {
30
- issuer: "",
31
- title: rfpDocName,
32
- code: rfpDocCode,
33
- summary: "",
34
- briefing: "",
35
- rfpCommenter: [],
36
- eligibilityCriteria: "",
37
- evaluationCriteria: "",
38
- budgetRange: {
39
- min: null,
40
- max: null,
41
- currency: null,
42
- },
43
- contextDocuments: [],
44
- status: "DRAFT",
45
- proposals: [],
46
- deadline: null,
47
- tags: null,
48
- },
49
- local: {},
50
- });
51
- const createdNode = await addDocument(selectedDrive?.header.id || "", rfpDocName, "powerhouse/rfp", folderId, createdDocument, undefined, "request-for-proposals-editor");
27
+ const createdNode = await addDocument(selectedDrive?.header.id || "", rfpDocName, "powerhouse/rfp", folderId, undefined, undefined, "request-for-proposals-editor");
28
+ if (!createdNode?.id) {
29
+ console.error("Error creating RFP document", rfpDocName);
30
+ return null;
31
+ }
32
+ await dispatchActions(rfpActions.editRfp({ title: rfpDocName, code: rfpDocCode }), createdNode.id);
52
33
  return createdNode;
53
34
  }
54
35
  catch (error) {
@@ -59,19 +40,12 @@ export const EditorContainer = (props) => {
59
40
  const createSowDocument = useCallback(async () => {
60
41
  const sowDocName = `SOW-${(selectedDocument?.state).global?.title || "Untitled"}`;
61
42
  try {
62
- const createdDocument = ScopeOfWork.utils.createDocument({
63
- global: {
64
- title: sowDocName,
65
- description: "",
66
- status: "DRAFT",
67
- deliverables: [],
68
- projects: [],
69
- roadmaps: [],
70
- contributors: [],
71
- },
72
- local: {},
73
- });
74
- const createdNode = await addDocument(selectedDrive?.header.id || "", sowDocName, "powerhouse/scopeofwork", folderId, createdDocument, undefined, "scope-of-work-editor");
43
+ const createdNode = await addDocument(selectedDrive?.header.id || "", sowDocName, "powerhouse/scopeofwork", folderId, undefined, undefined, "scope-of-work-editor");
44
+ if (!createdNode?.id) {
45
+ console.error("Error creating SOW document", sowDocName);
46
+ return null;
47
+ }
48
+ await dispatchActions(ScopeOfWork.actions.editScopeOfWork({ title: sowDocName }), createdNode.id);
75
49
  return createdNode;
76
50
  }
77
51
  catch (error) {
@@ -82,25 +56,11 @@ export const EditorContainer = (props) => {
82
56
  const createPaymentTermsDocument = useCallback(async () => {
83
57
  const paymentTermsDocName = `Payment Terms-${(selectedDocument?.state).global?.title || "Untitled"}`;
84
58
  try {
85
- const createdDocument = createNewPaymentTermsDocument({
86
- global: {
87
- status: "DRAFT",
88
- proposer: "",
89
- payer: "",
90
- currency: "USD",
91
- paymentModel: "MILESTONE",
92
- totalAmount: null,
93
- milestoneSchedule: [],
94
- costAndMaterials: null,
95
- retainerDetails: null,
96
- escrowDetails: null,
97
- evaluation: null,
98
- bonusClauses: [],
99
- penaltyClauses: [],
100
- },
101
- local: {},
102
- });
103
- const createdNode = await addDocument(selectedDrive?.header.id || "", paymentTermsDocName, "payment-terms", folderId, createdDocument, undefined, "payment-terms-editor");
59
+ const createdNode = await addDocument(selectedDrive?.header.id || "", paymentTermsDocName, "payment-terms", folderId, undefined, undefined, "payment-terms-editor");
60
+ if (!createdNode?.id) {
61
+ console.error("Error creating Payment Terms document", paymentTermsDocName);
62
+ return null;
63
+ }
104
64
  return createdNode;
105
65
  }
106
66
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"IsolatedSidebar.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/IsolatedSidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAI7D;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAEhC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAgTA,CAAC"}
1
+ {"version":3,"file":"IsolatedSidebar.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/IsolatedSidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAI7D;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAEhC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAyTA,CAAC"}
@@ -16,6 +16,7 @@ export const IsolatedSidebar = ({ nodes, activeNodeId, onActiveNodeChange, sideb
16
16
  }, [isCollapsed]);
17
17
  const handleNodeClick = useCallback((nodeId) => {
18
18
  sidebarContext.toggleNode(nodeId);
19
+ sidebarContext.syncActiveNodeId(nodeId);
19
20
  if (onActiveNodeChange) {
20
21
  onActiveNodeChange(nodeId);
21
22
  }
@@ -53,7 +54,7 @@ export const IsolatedSidebar = ({ nodes, activeNodeId, onActiveNodeChange, sideb
53
54
  }
54
55
  }, [sidebarContext]);
55
56
  const renderNode = (node, depth = 0) => {
56
- const isActive = activeNodeId === node.id;
57
+ const isActive = activeNodeId === node.id || sidebarContext.activeNodeId === node.id;
57
58
  const isExpanded = sidebarContext.expandedNodes.has(node.id);
58
59
  const hasChildren = node.children && node.children.length > 0;
59
60
  // Check if this node is the active search result
@@ -63,14 +64,14 @@ export const IsolatedSidebar = ({ nodes, activeNodeId, onActiveNodeChange, sideb
63
64
  // Check if this node matches the search term
64
65
  const nodeName = node.name || node.title || "";
65
66
  const matchesSearch = searchTerm && nodeName.toLowerCase().includes(searchTerm.toLowerCase());
66
- return (_jsxs("div", { className: "select-none", children: [_jsxs("div", { className: `flex items-center py-2 px-3 cursor-pointer hover:bg-gray-200 rounded-md mx-2 ${isActive
67
- ? "bg-blue-100 text-blue-600"
67
+ return (_jsxs("div", { className: "select-none", children: [_jsxs("div", { className: `flex items-center py-2 px-3 cursor-pointer rounded-md mx-2 ${isActive
68
+ ? "bg-gray-200 text-gray-900 font-semibold"
68
69
  : isSearchActive
69
- ? "bg-yellow-100 dark:bg-[#604B0033] text-gray-700"
70
- : "text-gray-700"}`, style: { paddingLeft: `${depth * 16 + 12}px` }, onClick: () => handleNodeClick(node.id), children: [hasChildren && (_jsx("button", { className: "mr-2 p-1 hover:bg-gray-300 rounded transition-colors", onClick: (e) => {
70
+ ? "bg-yellow-100 dark:bg-[#604B0033] text-gray-700 hover:bg-yellow-200"
71
+ : "text-gray-700 hover:bg-gray-200"}`, style: { paddingLeft: `${depth * 16 + 12}px` }, onClick: () => handleNodeClick(node.id), children: [hasChildren && (_jsx("button", { className: "mr-1 p-1 hover:bg-gray-300 rounded transition-colors", onClick: (e) => {
71
72
  e.stopPropagation();
72
73
  sidebarContext.toggleNode(node.id);
73
- }, children: _jsx(Icon, { name: isExpanded ? "ChevronDown" : "CaretRight", size: 12, className: "text-gray-500" }) })), !hasChildren && _jsx("div", { className: "w-6 mr-2" }), _jsx("span", { className: "text-sm truncate font-medium", children: matchesSearch && searchTerm ? (_jsx("span", { dangerouslySetInnerHTML: {
74
+ }, children: _jsx(Icon, { name: isExpanded ? "ChevronDown" : "CaretRight", size: 16, className: "text-gray-500" }) })), !hasChildren && (_jsx("div", { className: "mr-1 p-1", children: _jsx(Icon, { name: "CaretRight", size: 16, className: "text-gray-500" }) })), _jsx("span", { className: "text-sm truncate font-semimedium", children: matchesSearch && searchTerm ? (_jsx("span", { dangerouslySetInnerHTML: {
74
75
  __html: nodeName.replace(new RegExp(searchTerm, "gi"), (match) => `<span class="bg-yellow-300 dark:bg-[#604B00]">${match}</span>`),
75
76
  } })) : (nodeName) })] }), hasChildren && isExpanded && (_jsx("div", { children: node.children.map((child) => renderNode(child, depth + 1)) }))] }, node.id));
76
77
  };
package/dist/style.css CHANGED
@@ -28,6 +28,7 @@
28
28
  --color-amber-700: oklch(55.5% 0.163 48.998);
29
29
  --color-amber-800: oklch(47.3% 0.137 46.201);
30
30
  --color-yellow-100: oklch(97.3% 0.071 103.193);
31
+ --color-yellow-200: oklch(94.5% 0.129 101.54);
31
32
  --color-yellow-300: oklch(90.5% 0.182 98.111);
32
33
  --color-yellow-400: oklch(85.2% 0.199 91.936);
33
34
  --color-yellow-500: oklch(79.5% 0.184 86.047);
@@ -1115,6 +1116,13 @@
1115
1116
  }
1116
1117
  }
1117
1118
  }
1119
+ .hover\:bg-yellow-200 {
1120
+ &:hover {
1121
+ @media (hover: hover) {
1122
+ background-color: var(--color-yellow-200);
1123
+ }
1124
+ }
1125
+ }
1118
1126
  .hover\:bg-yellow-600 {
1119
1127
  &:hover {
1120
1128
  @media (hover: hover) {
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": "0.0.11",
4
+ "version": "0.0.12",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [