@powerhousedao/network-admin 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editors/network-admin/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/network-admin/components/DriveExplorer.js +99 -261
- package/dist/editors/network-admin/components/EditorContainer.d.ts.map +1 -1
- package/dist/editors/network-admin/components/EditorContainer.js +1 -1
- package/dist/editors/network-profile/editor.d.ts.map +1 -1
- package/dist/editors/network-profile/editor.js +40 -33
- package/dist/editors/payment-terms/editor.d.ts.map +1 -1
- package/dist/editors/payment-terms/editor.js +35 -24
- package/dist/editors/request-for-proposals/editor.d.ts.map +1 -1
- package/dist/editors/request-for-proposals/editor.js +3 -15
- package/dist/editors/workstream/editor.d.ts.map +1 -1
- package/dist/editors/workstream/editor.js +18 -19
- package/dist/style.css +321 -513
- package/package.json +14 -14
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { TextInput, Textarea, Select, Icon, } from "@powerhousedao/document-engineering";
|
|
3
3
|
import { toast, ToastContainer } from "@powerhousedao/design-system";
|
|
4
4
|
import { actions, } from "../../document-models/network-profile/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useDocumentById } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { useCallback, useState, useEffect } from "react";
|
|
7
7
|
// Category options for the dropdown
|
|
8
8
|
const categoryOptions = [
|
|
@@ -15,7 +15,10 @@ const categoryOptions = [
|
|
|
15
15
|
// Image Modal Component
|
|
16
16
|
function ImageModal({ isOpen, onClose, imageUrl, imageAlt, }) {
|
|
17
17
|
const [imageLoaded, setImageLoaded] = useState(false);
|
|
18
|
-
const [imageDimensions, setImageDimensions] = useState({
|
|
18
|
+
const [imageDimensions, setImageDimensions] = useState({
|
|
19
|
+
width: 0,
|
|
20
|
+
height: 0,
|
|
21
|
+
});
|
|
19
22
|
if (!isOpen)
|
|
20
23
|
return null;
|
|
21
24
|
const handleImageLoad = (e) => {
|
|
@@ -26,15 +29,15 @@ function ImageModal({ isOpen, onClose, imageUrl, imageAlt, }) {
|
|
|
26
29
|
// Calculate modal size based on image dimensions with padding
|
|
27
30
|
const getModalSize = () => {
|
|
28
31
|
if (!imageLoaded)
|
|
29
|
-
return { width:
|
|
32
|
+
return { width: "auto", height: "auto" };
|
|
30
33
|
const maxWidth = Math.min(imageDimensions.width + 100, window.innerWidth * 0.8);
|
|
31
34
|
const maxHeight = Math.min(imageDimensions.height + 100, window.innerHeight * 0.8);
|
|
32
35
|
return {
|
|
33
36
|
width: `${maxWidth}px`,
|
|
34
|
-
height: `${maxHeight}px
|
|
37
|
+
height: `${maxHeight}px`,
|
|
35
38
|
};
|
|
36
39
|
};
|
|
37
|
-
return (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm", onClick: onClose, children: _jsxs("div", { className: "relative bg-gray-900 rounded-lg shadow-2xl border-2 border-gray-700", style: getModalSize(), children: [_jsx("button", { onClick: onClose, className: "absolute -top-3 -right-3 z-10 w-8 h-8 bg-gray-800 hover:bg-gray-900 rounded-full flex items-center justify-center text-white transition-all duration-200 shadow-lg", children: _jsx(Icon, { name: "ArrowLeft", size: 16 }) }), _jsx("div", { className: "w-full h-full flex items-center justify-center p-8", children: _jsx("img", { src: imageUrl, alt: imageAlt, className: `max-w-full max-h-full object-contain rounded-lg ${imageLoaded ?
|
|
40
|
+
return (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm", onClick: onClose, children: _jsxs("div", { className: "relative bg-gray-900 rounded-lg shadow-2xl border-2 border-gray-700", style: getModalSize(), children: [_jsx("button", { onClick: onClose, className: "absolute -top-3 -right-3 z-10 w-8 h-8 bg-gray-800 hover:bg-gray-900 rounded-full flex items-center justify-center text-white transition-all duration-200 shadow-lg", children: _jsx(Icon, { name: "ArrowLeft", size: 16 }) }), _jsx("div", { className: "w-full h-full flex items-center justify-center p-8", children: _jsx("img", { src: imageUrl, alt: imageAlt, className: `max-w-full max-h-full object-contain rounded-lg ${imageLoaded ? "opacity-100" : "opacity-0"} transition-opacity duration-200`, onClick: (e) => e.stopPropagation(), onLoad: handleImageLoad }) })] }) }));
|
|
38
41
|
}
|
|
39
42
|
// Image URL input component with preview
|
|
40
43
|
function ImageUrlInput({ label, value, onChange, placeholder, fileSize = "200KB", }) {
|
|
@@ -45,30 +48,32 @@ function ImageUrlInput({ label, value, onChange, placeholder, fileSize = "200KB"
|
|
|
45
48
|
setImageError(false);
|
|
46
49
|
}, [value]);
|
|
47
50
|
const handleImageClick = () => {
|
|
48
|
-
if (value &&
|
|
51
|
+
if (value &&
|
|
52
|
+
!imageError &&
|
|
53
|
+
(value.startsWith("http://") || value.startsWith("https://"))) {
|
|
49
54
|
setIsModalOpen(true);
|
|
50
55
|
}
|
|
51
56
|
};
|
|
52
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700", children: label }), _jsxs("div", { className: "border border-gray-300 rounded-lg p-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center space-x-3", children: [_jsx("div", { className: `flex-shrink-0 w-12 h-12 bg-gray-100 rounded border flex items-center justify-center overflow-hidden ${value &&
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700", children: label }), _jsxs("div", { className: "border border-gray-300 rounded-lg p-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center space-x-3", children: [_jsx("div", { className: `flex-shrink-0 w-12 h-12 bg-gray-100 rounded border flex items-center justify-center overflow-hidden ${value &&
|
|
58
|
+
!imageError &&
|
|
59
|
+
(value.startsWith("http://") || value.startsWith("https://"))
|
|
60
|
+
? "cursor-pointer hover:opacity-80 transition-opacity duration-200"
|
|
61
|
+
: ""}`, onClick: handleImageClick, children: value &&
|
|
62
|
+
!imageError &&
|
|
63
|
+
(value.startsWith("http://") ||
|
|
64
|
+
value.startsWith("https://")) ? (_jsx("img", { src: value, alt: `${label} preview`, className: "w-full h-full object-cover", onError: () => setImageError(true), onLoad: () => setImageError(false) })) : (_jsx(Icon, { name: "Image", size: 24, className: "text-gray-400" })) }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "text-sm font-medium text-gray-900", children: value || placeholder || `${label.replace(":", "")}.jpg` }), _jsxs("div", { className: "text-xs text-gray-500", children: ["File Type: jpg | File Size: ", value ? fileSize : "0KB", imageError && value && (_jsx("div", { className: "text-red-500 mt-1", children: "\u26A0 Failed to load image" })), value &&
|
|
65
|
+
!imageError &&
|
|
66
|
+
(value.startsWith("http://") ||
|
|
67
|
+
value.startsWith("https://")) && (_jsx("div", { className: "text-blue-600 mt-1", children: "\uD83D\uDCA1 Click image to view full size" }))] })] })] }), _jsx("div", { className: "flex-shrink-0", children: _jsx("div", { className: "w-6 h-6 rounded-full bg-gray-200 flex items-center justify-center", children: _jsx(Icon, { name: "Image", size: 16, className: "text-gray-600" }) }) })] }), _jsx("div", { className: "mt-3", children: _jsx(TextInput, { className: "w-full", defaultValue: value || "", onBlur: (e) => {
|
|
55
68
|
if (e.target.value !== value) {
|
|
56
69
|
onChange(e.target.value);
|
|
57
70
|
}
|
|
58
71
|
}, placeholder: placeholder || "Enter image URL" }) })] })] }), _jsx(ImageModal, { isOpen: isModalOpen, onClose: () => setIsModalOpen(false), imageUrl: value, imageAlt: `${label} full size` })] }));
|
|
59
72
|
}
|
|
60
73
|
export default function Editor(props) {
|
|
61
|
-
// Getting dispatch from
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
if (props.dispatch) {
|
|
65
|
-
dispatch = props.dispatch;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
const selectedDocument = useSelectedDocument();
|
|
69
|
-
dispatch = selectedDocument[1];
|
|
70
|
-
}
|
|
71
|
-
const state = document.state.global;
|
|
74
|
+
// Getting dispatch from selected document
|
|
75
|
+
const [doc, dispatch] = useDocumentById(props.documentId);
|
|
76
|
+
const state = doc?.state.global;
|
|
72
77
|
// Handle field changes
|
|
73
78
|
const handleFieldChange = useCallback((field, value) => {
|
|
74
79
|
if (!dispatch) {
|
|
@@ -99,7 +104,9 @@ export default function Editor(props) {
|
|
|
99
104
|
action = actions.setDescription({ description: value });
|
|
100
105
|
break;
|
|
101
106
|
case "category":
|
|
102
|
-
action = actions.setCategory({
|
|
107
|
+
action = actions.setCategory({
|
|
108
|
+
category: value,
|
|
109
|
+
});
|
|
103
110
|
break;
|
|
104
111
|
case "x":
|
|
105
112
|
action = actions.setX({ x: value });
|
|
@@ -119,32 +126,32 @@ export default function Editor(props) {
|
|
|
119
126
|
}
|
|
120
127
|
dispatch(action);
|
|
121
128
|
}, [dispatch]);
|
|
122
|
-
return (_jsx("div", { className: "w-full bg-gray-50 min-h-screen", children: _jsxs("div", { className: "p-6 max-w-4xl mx-auto", 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: "Network Profile" }) }), _jsx("div", { className: "bg-white rounded-lg p-6 shadow-sm", children: _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Network Name:" }), _jsx(TextInput, { className: "w-full", defaultValue: state
|
|
123
|
-
if (e.target.value !== state
|
|
129
|
+
return (_jsx("div", { className: "w-full bg-gray-50 min-h-screen", children: _jsxs("div", { className: "p-6 max-w-4xl mx-auto", 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: "Network Profile" }) }), _jsx("div", { className: "bg-white rounded-lg p-6 shadow-sm", children: _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Network Name:" }), _jsx(TextInput, { className: "w-full", defaultValue: state?.name || "", onBlur: (e) => {
|
|
130
|
+
if (e.target.value !== state?.name) {
|
|
124
131
|
handleFieldChange("name", e.target.value);
|
|
125
132
|
}
|
|
126
|
-
}, placeholder: "Enter network name" })] }), _jsx(ImageUrlInput, { label: "Icon:", value: state
|
|
133
|
+
}, placeholder: "Enter network name" })] }), _jsx(ImageUrlInput, { label: "Icon:", value: state?.icon || "", onChange: (value) => handleFieldChange("icon", value), placeholder: "PowerhouseIcon.jpg", fileSize: "200KB" }), _jsx(ImageUrlInput, { label: "Logo:", value: state?.logo || "", onChange: (value) => handleFieldChange("logo", value), placeholder: "PowerhouseLogo.jpg", fileSize: "2MB" }), _jsx(ImageUrlInput, { label: "Large Logo:", value: state?.logoBig || "", onChange: (value) => handleFieldChange("logoBig", value), placeholder: "LargeLogo.jpg", fileSize: "10MB" }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Website:" }), _jsx(TextInput, { className: "w-full", defaultValue: state?.website || "", onBlur: (e) => {
|
|
127
134
|
const value = e.target.value || null;
|
|
128
|
-
if (value !== state
|
|
135
|
+
if (value !== state?.website) {
|
|
129
136
|
handleFieldChange("website", value);
|
|
130
137
|
}
|
|
131
|
-
}, placeholder: "Enter website URL" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Description:" }), _jsx(Textarea, { className: "w-full", defaultValue: state
|
|
132
|
-
if (e.target.value !== state
|
|
138
|
+
}, placeholder: "Enter website URL" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Description:" }), _jsx(Textarea, { className: "w-full", defaultValue: state?.description || "", onBlur: (e) => {
|
|
139
|
+
if (e.target.value !== state?.description) {
|
|
133
140
|
handleFieldChange("description", e.target.value);
|
|
134
141
|
}
|
|
135
|
-
}, placeholder: "Enter network description", rows: 4 })] }), _jsx("div", { children: _jsx(Select, { label: "Category:", options: categoryOptions, value: state
|
|
142
|
+
}, placeholder: "Enter network description", rows: 4 })] }), _jsx("div", { children: _jsx(Select, { label: "Category:", options: categoryOptions, value: state?.category?.[0] || "OSS", onChange: (value) => handleFieldChange("category", [value]) }) }), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-lg font-medium text-gray-900", children: "Social Media Links" }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "X Link:" }), _jsx(TextInput, { className: "w-full", defaultValue: state?.x || "", onBlur: (e) => {
|
|
136
143
|
const value = e.target.value || null;
|
|
137
|
-
if (value !== state
|
|
144
|
+
if (value !== state?.x) {
|
|
138
145
|
handleFieldChange("x", value);
|
|
139
146
|
}
|
|
140
|
-
}, placeholder: "https://x.com/YourHandle" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Discord Link:" }), _jsx(TextInput, { className: "w-full", defaultValue: state
|
|
147
|
+
}, placeholder: "https://x.com/YourHandle" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Discord Link:" }), _jsx(TextInput, { className: "w-full", defaultValue: state?.discord || "", onBlur: (e) => {
|
|
141
148
|
const value = e.target.value || null;
|
|
142
|
-
if (value !== state
|
|
149
|
+
if (value !== state?.discord) {
|
|
143
150
|
handleFieldChange("discord", value);
|
|
144
151
|
}
|
|
145
|
-
}, placeholder: "https://discord.com/invite/YourServer" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "YouTube Link:" }), _jsx(TextInput, { className: "w-full", defaultValue: state
|
|
152
|
+
}, placeholder: "https://discord.com/invite/YourServer" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "YouTube Link:" }), _jsx(TextInput, { className: "w-full", defaultValue: state?.youtube || "", onBlur: (e) => {
|
|
146
153
|
const value = e.target.value || null;
|
|
147
|
-
if (value !== state
|
|
154
|
+
if (value !== state?.youtube) {
|
|
148
155
|
handleFieldChange("youtube", value);
|
|
149
156
|
}
|
|
150
157
|
}, placeholder: "https://www.youtube.com/YourChannel" })] })] })] }) }), _jsx(ToastContainer, {})] }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/editor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAc1D,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAEjC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,2CAsWxC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Icon, ToastContainer } from "@powerhousedao/design-system";
|
|
2
|
+
import { useDocumentById } from "@powerhousedao/reactor-browser";
|
|
3
|
+
import { Icon, ToastContainer, } from "@powerhousedao/design-system";
|
|
4
4
|
import { actions, } from "../../document-models/payment-terms/index.js";
|
|
5
5
|
import { BasicTermsTab } from "./basic-terms-tab.js";
|
|
6
6
|
import { MilestonesTab } from "./milestones-tab.js";
|
|
@@ -11,35 +11,46 @@ import { EscrowTab } from "./escrow-tab.js";
|
|
|
11
11
|
import { EvaluationTab } from "./evaluation-tab.js";
|
|
12
12
|
export default function Editor(props) {
|
|
13
13
|
// Getting dispatch from props or selected document
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
if (props.dispatch) {
|
|
17
|
-
dispatch = props.dispatch;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const selectedDocument = useSelectedDocument();
|
|
21
|
-
dispatch = selectedDocument[1];
|
|
22
|
-
}
|
|
23
|
-
const state = document.state.global;
|
|
14
|
+
const [doc, dispatch] = useDocumentById(props.documentId);
|
|
15
|
+
const state = doc?.state.global;
|
|
24
16
|
const getStatusColor = (status) => {
|
|
25
17
|
switch (status) {
|
|
26
|
-
case "DRAFT":
|
|
27
|
-
|
|
28
|
-
case "
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
case "DRAFT":
|
|
19
|
+
return "bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200";
|
|
20
|
+
case "SUBMITTED":
|
|
21
|
+
return "bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";
|
|
22
|
+
case "ACCEPTED":
|
|
23
|
+
return "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";
|
|
24
|
+
case "CANCELLED":
|
|
25
|
+
return "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";
|
|
26
|
+
default:
|
|
27
|
+
return "bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200";
|
|
31
28
|
}
|
|
32
29
|
};
|
|
33
30
|
const getStatusIcon = (status) => {
|
|
34
31
|
switch (status) {
|
|
35
|
-
case "DRAFT":
|
|
36
|
-
|
|
37
|
-
case "
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
case "DRAFT":
|
|
33
|
+
return "CalendarTime";
|
|
34
|
+
case "SUBMITTED":
|
|
35
|
+
return "ArrowUp";
|
|
36
|
+
case "ACCEPTED":
|
|
37
|
+
return "CheckCircle";
|
|
38
|
+
case "CANCELLED":
|
|
39
|
+
return "ArrowLeft";
|
|
40
|
+
default:
|
|
41
|
+
return "CalendarTime";
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
const totalMilestones = state.milestoneSchedule?.length || 0;
|
|
43
|
-
const completedMilestones = state.milestoneSchedule?.filter((m) => m.payoutStatus === "PAID")
|
|
44
|
-
|
|
45
|
+
const completedMilestones = state.milestoneSchedule?.filter((m) => m.payoutStatus === "PAID")
|
|
46
|
+
.length || 0;
|
|
47
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "min-h-screen bg-gray-50 dark:bg-gray-900", children: _jsxs("div", { className: "max-w-7xl mx-auto p-6", children: [_jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm p-6 mb-6", children: [_jsxs("div", { className: "flex justify-between items-start", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "CalendarTime", size: 32, className: "text-blue-600 dark:text-blue-400" }), _jsxs("div", { children: [_jsx("h1", { className: "text-3xl font-bold text-gray-900 dark:text-white mb-2", children: "Payment Terms Document" }), _jsx("p", { className: "text-gray-600 dark:text-gray-300", children: "Manage payment terms, milestones, and contract clauses" })] })] }), _jsxs("div", { className: `flex items-center gap-2 px-3 py-2 rounded-full font-medium ${getStatusColor(state.status)}`, children: [_jsx(Icon, { name: getStatusIcon(state.status), size: 16 }), state.status] })] }), _jsxs("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mt-6", children: [_jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border border-gray-200 dark:border-gray-600", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Icon, { name: "BarChart", size: 16, className: "text-blue-600 dark:text-blue-400" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 font-medium", children: "Payment Model" })] }), _jsx("p", { className: "text-lg font-semibold dark:text-white", children: state.paymentModel.replace(/_/g, " ") })] }), _jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border border-gray-200 dark:border-gray-600", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Icon, { name: "BarChart", size: 16, className: "text-green-600 dark:text-green-400" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 font-medium", children: "Currency" })] }), _jsx("p", { className: "text-lg font-semibold dark:text-white", children: state.currency })] }), _jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border border-gray-200 dark:border-gray-600", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Icon, { name: "BarChart", size: 16, className: "text-yellow-600 dark:text-yellow-400" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 font-medium", children: "Total Amount" })] }), _jsx("p", { className: "text-lg font-semibold dark:text-white", children: state.totalAmount
|
|
48
|
+
? `${state.totalAmount.value} ${state.totalAmount.unit}`
|
|
49
|
+
: "Not set" })] }), _jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border border-gray-200 dark:border-gray-600", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Icon, { name: "BarChart", size: 16, className: "text-purple-600 dark:text-purple-400" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 font-medium", children: "Progress" })] }), _jsx("p", { className: "text-lg font-semibold dark:text-white", children: state.paymentModel === "MILESTONE"
|
|
50
|
+
? `${completedMilestones} / ${totalMilestones}`
|
|
51
|
+
: "N/A" })] })] })] }), _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "CalendarTime", size: 20, className: "text-blue-600 dark:text-blue-400" }), _jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Basic Terms" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: "Configure the basic payment terms and details" })] })] }) }), _jsx("div", { className: "p-6", children: _jsx(BasicTermsTab, { state: state, dispatch: dispatch, actions: actions }) })] }), state.paymentModel === "MILESTONE" && (_jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "BarChart", size: 20, className: "text-green-600 dark:text-green-400" }), _jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Milestone Schedule" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: "Define project milestones and payment amounts" })] })] }) }), _jsx("div", { className: "p-6", children: _jsx(MilestonesTab, { milestones: state.milestoneSchedule, dispatch: dispatch, actions: actions, currency: state.currency }) })] })), state.paymentModel === "COST_AND_MATERIALS" && (_jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "BarChart", size: 20, className: "text-yellow-600 dark:text-yellow-400" }), _jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Cost & Materials" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: "Configure hourly rates, billing frequency, and caps" })] })] }) }), _jsx("div", { className: "p-6", children: _jsx(CostMaterialsTab, { state: state, dispatch: dispatch, actions: actions }) })] })), state.paymentModel === "RETAINER" && (_jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "BarChart", size: 20, className: "text-purple-600 dark:text-purple-400" }), _jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Retainer Details" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: "Configure retainer amount, frequency, and services" })] })] }) }), _jsx("div", { className: "p-6", children: _jsx(RetainerTab, { state: state, dispatch: dispatch, actions: actions }) })] })), state.escrowDetails &&
|
|
52
|
+
state.escrowDetails.releaseConditions &&
|
|
53
|
+
(state.paymentModel === "MILESTONE" ||
|
|
54
|
+
state.paymentModel === "COST_AND_MATERIALS" ||
|
|
55
|
+
state.paymentModel === "RETAINER") && (_jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "BarChart", size: 20, className: "text-orange-600 dark:text-orange-400" }), _jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Escrow Details" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: "Configure escrow payment arrangements" })] })] }) }), _jsx("div", { className: "p-6", children: _jsx(EscrowTab, { state: state, dispatch: dispatch, actions: actions }) })] })), _jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "BarChart", size: 20, className: "text-red-600 dark:text-red-400" }), _jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Bonus & Penalty Clauses" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: "Add performance-based bonus and penalty conditions" })] })] }) }), _jsx("div", { className: "p-6", children: _jsx(ClausesTab, { bonusClauses: state.bonusClauses, penaltyClauses: state.penaltyClauses, dispatch: dispatch, actions: actions, currency: state.currency }) })] }), _jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "BarChart", size: 20, className: "text-indigo-600 dark:text-indigo-400" }), _jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Evaluation Terms" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: "Define performance evaluation criteria and processes" })] })] }) }), _jsx("div", { className: "p-6", children: _jsx(EvaluationTab, { state: state, dispatch: dispatch, actions: actions }) })] })] })] }) }), _jsx(ToastContainer, {})] }));
|
|
45
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/request-for-proposals/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
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,6 +1,6 @@
|
|
|
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 {
|
|
3
|
+
import { useDocumentById } from "@powerhousedao/reactor-browser";
|
|
4
4
|
import { DatePicker, Select, TextInput, } from "@powerhousedao/document-engineering";
|
|
5
5
|
import { MarkdownEditor } from "./markdown-editor.js";
|
|
6
6
|
const statusOptions = [
|
|
@@ -13,20 +13,8 @@ const statusOptions = [
|
|
|
13
13
|
{ label: "CLOSED", value: "CLOSED" },
|
|
14
14
|
];
|
|
15
15
|
export default function Editor(props) {
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const state = document?.state
|
|
19
|
-
.global;
|
|
20
|
-
if (!document) {
|
|
21
|
-
return _jsx("div", { children: "No document selected" });
|
|
22
|
-
}
|
|
23
|
-
if (props.dispatch) {
|
|
24
|
-
dispatch = props.dispatch;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
const selectedDocument = useSelectedDocument();
|
|
28
|
-
dispatch = selectedDocument[1];
|
|
29
|
-
}
|
|
16
|
+
const [doc, dispatch] = useDocumentById(props.documentId);
|
|
17
|
+
const state = doc?.state.global;
|
|
30
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) => {
|
|
31
19
|
if (e.target.value !== state.code) {
|
|
32
20
|
dispatch(actions.editRfp({ code: e.target.value }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/workstream/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/workstream/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiC1D,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAejC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,2CAq0BxC"}
|
|
@@ -3,7 +3,7 @@ import { Button, toast, ToastContainer } from "@powerhousedao/design-system";
|
|
|
3
3
|
import { TextInput, Select, PHIDInput, Icon, ObjectSetTable, } from "@powerhousedao/document-engineering";
|
|
4
4
|
import { actions, } from "../../document-models/workstream/index.js";
|
|
5
5
|
import { generateId } from "document-model";
|
|
6
|
-
import { useNodes, useDocumentById,
|
|
6
|
+
import { useNodes, useDocumentById, } from "@powerhousedao/reactor-browser";
|
|
7
7
|
import { useEffect, useMemo, useState } from "react";
|
|
8
8
|
// Status options for the dropdown
|
|
9
9
|
const statusOptions = [
|
|
@@ -18,18 +18,9 @@ const statusOptions = [
|
|
|
18
18
|
{ value: "FINISHED", label: "Finished" },
|
|
19
19
|
];
|
|
20
20
|
export default function Editor(props) {
|
|
21
|
-
|
|
22
|
-
let dispatch;
|
|
23
|
-
const { document } = props;
|
|
24
|
-
if (props.dispatch) {
|
|
25
|
-
dispatch = props.dispatch;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
const selectedDocument = useSelectedDocument();
|
|
29
|
-
dispatch = selectedDocument[1];
|
|
30
|
-
}
|
|
21
|
+
const [doc, dispatch] = useDocumentById(props.documentId);
|
|
31
22
|
// Try to get dispatch from context or props
|
|
32
|
-
const state =
|
|
23
|
+
const state = doc.state.global;
|
|
33
24
|
const createRfpDocument = props.createRfp;
|
|
34
25
|
const setActiveDocumentId = props.setActiveDocumentId;
|
|
35
26
|
const createSowDocument = props.createSow;
|
|
@@ -66,7 +57,7 @@ export default function Editor(props) {
|
|
|
66
57
|
}, [state.rfp?.id, newlyCreatedRfpId]);
|
|
67
58
|
// Checking if there is an RFP document for this workstream
|
|
68
59
|
const nodes = useNodes() || [];
|
|
69
|
-
const workstreamDocument = nodes.find((node) => node.id ===
|
|
60
|
+
const workstreamDocument = nodes.find((node) => node.id === doc.header.id);
|
|
70
61
|
const fileNodes = nodes.filter((node) => node.kind === "file");
|
|
71
62
|
const rfpDocumentNode = fileNodes.find((node) => {
|
|
72
63
|
if (!workstreamDocument && !node.parentFolder)
|
|
@@ -100,7 +91,8 @@ export default function Editor(props) {
|
|
|
100
91
|
rfpDocumentDataState?.state?.global) {
|
|
101
92
|
setRfpDocument({
|
|
102
93
|
...rfpDocumentNode,
|
|
103
|
-
document: (rfpDocumentDataState?.state)
|
|
94
|
+
document: (rfpDocumentDataState?.state)
|
|
95
|
+
.global,
|
|
104
96
|
});
|
|
105
97
|
}
|
|
106
98
|
else if (!rfpDocumentNode ||
|
|
@@ -356,7 +348,9 @@ export default function Editor(props) {
|
|
|
356
348
|
title: createdNode.name,
|
|
357
349
|
}));
|
|
358
350
|
}
|
|
359
|
-
}, children: "Create RFP Document" }) })] })), rfpDocument ? (_jsx("div", { children: state.initialProposal ? (_jsxs("div", { className: "bg-white rounded-lg p-6 mb-6 shadow-sm", children: [_jsx("h1", { className: "text-2xl text-gray-900 mb-4", children: "Initial Proposal" }), _jsxs("div", { className: "flex flex-row gap-4 mb-6", children: [_jsx("div", { className: "flex-1", children: _jsx(TextInput, { label: "Author", value: manualAuthorInput ||
|
|
351
|
+
}, children: "Create RFP Document" }) })] })), rfpDocument ? (_jsx("div", { children: state.initialProposal ? (_jsxs("div", { className: "bg-white rounded-lg p-6 mb-6 shadow-sm", children: [_jsx("h1", { className: "text-2xl text-gray-900 mb-4", children: "Initial Proposal" }), _jsxs("div", { className: "flex flex-row gap-4 mb-6", children: [_jsx("div", { className: "flex-1", children: _jsx(TextInput, { label: "Author", value: manualAuthorInput ||
|
|
352
|
+
state.initialProposal?.author?.name ||
|
|
353
|
+
"", onChange: (e) => {
|
|
360
354
|
setManualAuthorInput(e.target.value);
|
|
361
355
|
}, onBlur: (e) => {
|
|
362
356
|
if (e.target.value !== state.initialProposal?.author?.name) {
|
|
@@ -368,7 +362,10 @@ export default function Editor(props) {
|
|
|
368
362
|
},
|
|
369
363
|
}));
|
|
370
364
|
}
|
|
371
|
-
} }) }), _jsxs("div", { className: "flex-1", children: [_jsx(TextInput, { label: "Sow", value: newlyCreatedSowId ||
|
|
365
|
+
} }) }), _jsxs("div", { className: "flex-1", children: [_jsx(TextInput, { label: "Sow", value: newlyCreatedSowId ||
|
|
366
|
+
manualSowInput ||
|
|
367
|
+
state.initialProposal?.sow ||
|
|
368
|
+
"", onChange: (e) => {
|
|
372
369
|
setManualSowInput(e.target.value);
|
|
373
370
|
setNewlyCreatedSowId(null); // Clear newly created ID when user starts typing
|
|
374
371
|
}, onBlur: (e) => {
|
|
@@ -389,12 +386,14 @@ export default function Editor(props) {
|
|
|
389
386
|
sowId: createdNode.id,
|
|
390
387
|
}));
|
|
391
388
|
}
|
|
392
|
-
}, children: "Create sow" })] }), _jsxs("div", { className: "flex-1", children: [_jsx(TextInput, { label: "Payment Terms", value: newlyCreatedPaymentTermsId ||
|
|
389
|
+
}, children: "Create sow" })] }), _jsxs("div", { className: "flex-1", children: [_jsx(TextInput, { label: "Payment Terms", value: newlyCreatedPaymentTermsId ||
|
|
390
|
+
manualPaymentTermsInput ||
|
|
391
|
+
state.initialProposal?.paymentTerms ||
|
|
392
|
+
"", onChange: (e) => {
|
|
393
393
|
setManualPaymentTermsInput(e.target.value);
|
|
394
394
|
setNewlyCreatedPaymentTermsId(null); // Clear newly created ID when user starts typing
|
|
395
395
|
}, onBlur: (e) => {
|
|
396
|
-
if (e.target.value !==
|
|
397
|
-
state.initialProposal?.paymentTerms) {
|
|
396
|
+
if (e.target.value !== state.initialProposal?.paymentTerms) {
|
|
398
397
|
dispatch(actions.editInitialProposal({
|
|
399
398
|
id: state.initialProposal?.id || "",
|
|
400
399
|
paymentTermsId: e.target.value,
|