@powerhousedao/network-admin 0.0.23 → 0.0.24

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.
Files changed (58) hide show
  1. package/dist/editors/hooks/useNetworkProfileDocument.d.ts +4 -0
  2. package/dist/editors/hooks/useNetworkProfileDocument.d.ts.map +1 -0
  3. package/dist/editors/hooks/useNetworkProfileDocument.js +8 -0
  4. package/dist/editors/hooks/usePaymentTermsDocument.d.ts +4 -0
  5. package/dist/editors/hooks/usePaymentTermsDocument.d.ts.map +1 -0
  6. package/dist/editors/hooks/usePaymentTermsDocument.js +8 -0
  7. package/dist/editors/hooks/useRequestForProposalsDocument.d.ts +4 -0
  8. package/dist/editors/hooks/useRequestForProposalsDocument.d.ts.map +1 -0
  9. package/dist/editors/hooks/useRequestForProposalsDocument.js +8 -0
  10. package/dist/editors/hooks/useWorkstreamDocument.d.ts +4 -0
  11. package/dist/editors/hooks/useWorkstreamDocument.d.ts.map +1 -0
  12. package/dist/editors/hooks/useWorkstreamDocument.js +8 -0
  13. package/dist/editors/network-admin/components/DriveExplorer.d.ts +3 -1
  14. package/dist/editors/network-admin/components/DriveExplorer.d.ts.map +1 -1
  15. package/dist/editors/network-admin/components/DriveExplorer.js +83 -114
  16. package/dist/editors/network-admin/editor.d.ts +3 -14
  17. package/dist/editors/network-admin/editor.d.ts.map +1 -1
  18. package/dist/editors/network-admin/editor.js +2 -24
  19. package/dist/editors/network-admin/index.d.ts +0 -1
  20. package/dist/editors/network-admin/index.d.ts.map +1 -1
  21. package/dist/editors/network-admin/index.js +1 -2
  22. package/dist/editors/network-profile/editor.d.ts +1 -1
  23. package/dist/editors/network-profile/editor.d.ts.map +1 -1
  24. package/dist/editors/network-profile/editor.js +4 -4
  25. package/dist/editors/payment-terms/basic-terms-tab.d.ts +5 -3
  26. package/dist/editors/payment-terms/basic-terms-tab.d.ts.map +1 -1
  27. package/dist/editors/payment-terms/basic-terms-tab.js +18 -14
  28. package/dist/editors/payment-terms/clauses-tab.d.ts +4 -2
  29. package/dist/editors/payment-terms/clauses-tab.d.ts.map +1 -1
  30. package/dist/editors/payment-terms/cost-materials-tab.d.ts +5 -3
  31. package/dist/editors/payment-terms/cost-materials-tab.d.ts.map +1 -1
  32. package/dist/editors/payment-terms/cost-materials-tab.js +24 -15
  33. package/dist/editors/payment-terms/editor.d.ts +1 -1
  34. package/dist/editors/payment-terms/editor.d.ts.map +1 -1
  35. package/dist/editors/payment-terms/editor.js +5 -5
  36. package/dist/editors/payment-terms/escrow-tab.d.ts +4 -2
  37. package/dist/editors/payment-terms/escrow-tab.d.ts.map +1 -1
  38. package/dist/editors/payment-terms/escrow-tab.js +4 -4
  39. package/dist/editors/payment-terms/evaluation-tab.d.ts +4 -2
  40. package/dist/editors/payment-terms/evaluation-tab.d.ts.map +1 -1
  41. package/dist/editors/payment-terms/index.d.ts.map +1 -1
  42. package/dist/editors/payment-terms/milestones-tab.d.ts +5 -4
  43. package/dist/editors/payment-terms/milestones-tab.d.ts.map +1 -1
  44. package/dist/editors/payment-terms/milestones-tab.js +31 -21
  45. package/dist/editors/payment-terms/retainer-tab.d.ts +4 -2
  46. package/dist/editors/payment-terms/retainer-tab.d.ts.map +1 -1
  47. package/dist/editors/payment-terms/retainer-tab.js +18 -10
  48. package/dist/editors/request-for-proposals/editor.d.ts +1 -1
  49. package/dist/editors/request-for-proposals/editor.d.ts.map +1 -1
  50. package/dist/editors/request-for-proposals/editor.js +3 -3
  51. package/dist/editors/workstream/editor.d.ts +1 -1
  52. package/dist/editors/workstream/editor.d.ts.map +1 -1
  53. package/dist/editors/workstream/editor.js +70 -76
  54. package/dist/style.css +0 -35
  55. package/package.json +2 -2
  56. package/dist/editors/network-admin/components/EditorContainer.d.ts +0 -13
  57. package/dist/editors/network-admin/components/EditorContainer.d.ts.map +0 -1
  58. package/dist/editors/network-admin/components/EditorContainer.js +0 -99
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState, useCallback, useMemo } from "react";
3
- import { TextInput, Select, Textarea, DatePicker } from "@powerhousedao/document-engineering";
3
+ import { TextInput, Select, Textarea, DatePicker, } from "@powerhousedao/document-engineering";
4
4
  import { Button, toast } from "@powerhousedao/design-system";
