@powerhousedao/codegen 4.1.0-dev.88 → 4.1.0-dev.89
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.
|
@@ -2,18 +2,27 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/editor.tsx"
|
|
3
3
|
unless_exists: true
|
|
4
4
|
---
|
|
5
|
+
import { DocumentToolbar } from "@powerhousedao/design-system";
|
|
5
6
|
import {
|
|
6
7
|
Button,
|
|
7
8
|
Form,
|
|
8
9
|
FormLabel,
|
|
9
10
|
StringField,
|
|
10
11
|
} from "@powerhousedao/document-engineering";
|
|
12
|
+
import {
|
|
13
|
+
setSelectedNode,
|
|
14
|
+
useParentFolderForSelectedNode,
|
|
15
|
+
} from "@powerhousedao/reactor-browser";
|
|
11
16
|
<% if(!documentType){ %>import { useSelectedDocument } from "@powerhousedao/reactor-browser";<% } else { %>import { useSelected<%= documentType.name %>Document %>} from "../hooks/use<%= documentType.name %>Document%>.js";<% } %>
|
|
12
17
|
import { setName } from "document-model";<% if(documentType) { %>
|
|
13
18
|
import { actions } from "<%= documentType.importPath %>";<% } %>
|
|
14
19
|
|
|
15
20
|
export function Editor() {
|
|
16
21
|
const [document, dispatch] = <% if(documentType) { %>useSelected<%= documentType.name %>Document()<% } else { %>useSelectedDocument()<% } %>;
|
|
22
|
+
|
|
23
|
+
// Get the parent folder node for the currently selected node
|
|
24
|
+
const parentFolder = useParentFolderForSelectedNode();
|
|
25
|
+
|
|
17
26
|
<% if(!documentType){ %>
|
|
18
27
|
if (!document) {
|
|
19
28
|
return null;
|
|
@@ -25,68 +34,77 @@ export function Editor() {
|
|
|
25
34
|
}
|
|
26
35
|
}
|
|
27
36
|
|
|
37
|
+
// Set the selected node to the parent folder node (close the editor)
|
|
38
|
+
function handleClose() {
|
|
39
|
+
setSelectedNode(parentFolder?.id);
|
|
40
|
+
}
|
|
41
|
+
|
|
28
42
|
return (
|
|
29
|
-
<div
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<div>
|
|
43
|
-
<
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
<div>
|
|
44
|
+
<DocumentToolbar document={document} onClose={handleClose} />
|
|
45
|
+
<div className="ph-default-styles py-10 text-center">
|
|
46
|
+
<div className="inline-flex flex-col gap-10 text-start">
|
|
47
|
+
{/* Edit document name form */}
|
|
48
|
+
<section className="flex justify-between">
|
|
49
|
+
<h1 className="text-start">{document.header.name}</h1>
|
|
50
|
+
<div className="flex flex-col space-y-2">
|
|
51
|
+
<Form
|
|
52
|
+
onSubmit={handleSetName}
|
|
53
|
+
defaultValues={{ name: document.header.name }}
|
|
54
|
+
className="flex flex-col gap-3 pt-2"
|
|
55
|
+
>
|
|
56
|
+
<div className="flex items-end gap-3">
|
|
57
|
+
<div>
|
|
58
|
+
<FormLabel htmlFor="name">
|
|
59
|
+
<b className="mb-1">Change document name</b>
|
|
60
|
+
</FormLabel>
|
|
61
|
+
<StringField
|
|
62
|
+
name="name"
|
|
63
|
+
placeholder="Enter document name"
|
|
64
|
+
className="mt-1"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
<Button type="submit">Edit</Button>
|
|
51
68
|
</div>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</div>
|
|
56
|
-
</section>
|
|
69
|
+
</Form>
|
|
70
|
+
</div>
|
|
71
|
+
</section>
|
|
57
72
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
{/* Document metadata */}
|
|
74
|
+
<section>
|
|
75
|
+
<ul className="grid grid-cols-2 gap-x-4 gap-y-1 text-gray-700">
|
|
76
|
+
<li>
|
|
77
|
+
<b className="mr-1">Id:</b>
|
|
78
|
+
{document.header.id}
|
|
79
|
+
</li>
|
|
80
|
+
<li>
|
|
81
|
+
<b className="mr-1">Created:</b>
|
|
82
|
+
{new Date(document.header.createdAtUtcIso).toLocaleString()}
|
|
83
|
+
</li>
|
|
84
|
+
<li>
|
|
85
|
+
<b className="mr-1">Type:</b>
|
|
86
|
+
{document.header.documentType}
|
|
87
|
+
</li>
|
|
88
|
+
<li>
|
|
89
|
+
<b className="mr-1">Last Modified:</b>
|
|
90
|
+
{new Date(
|
|
91
|
+
document.header.lastModifiedAtUtcIso,
|
|
92
|
+
).toLocaleString()}
|
|
93
|
+
</li>
|
|
94
|
+
</ul>
|
|
95
|
+
</section>
|
|
79
96
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
{/* Document state */}
|
|
98
|
+
<section className="inline-block">
|
|
99
|
+
<h2 className="mb-4">Document state</h2>
|
|
100
|
+
<textarea
|
|
101
|
+
rows={10}
|
|
102
|
+
readOnly
|
|
103
|
+
value={JSON.stringify(document.state, null, 2)}
|
|
104
|
+
className="font-mono"
|
|
105
|
+
></textarea>
|
|
106
|
+
</section>
|
|
107
|
+
</div>
|
|
90
108
|
</div>
|
|
91
109
|
</div>
|
|
92
110
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/codegen",
|
|
3
|
-
"version": "4.1.0-dev.
|
|
3
|
+
"version": "4.1.0-dev.89",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"kysely-pglite": "^0.6.1",
|
|
32
32
|
"prettier": "^3.4.2",
|
|
33
33
|
"ts-morph": "^26.0.0",
|
|
34
|
-
"@powerhousedao/
|
|
35
|
-
"@powerhousedao/
|
|
36
|
-
"
|
|
37
|
-
"@powerhousedao/reactor-browser": "4.1.0-dev.
|
|
38
|
-
"
|
|
34
|
+
"@powerhousedao/config": "4.1.0-dev.89",
|
|
35
|
+
"@powerhousedao/design-system": "4.1.0-dev.89",
|
|
36
|
+
"document-model": "4.1.0-dev.89",
|
|
37
|
+
"@powerhousedao/reactor-browser": "4.1.0-dev.89",
|
|
38
|
+
"@powerhousedao/common": "4.1.0-dev.89"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@graphql-codegen/core": "^4.0.2",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-dom": "^19.2.0",
|
|
50
50
|
"vitest": "^3.2.4",
|
|
51
51
|
"zod": "^3.24.3",
|
|
52
|
-
"document-drive": "4.1.0-dev.
|
|
52
|
+
"document-drive": "4.1.0-dev.89"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"tsc": "tsc",
|