5
5
  export function RetainerTab({ state, dispatch, actions }) {
6
6
  const [isEditing, setIsEditing] = useState(false);
@@ -10,16 +10,17 @@ export function RetainerTab({ state, dispatch, actions }) {
10
10
  startDate: state.retainerDetails?.startDate || "",
11
11
  endDate: state.retainerDetails?.endDate || "",
12
12
  autoRenew: state.retainerDetails?.autoRenew || false,
13
- servicesIncluded: state.retainerDetails?.servicesIncluded || ""
13
+ servicesIncluded: state.retainerDetails?.servicesIncluded || "",
14
14
  });
15
15
  const billingFrequencyOptions = useMemo(() => [
16
16
  { label: "Weekly", value: "WEEKLY" },
17
17
  { label: "Biweekly", value: "BIWEEKLY" },
18
- { label: "Monthly", value: "MONTHLY" }
18
+ { label: "Monthly", value: "MONTHLY" },
19
19
  ], []);
20
20
  const handleSubmit = useCallback((e) => {
21
21
  e.preventDefault();
22
- if (!formData.retainerAmount || isNaN(parseFloat(formData.retainerAmount))) {
22
+ if (!formData.retainerAmount ||
23
+ isNaN(parseFloat(formData.retainerAmount))) {
23
24
  toast("Please enter a valid retainer amount", {
24
25
  type: "error",
25
26
  });
@@ -39,17 +40,19 @@ export function RetainerTab({ state, dispatch, actions }) {
39
40
  }
40
41
  // Convert date strings to ISO format for the schema
41
42
  const startDate = new Date(formData.startDate).toISOString();
42
- const endDate = formData.endDate ? new Date(formData.endDate).toISOString() : undefined;
43
+ const endDate = formData.endDate
44
+ ? new Date(formData.endDate).toISOString()
45
+ : undefined;
43
46
  dispatch(actions.setRetainerDetails({
44
47
  retainerAmount: {
45
48
  value: parseFloat(formData.retainerAmount),
46
- unit: state.currency
49
+ unit: state.currency,
47
50
  },
48
51
  billingFrequency: formData.billingFrequency,
49
52
  startDate: startDate,
50
53
  endDate: endDate,
51
54
  autoRenew: formData.autoRenew,
52
- servicesIncluded: formData.servicesIncluded
55
+ servicesIncluded: formData.servicesIncluded,
53
56
  }));
54
57
  toast("Retainer configuration saved", {
55
58
  type: "success",
@@ -63,16 +66,21 @@ export function RetainerTab({ state, dispatch, actions }) {
63
66
  startDate: state.retainerDetails?.startDate || "",
64
67
  endDate: state.retainerDetails?.endDate || "",
65
68
  autoRenew: state.retainerDetails?.autoRenew || false,
66
- servicesIncluded: state.retainerDetails?.servicesIncluded || ""
69
+ servicesIncluded: state.retainerDetails?.servicesIncluded || "",
67
70
  });
68
71
  setIsEditing(false);
69
72
  }, [state.retainerDetails]);
70
73
  if (!isEditing) {
71
- return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center mb-4", children: [_jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Retainer Configuration" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: state.retainerDetails ? "Edit Configuration" : "Configure Retainer" })] }), state.retainerDetails ? (_jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Retainer Amount" }), _jsx("p", { className: "text-lg dark:text-white", children: state.retainerDetails.retainerAmount
74
+ return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center mb-4", children: [_jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Retainer Configuration" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: state.retainerDetails
75
+ ? "Edit Configuration"
76
+ : "Configure Retainer" })] }), state.retainerDetails ? (_jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Retainer Amount" }), _jsx("p", { className: "text-lg dark:text-white", children: state.retainerDetails.retainerAmount
72
77
  ? `${state.retainerDetails.retainerAmount.value} ${state.retainerDetails.retainerAmount.unit}`
73
78
  : "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Billing Frequency" }), _jsx("p", { className: "text-lg dark:text-white", children: state.retainerDetails.billingFrequency })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Start Date" }), _jsx("p", { className: "text-lg dark:text-white", children: state.retainerDetails.startDate })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "End Date" }), _jsx("p", { className: "text-lg dark:text-white", children: state.retainerDetails.endDate || "Ongoing" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Auto Renew" }), _jsx("p", { className: "text-lg dark:text-white", children: state.retainerDetails.autoRenew ? "Yes" : "No" })] }), _jsxs("div", { className: "col-span-2", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Services Included" }), _jsx("div", { className: "bg-gray-50 dark:bg-gray-700 p-3 rounded border dark:border-gray-600", children: _jsx("p", { className: "text-sm dark:text-white", children: state.retainerDetails.servicesIncluded }) })] })] })) : (_jsxs("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [_jsx("p", { children: "No retainer configuration set up yet." }), _jsx("p", { className: "text-sm", children: "Click \"Configure Retainer\" to get started." })] }))] }));
74
79
  }
75
- return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [_jsx("div", { className: "flex justify-between items-center mb-4", children: _jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Configure Retainer" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsx(TextInput, { label: "Retainer Amount *", type: "number", value: formData.retainerAmount, onChange: (e) => setFormData({ ...formData, retainerAmount: e.target.value }), className: "w-full", placeholder: "0.00", step: "0.01", required: true }), _jsx(Select, { label: "Billing Frequency *", options: billingFrequencyOptions, value: formData.billingFrequency, onChange: (value) => setFormData({ ...formData, billingFrequency: value }) }), _jsx(DatePicker, { value: formData.startDate ? new Date(formData.startDate) : undefined, onChange: (e) => {
80
+ return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [_jsx("div", { className: "flex justify-between items-center mb-4", children: _jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Configure Retainer" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsx(TextInput, { label: "Retainer Amount *", type: "number", value: formData.retainerAmount, onChange: (e) => setFormData({ ...formData, retainerAmount: e.target.value }), className: "w-full", placeholder: "0.00", step: "0.01", required: true }), _jsx(Select, { label: "Billing Frequency *", options: billingFrequencyOptions, value: formData.billingFrequency, onChange: (value) => setFormData({
81
+ ...formData,
82
+ billingFrequency: value,
83
+ }) }), _jsx(DatePicker, { value: formData.startDate ? new Date(formData.startDate) : undefined, onChange: (e) => {
76
84
  const date = e.target.value ? new Date(e.target.value) : null;
77
85
  setFormData({ ...formData, startDate: date?.toISOString() || "" });
78
86
  }, name: "start-date", placeholder: "Select start date", required: true }), _jsx(DatePicker, { value: formData.endDate ? new Date(formData.endDate) : undefined, onChange: (e) => {
@@ -1,4 +1,4 @@
1
1
  import type { EditorProps } from "document-model";
2
2
  export type IProps = EditorProps;
3
- export default function Editor(props: any): import("react/jsx-runtime").JSX.Element;
3
+ export default function Editor(): import("react/jsx-runtime").JSX.Element;
4
4
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/request-for-proposals/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAgB1D,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAYjC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,2CA8HxC"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/request-for-proposals/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAe1D,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAYjC,MAAM,CAAC,OAAO,UAAU,MAAM,4CA8H7B"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { actions, } from "../../document-models/request-for-proposals/index.js";
3
- import { useDocumentById } from "@powerhousedao/reactor-browser";
4
3
  import { DatePicker, Select, TextInput, } from "@powerhousedao/document-engineering";
5
4
  import { MarkdownEditor } from "./markdown-editor.js";
5
+ import { useSelectedRequestForProposalsDocument } from "../hooks/useRequestForProposalsDocument.js";
6
6
  const statusOptions = [
7
7
  { label: "DRAFT", value: "DRAFT" },
8
8
  { label: "REQUEST_FOR_COMMMENTS", value: "REQUEST_FOR_COMMMENTS" },
@@ -12,8 +12,8 @@ const statusOptions = [
12
12
  { label: "NOT_AWARDED", value: "NOT_AWARDED" },
13
13
  { label: "CLOSED", value: "CLOSED" },
14
14
  ];
15
- export default function Editor(props) {
16
- const [doc, dispatch] = useDocumentById(props.documentId);
15
+ export default function Editor() {
16
+ const [doc, dispatch] = useSelectedRequestForProposalsDocument();
17
17
  const state = doc?.state.global;
18
18
  return (_jsx("div", { className: "w-full bg-gray-50", children: _jsxs("div", { className: "p-6 max-w-4xl mx-auto min-h-screen", children: [_jsx("div", { className: "bg-white rounded-lg p-6 mb-6 shadow-sm", children: _jsx("h1", { className: "text-3xl font-bold text-gray-900 mb-2", children: "Request for Proposals" }) }), _jsx("div", { className: "bg-white rounded-lg p-6 mb-6 shadow-sm", children: _jsxs("div", { className: "flex flex-row gap-6", children: [_jsxs("div", { className: "flex-1", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Code" }), _jsx(TextInput, { className: "w-full", defaultValue: state.code || "", onBlur: (e) => {
19
19
  if (e.target.value !== state.code) {
@@ -1,4 +1,4 @@
1
1
  import type { EditorProps } from "document-model";
2
2
  export type IProps = EditorProps;
3
- export default function Editor(props: any): import("react/jsx-runtime").JSX.Element;
3
+ export default function Editor(): import("react/jsx-runtime").JSX.Element;
4
4
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/workstream/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAiCtE,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAsBjC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,2CAuiCxC"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/workstream/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAmCxB,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAsBjC,MAAM,CAAC,OAAO,UAAU,MAAM,4CA+hC7B"}
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, toast, ToastContainer } from "@powerhousedao/design-system";
3
- import { TextInput, Select, OIDInput, Icon, ObjectSetTable, buildEnumCellEditor, } from "@powerhousedao/document-engineering";
3
+ import { TextInput, Select, OIDInput, ObjectSetTable, buildEnumCellEditor, } from "@powerhousedao/document-engineering";
4
4
  import { actions, } from "../../document-models/workstream/index.js";
5
5
  import { actions as rfpActions, } from "../../document-models/request-for-proposals/index.js";
6
6
  import { ScopeOfWork } from "@powerhousedao/project-management/document-models";
7
7
  import { generateId } from "document-model";
8
8
  import { useDocumentById, useSelectedDrive, addDocument, useSelectedDriveDocuments, dispatchActions, } from "@powerhousedao/reactor-browser";
9
9
  import { useEffect, useMemo, useState } from "react";
10
+ import { useSelectedWorkstreamDocument } from "../hooks/useWorkstreamDocument.js";
10
11
  // Status options for the dropdown
11
12
  const statusOptions = [
12
13
  { value: "RFP_DRAFT", label: "RFP Draft (RFP_DRAFT)" },
@@ -25,15 +26,13 @@ const statusStyles = {
25
26
  ACCEPTED: "bg-[#c8ecd1] text-[#4fc86f] rounded px-2 py-1 font-semibold",
26
27
  REJECTED: "bg-[#ffaea8] text-[#de3333] rounded px-2 py-1 font-semibold",
27
28
  };
28
- export default function Editor(props) {
29
- const [doc, dispatch] = useDocumentById(props.documentId);
29
+ export default function Editor() {
30
+ const [doc, dispatch] = useSelectedWorkstreamDocument();
30
31
  // Try to get dispatch from context or props
31
32
  const [state, setState] = useState(doc.state.global);
32
33
  useEffect(() => {
33
34
  setState(doc.state.global);
34
35
  }, [doc.state.global]);
35
- const setActiveDocumentId = props.setActiveDocumentId;
36
- const setActiveSidebarNodeId = props.setActiveSidebarNodeId;
37
36
  const [selectedDrive] = useSelectedDrive();
38
37
  const createRfpDocument = async () => {
39
38
  const createdNode = await addDocument(selectedDrive?.header.id || "", `RFP-${state.title || ""}`, "powerhouse/rfp", undefined, undefined, undefined, "request-for-proposals-editor");
@@ -125,8 +124,7 @@ export default function Editor(props) {
125
124
  rfpDocumentDataState?.state?.global) {
126
125
  const newRfpDocument = {
127
126
  ...rfpDocumentNode,
128
- document: (rfpDocumentDataState?.state)
129
- .global,
127
+ document: (rfpDocumentDataState?.state).global,
130
128
  };
131
129
  // Only update if the ID changed or if we don't have a document yet
132
130
  setRfpDocument((prev) => {
@@ -169,7 +167,8 @@ export default function Editor(props) {
169
167
  false)));
170
168
  return results?.map((doc) => ({
171
169
  value: doc.header.id,
172
- title: doc.state?.global?.title || doc.header.name,
170
+ title: doc.state
171
+ ?.global?.title || doc.header.name,
173
172
  path: "",
174
173
  }));
175
174
  };
@@ -180,7 +179,7 @@ export default function Editor(props) {
180
179
  node.header.id.toLowerCase().includes(userInput.toLowerCase())));
181
180
  return results?.map((doc) => ({
182
181
  value: doc.header.id,
183
- title: doc.state?.global?.title || doc.header.name,
182
+ title: doc.header.name,
184
183
  path: "",
185
184
  }));
186
185
  };
@@ -260,11 +259,11 @@ export default function Editor(props) {
260
259
  title: "Author",
261
260
  editable: true,
262
261
  onSave: (newValue, context) => {
263
- if (newValue !== context.row.title) {
262
+ if (newValue !== context.row.author.name) {
264
263
  dispatch(actions.editAlternativeProposal({
265
264
  id: context.row.id,
266
265
  proposalAuthor: {
267
- id: context.row.authorId,
266
+ id: context.row.author.id,
268
267
  name: newValue,
269
268
  },
270
269
  }));
@@ -272,7 +271,7 @@ export default function Editor(props) {
272
271
  }
273
272
  return false;
274
273
  },
275
- renderCell: (value, context) => {
274
+ renderCell: (value) => {
276
275
  if (value === undefined) {
277
276
  return (_jsx("div", { className: "font-light italic text-left text-gray-500 text-xs", children: "+ Double-click to add new author" }));
278
277
  }
@@ -286,7 +285,7 @@ export default function Editor(props) {
286
285
  editable: true,
287
286
  align: "center",
288
287
  onSave: (newValue, context) => {
289
- if (newValue !== context.row.title) {
288
+ if (newValue !== context.row.sow) {
290
289
  dispatch(actions.editAlternativeProposal({
291
290
  id: context.row.id,
292
291
  sowId: newValue,
@@ -303,7 +302,7 @@ export default function Editor(props) {
303
302
  editable: true,
304
303
  align: "center",
305
304
  onSave: (newValue, context) => {
306
- if (newValue !== context.row.title) {
305
+ if (newValue !== context.row.paymentTerms) {
307
306
  dispatch(actions.editAlternativeProposal({
308
307
  id: context.row.id,
309
308
  paymentTermsId: newValue,
@@ -366,63 +365,60 @@ export default function Editor(props) {
366
365
  if (e.target.value !== state.client?.icon) {
367
366
  handleClientChange("icon", e.target.value);
368
367
  }
369
- }, placeholder: "Enter client icon URL" })] })] })] })] }), _jsxs("div", { className: "bg-white rounded-lg p-6 mt-6 mb-6 shadow-sm", children: [_jsx("h1", { className: "text-2xl text-gray-900 mb-4", children: "Request for Proposal" }), _jsxs("div", { className: "w-full flex flex-row items-center gap-8", children: [_jsx("div", { className: "w-[350px]", children: _jsx(OIDInput, { name: "Request for Proposal", label: "RFP Document", placeholder: "Search for RFP Document", variant: "withValueTitleAndDescription", value: newlyCreatedRfpId || state.rfp?.id || "", onBlur: (e) => {
370
- if (e.target.value !== state.rfp?.id) {
371
- dispatch(actions.setRequestForProposal({
372
- rfpId: e.target.value,
373
- title: rfpDocument?.document.title || "",
374
- }));
375
- }
376
- },
377
- // search options as the user types
378
- fetchOptionsCallback: async (userInput) => {
379
- const results = searchRfpDocuments(userInput || "") || [];
380
- if (results?.length === 0) {
381
- return Promise.reject(new Error("No RFP documents found"));
382
- }
383
- return results?.map((doc) => ({
384
- value: doc.value, // unique document ID
385
- title: doc.title, // document title or name
386
- path: {
387
- text: doc.path,
388
- url: doc.value,
389
- }, // document path or location
390
- description: "", // document description or summary
391
- icon: "File", // document icon
392
- }));
393
- },
394
- // get details of a specific option by its ID/value
395
- fetchSelectedOptionCallback: async (documentId) => {
396
- console.log("fetching selected option", documentId);
397
- const doc = searchRfpDocuments(documentId)?.[0];
398
- if (!doc) {
399
- return Promise.reject(new Error("RFP document not found"));
400
- }
401
- return {
402
- value: doc.value,
403
- title: doc.title,
404
- path: {
405
- text: doc.path,
406
- url: doc.title,
407
- },
408
- description: "",
409
- icon: "File",
410
- };
411
- }, initialOptions: [
412
- {
413
- value: rfpDocument?.header.id || "",
368
+ }, placeholder: "Enter client icon URL" })] })] })] })] }), _jsxs("div", { className: "bg-white rounded-lg p-6 mt-6 mb-6 shadow-sm", children: [_jsx("h1", { className: "text-2xl text-gray-900 mb-4", children: "Request for Proposal" }), _jsx("div", { className: "w-full flex flex-row items-center gap-8", children: _jsx("div", { className: "w-[350px]", children: _jsx(OIDInput, { name: "Request for Proposal", label: "RFP Document", placeholder: "Search for RFP Document", variant: "withValueTitleAndDescription", value: newlyCreatedRfpId || state.rfp?.id || "", onBlur: (e) => {
369
+ if (e.target.value !== state.rfp?.id) {
370
+ dispatch(actions.setRequestForProposal({
371
+ rfpId: e.target.value,
414
372
  title: rfpDocument?.document.title || "",
415
- path: {
416
- text: rfpDocument?.document.title || "",
417
- url: rfpDocument?.header.id || "",
418
- },
419
- description: "",
420
- icon: "File",
373
+ }));
374
+ }
375
+ },
376
+ // search options as the user types
377
+ fetchOptionsCallback: async (userInput) => {
378
+ const results = searchRfpDocuments(userInput || "") || [];
379
+ if (results?.length === 0) {
380
+ return Promise.reject(new Error("No RFP documents found"));
381
+ }
382
+ return results?.map((doc) => ({
383
+ value: doc.value, // unique document ID
384
+ title: doc.title, // document title or name
385
+ path: {
386
+ text: doc.path,
387
+ url: doc.value,
388
+ }, // document path or location
389
+ description: "", // document description or summary
390
+ icon: "File", // document icon
391
+ }));
392
+ },
393
+ // get details of a specific option by its ID/value
394
+ fetchSelectedOptionCallback: async (documentId) => {
395
+ console.log("fetching selected option", documentId);
396
+ const doc = searchRfpDocuments(documentId)?.[0];
397
+ if (!doc) {
398
+ return Promise.reject(new Error("RFP document not found"));
399
+ }
400
+ return {
401
+ value: doc.value,
402
+ title: doc.title,
403
+ path: {
404
+ text: doc.path,
405
+ url: doc.title,
421
406
  },
422
- ] }) }), rfpDocument ? (_jsx("div", { className: "flex items-center", children: _jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx(Icon, { className: "hover:cursor-pointer hover:bg-gray-500", name: "Moved", size: 18, onClick: () => {
423
- setActiveDocumentId(rfpDocument?.header.id);
424
- setActiveSidebarNodeId(`editor-${rfpDocument?.header.id}`);
425
- } }), _jsx("span", { children: "RFP Editor" })] }) })) : ("")] }), !rfpDocument ? (_jsx("div", { className: "mt-4", children: _jsx(Button, { color: "light", size: "small", className: "cursor-pointer hover:bg-gray-600 hover:text-white", title: "Save Workstream", "aria-description": "Save Workstream", onClick: async () => {
407
+ description: "",
408
+ icon: "File",
409
+ };
410
+ }, initialOptions: [
411
+ {
412
+ value: rfpDocument?.header.id || "",
413
+ title: rfpDocument?.document.title || "",
414
+ path: {
415
+ text: rfpDocument?.document.title || "",
416
+ url: rfpDocument?.header.id || "",
417
+ },
418
+ description: "",
419
+ icon: "File",
420
+ },
421
+ ] }) }) }), !rfpDocument ? (_jsx("div", { className: "mt-4", children: _jsx(Button, { color: "light", size: "small", className: "cursor-pointer hover:bg-gray-600 hover:text-white", title: "Save Workstream", "aria-description": "Save Workstream", onClick: async () => {
426
422
  const createdNode = await createRfpDocument();
427
423
  if (createdNode) {
428
424
  // Set local state to immediately show the new RFP ID
@@ -452,9 +448,9 @@ export default function Editor(props) {
452
448
  { value: "ACCEPTED", label: "Accepted" },
453
449
  { value: "REJECTED", label: "Rejected" },
454
450
  ], value: state.initialProposal.status || "DRAFT", onChange: (value) => {
455
- if (value !== state.initialProposal.status) {
451
+ if (value !== state.initialProposal?.status) {
456
452
  dispatch(actions.editInitialProposal({
457
- id: state.initialProposal.id,
453
+ id: state.initialProposal?.id || "",
458
454
  status: value,
459
455
  }));
460
456
  }
@@ -503,8 +499,8 @@ export default function Editor(props) {
503
499
  ? [
504
500
  {
505
501
  value: sowDocumentNode.header.id,
506
- title: sowDocumentNode.state?.global
507
- ?.title || sowDocumentNode.header.name,
502
+ title: sowDocumentNode.state?.global?.title ||
503
+ sowDocumentNode.header.name,
508
504
  path: {
509
505
  text: sowDocumentNode.header.name,
510
506
  url: sowDocumentNode.header.id,
@@ -571,9 +567,7 @@ export default function Editor(props) {
571
567
  ? [
572
568
  {
573
569
  value: paymentTermsDocumentNode.header.id,
574
- title: paymentTermsDocumentNode.state
575
- ?.global?.title ||
576
- paymentTermsDocumentNode.header.name,
570
+ title: paymentTermsDocumentNode.header.name,
577
571
  path: {
578
572
  text: paymentTermsDocumentNode.header.name,
579
573
  url: paymentTermsDocumentNode.header.id,
package/dist/style.css CHANGED
@@ -333,24 +333,6 @@
333
333
  .col-span-2 {
334
334
  grid-column: span 2 / span 2;
335
335
  }
336
- .container {
337
- width: 100%;
338
- @media (width >= 40rem) {
339
- max-width: 40rem;
340
- }
341
- @media (width >= 48rem) {
342
- max-width: 48rem;
343
- }
344
- @media (width >= 64rem) {
345
- max-width: 64rem;
346
- }
347
- @media (width >= 80rem) {
348
- max-width: 80rem;
349
- }
350
- @media (width >= 96rem) {
351
- max-width: 96rem;
352
- }
353
- }
354
336
  .mx-2 {
355
337
  margin-inline: calc(var(--spacing) * 2);
356
338
  }
@@ -408,9 +390,6 @@
408
390
  .inline {
409
391
  display: inline;
410
392
  }
411
- .inline-flex {
412
- display: inline-flex;
413
- }
414
393
  .table {
415
394
  display: table;
416
395
  }
@@ -981,13 +960,6 @@
981
960
  --tw-duration: 200ms;
982
961
  transition-duration: 200ms;
983
962
  }
984
- .hover\:cursor-pointer {
985
- &:hover {
986
- @media (hover: hover) {
987
- cursor: pointer;
988
- }
989
- }
990
- }
991
963
  .hover\:bg-blue-600 {
992
964
  &:hover {
993
965
  @media (hover: hover) {
@@ -1009,13 +981,6 @@
1009
981
  }
1010
982
  }
1011
983
  }
1012
- .hover\:bg-gray-500 {
1013
- &:hover {
1014
- @media (hover: hover) {
1015
- background-color: var(--color-gray-500);
1016
- }
1017
- }
1018
- }
1019
984
  .hover\:bg-gray-600 {
1020
985
  &:hover {
1021
986
  @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.23",
4
+ "version": "0.0.24",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [
@@ -59,7 +59,7 @@
59
59
  "@powerhousedao/common": "^5.0.0-staging.22",
60
60
  "@powerhousedao/design-system": "^5.0.0-staging.22",
61
61
  "@powerhousedao/document-engineering": "^1.38.0",
62
- "@powerhousedao/project-management": "0.0.41",
62
+ "@powerhousedao/project-management": "0.0.43",
63
63
  "@uiw/react-md-editor": "^4.0.8",
64
64
  "document-model": "^5.0.0-staging.22",
65
65
  "error": "^10.4.0",
@@ -1,13 +0,0 @@
1
- /**
2
- * Document editor container that wraps individual document editors.
3
- * Handles document loading, toolbar, revision history, and dynamic editor loading.
4
- * Customize toolbar actions and editor context here.
5
- */
6
- export declare const EditorContainer: (props: {
7
- handleClose: () => void;
8
- hideToolbar?: boolean;
9
- activeDocumentId: string;
10
- setActiveDocumentId: (id: string) => void;
11
- setActiveSidebarNodeId: (id: string) => void;
12
- }) => import("react/jsx-runtime").JSX.Element;
13
- //# sourceMappingURL=EditorContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/EditorContainer.tsx"],"names":[],"mappings":"AAqBA;;;;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;IAC1C,sBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,4CAkMA,CAAC"}
@@ -1,99 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getRevisionFromDate, useTimelineItems } from "@powerhousedao/common";
3
- import { DocumentToolbar, RevisionHistory, } from "@powerhousedao/design-system";
4
- import { exportFile, useEditorModuleById, useSelectedDrive, useDocumentById, addDocument, useNodes, useFallbackEditorModule, dispatchActions, } from "@powerhousedao/reactor-browser";
5
- import { Suspense, useCallback, useState } from "react";
6
- import { actions as rfpActions } from "../../../document-models/request-for-proposals/index.js";
7
- import { ScopeOfWork } from "@powerhousedao/project-management/document-models";
8
- /**
9
- * Document editor container that wraps individual document editors.
10
- * Handles document loading, toolbar, revision history, and dynamic editor loading.
11
- * Customize toolbar actions and editor context here.
12
- */
13
- export const EditorContainer = (props) => {
14
- const { handleClose, hideToolbar = false, activeDocumentId, setActiveDocumentId, setActiveSidebarNodeId, } = props;
15
- // UI state for revision history and timeline
16
- const [selectedTimelineItem, setSelectedTimelineItem] = useState(null);
17
- const [showRevisionHistory, setShowRevisionHistory] = useState(false);
18
- const [selectedDocument, dispatch] = useDocumentById(props.activeDocumentId);
19
- const [selectedDrive] = useSelectedDrive();
20
- const nodes = useNodes();
21
- const folderId = nodes?.find((node) => node.id === selectedDocument?.header.id)
22
- ?.parentFolder || undefined;
23
- const createRfpDocument = useCallback(async () => {
24
- const rfpDocName = `RFP-${(selectedDocument?.state).global?.title || "Untitled"}`;
25
- const rfpDocCode = `RFP-${(selectedDocument?.state).global?.code || ""}`;
26
- try {
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);
33
- return createdNode;
34
- }
35
- catch (error) {
36
- console.error("Error creating RFP document", error);
37
- return null;
38
- }
39
- }, [selectedDrive, (selectedDocument?.state).global, folderId]);
40
- const createSowDocument = useCallback(async () => {
41
- const sowDocName = `SOW-${(selectedDocument?.state).global?.title || "Untitled"}`;
42
- try {
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);
49
- return createdNode;
50
- }
51
- catch (error) {
52
- console.error("Error creating SOW document", error);
53
- return null;
54
- }
55
- }, [selectedDrive, (selectedDocument?.state).global, folderId]);
56
- const createPaymentTermsDocument = useCallback(async () => {
57
- const paymentTermsDocName = `Payment Terms-${(selectedDocument?.state).global?.title || "Untitled"}`;
58
- try {
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
- }
64
- return createdNode;
65
- }
66
- catch (error) {
67
- console.error("Error creating Payment Terms document", error);
68
- return null;
69
- }
70
- }, [selectedDrive, (selectedDocument?.state).global, folderId]);
71
- // Timeline data for revision history
72
- const timelineItems = useTimelineItems(selectedDocument?.header.id, selectedDocument?.header.createdAtUtcIso, selectedDrive?.header.id);
73
- let preferredEditor = useFallbackEditorModule(selectedDocument?.header.documentType);
74
- const editorModule = useEditorModuleById(selectedDocument?.header.meta?.preferredEditor ||
75
- preferredEditor?.id ||
76
- undefined);
77
- // Document export functionality - customize export behavior here
78
- const onExport = useCallback(async () => {
79
- if (selectedDocument) {
80
- await exportFile(selectedDocument);
81
- }
82
- }, [selectedDocument]);
83
- // Loading state component
84
- const loadingContent = (_jsx("div", { className: "flex h-full flex-1 items-center justify-center", children: _jsx("div", { children: "sth is wrong fix yourself" }) }));
85
- if (!selectedDocument)
86
- return loadingContent;
87
- // Dynamically load the appropriate editor component for this document type
88
- const EditorComponent = editorModule?.Component;
89
- if (!EditorComponent)
90
- return loadingContent;
91
- return (_jsx("div", { className: "", children: showRevisionHistory ? (
92
- // Revision history view
93
- _jsx(RevisionHistory, { documentId: selectedDocument.header.id, documentTitle: selectedDocument.header.name, globalOperations: selectedDocument.operations.global, localOperations: selectedDocument.operations.local, onClose: () => setShowRevisionHistory(false) }, selectedDocument.header.id)) : (
94
- // Main editor view
95
- _jsxs(Suspense, { fallback: loadingContent, children: [!hideToolbar && (_jsx(DocumentToolbar, { onClose: handleClose, onExport: onExport, onShowRevisionHistory: () => setShowRevisionHistory(true), onSwitchboardLinkClick: () => { }, title: selectedDocument.header.name, timelineButtonVisible: editorModule.config.timelineEnabled, timelineItems: timelineItems.data, onTimelineItemClick: setSelectedTimelineItem })), _jsx(EditorComponent, { context: {
96
- readMode: !!selectedTimelineItem,
97
- selectedTimelineRevision: getRevisionFromDate(selectedTimelineItem?.startDate, selectedTimelineItem?.endDate, selectedDocument.operations.global),
98
- }, dispatch: dispatch, document: selectedDocument, error: console.error, setActiveSidebarNodeId: setActiveSidebarNodeId, setActiveDocumentId: setActiveDocumentId, createSow: createSowDocument, createPaymentTerms: createPaymentTermsDocument, documentId: selectedDocument.header.id }, selectedDocument.header.id)] })) }));
99
- };