@powerhousedao/academy 4.1.0-dev.1 → 4.1.0-dev.100
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/.vscode/settings.json +1 -1
- package/CHANGELOG.md +817 -0
- package/README.md +3 -3
- package/babel.config.js +1 -1
- package/blog/BeyondCommunication-ABlueprintForDevelopment.md +25 -24
- package/blog/TheChallengeOfChange.md +21 -21
- package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +67 -30
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +38 -21
- package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +24 -19
- package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +44 -41
- package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +10 -10
- package/docs/academy/01-GetStarted/05-VetraStudio.md +164 -0
- package/docs/academy/01-GetStarted/06-ReactorMCP.md +58 -0
- package/docs/academy/01-GetStarted/home.mdx +185 -90
- package/docs/academy/01-GetStarted/images/Modules.png +0 -0
- package/docs/academy/01-GetStarted/images/VetraStudioDrive.png +0 -0
- package/docs/academy/01-GetStarted/styles.module.css +5 -5
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +46 -18
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +118 -68
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +75 -33
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +30 -21
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +41 -37
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +29 -25
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +36 -37
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +128 -109
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +95 -86
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +7 -9
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +83 -42
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +77 -62
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +360 -349
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +16 -10
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +10 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/02-RevisionHistoryTimeline.md +25 -17
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/01-RenownAuthenticationFlow.md +14 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/02-Authorization.md +0 -1
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/_category_.json +5 -5
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/01-GraphQLAtPowerhouse.md +45 -33
- package/docs/academy/02-MasteryTrack/04-WorkWithData/02-UsingTheAPI.mdx +61 -18
- package/docs/academy/02-MasteryTrack/04-WorkWithData/03-UsingSubgraphs.md +105 -456
- package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +126 -110
- package/docs/academy/02-MasteryTrack/04-WorkWithData/05-RelationalDbProcessor.md +98 -65
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +23 -21
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +9 -9
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +11 -23
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +25 -9
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +10 -10
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/benchmarks.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +16 -11
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +6 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +2 -2
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +7 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +32 -58
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/processors.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/07-drive-analytics.md +105 -71
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_01-SetupBuilderEnvironment.md +22 -0
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_02-CreateNewPowerhouseProject.md +9 -8
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_03-GenerateAnAnalyticsProcessor.md +28 -32
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_04-UpdateAnalyticsProcessor.md +25 -26
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_category_.json +7 -7
- package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +3 -4
- package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +69 -45
- package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +70 -40
- package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -0
- package/docs/academy/02-MasteryTrack/05-Launch/_category_.json +7 -7
- package/docs/academy/02-MasteryTrack/_category_.json +6 -6
- package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +5 -3
- package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +38 -37
- package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +45 -41
- package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +14 -14
- package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +6 -6
- package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
- package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +181 -68
- package/docs/academy/04-APIReferences/01-ReactHooks.md +649 -141
- package/docs/academy/04-APIReferences/04-RelationalDatabase.md +121 -113
- package/docs/academy/04-APIReferences/05-PHDocumentMigrationGuide.md +48 -41
- package/docs/academy/04-APIReferences/_category_.json +6 -6
- package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +1 -2
- package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +11 -8
- package/docs/academy/05-Architecture/05-DocumentModelTheory/_category_.json +1 -1
- package/docs/academy/05-Architecture/_category_.json +6 -6
- package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +25 -23
- package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +105 -93
- package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +1 -0
- package/docs/academy/06-ComponentLibrary/_category_.json +7 -7
- package/docs/academy/07-Cookbook.md +268 -35
- package/docs/academy/08-Glossary.md +7 -1
- package/docs/academy/TUTORIAL_VERIFICATION_ARCHITECTURE +325 -0
- package/docs/bookofpowerhouse/01-Overview.md +2 -2
- package/docs/bookofpowerhouse/02-GeneralFrameworkAndPhilosophy.md +1 -7
- package/docs/bookofpowerhouse/03-PowerhouseSoftwareArchitecture.md +10 -7
- package/docs/bookofpowerhouse/04-DevelopmentApproaches.md +10 -4
- package/docs/bookofpowerhouse/05-SNOsandANewModelForOSSandPublicGoods.md +23 -30
- package/docs/bookofpowerhouse/06-SNOsInActionAndPlatformEconomies.md +0 -7
- package/docusaurus.config.ts +64 -66
- package/package.json +9 -7
- package/scripts/generate-combined-cli-docs.ts +43 -13
- package/sidebars.ts +2 -0
- package/src/components/HomepageFeatures/index.tsx +171 -78
- package/src/components/HomepageFeatures/styles.module.css +1 -2
- package/src/css/custom.css +89 -89
- package/src/pages/_archive-homepage.tsx +17 -16
- package/src/theme/DocCardList/index.tsx +9 -8
- package/static.json +6 -6
- package/tsconfig.tsbuildinfo +1 -0
package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md
CHANGED
|
@@ -6,15 +6,17 @@ At Powerhouse, frontend development for document editors follows a simple and fa
|
|
|
6
6
|
|
|
7
7
|
### Development environment
|
|
8
8
|
|
|
9
|
-
Connect Studio is your primary tool for development.
|
|
9
|
+
Connect Studio is your primary tool for development.
|
|
10
10
|
When you run `ph connect`, it provides a dynamic, local environment where you can define and preview your document models and their editors live. This replaces the need for tools like Storybook for editor development, though Storybook remains invaluable for exploring the [Powerhouse Component Library](#powerhouse-component-library).
|
|
11
11
|
|
|
12
12
|
Key aspects of the Powerhouse development environment:
|
|
13
|
+
|
|
13
14
|
- **React Foundation**: Build your editor UIs using React components, just as you would in any standard React project.
|
|
14
15
|
- **Automatic Build Processes**: Tailwind CSS is installed by default and fully managed by Connect Studio. There's no need to manually configure or run Tailwind or other build processes during development. Connect Studio handles CSS generation and other necessary build steps automatically, especially when you publish a package.
|
|
15
16
|
- **Styling Flexibility**: You are not limited to Tailwind. Regular CSS (`.css` files), inline styles, and any React-compatible styling method work exactly as you would expect.
|
|
16
17
|
|
|
17
18
|
Powerhouse aims to keep your developer experience clean, familiar, and focused:
|
|
19
|
+
|
|
18
20
|
- Build React components as you normally would.
|
|
19
21
|
- Use styling approaches you're comfortable with.
|
|
20
22
|
- Trust Connect Studio to handle the setup and build processes for you.
|
|
@@ -25,9 +27,11 @@ To kickstart your editor development, Powerhouse provides a command to generate
|
|
|
25
27
|
If you want a refresher on how to define your document model specification please read the chapter on [specifying the State Schema](/academy/MasteryTrack/DocumentModelCreation/SpecifyTheStateSchema)
|
|
26
28
|
|
|
27
29
|
For example, to generate an editor for a To-do List document model with a document type `powerhouse/todolist`:
|
|
30
|
+
|
|
28
31
|
```bash
|
|
29
32
|
ph generate --editor ToDoList --document-types powerhouse/todolist
|
|
30
33
|
```
|
|
34
|
+
|
|
31
35
|
This will create the template in the `editors/to-do-list/editor.tsx` folder.
|
|
32
36
|
|
|
33
37
|
### Styling your editor
|
|
@@ -37,7 +41,8 @@ You have several options for styling your editor components:
|
|
|
37
41
|
1. **Default HTML Styling**: Standard HTML tags (`<h1>`, `<p>`, `<button>`, etc.) will render with default browser styles or any base styling provided by the Connect environment. This is suitable for basic structure and quick prototyping.
|
|
38
42
|
|
|
39
43
|
2. **Tailwind CSS**: Connect Studio comes with Tailwind CSS integrated. You can directly use Tailwind utility classes in your JSX for rapid and consistent styling without writing separate CSS files.
|
|
40
|
-
|
|
44
|
+
_Example (from the ToDoList Editor):_
|
|
45
|
+
|
|
41
46
|
```typescript
|
|
42
47
|
<div className="container mx-auto p-4 max-w-md">
|
|
43
48
|
<h1 className="text-2xl font-bold mb-4">ToDoList</h1>
|
|
@@ -46,19 +51,22 @@ You have several options for styling your editor components:
|
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
3. **Custom CSS Files**: You can import traditional CSS files (`.css`) to apply custom styles or integrate existing style libraries.
|
|
49
|
-
|
|
54
|
+
_Create an `editor.css` file in your editor's directory:_
|
|
55
|
+
|
|
50
56
|
```css
|
|
51
57
|
/* editors/your-editor/editor.css */
|
|
52
58
|
.editor-container {
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
padding: 1rem;
|
|
60
|
+
border: 1px solid #ccc;
|
|
55
61
|
}
|
|
56
62
|
.editor-title {
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
color: navy;
|
|
64
|
+
font-size: 1.8rem;
|
|
59
65
|
}
|
|
60
66
|
```
|
|
61
|
-
|
|
67
|
+
|
|
68
|
+
_Import and use it in your `editor.tsx`:_
|
|
69
|
+
|
|
62
70
|
```typescript
|
|
63
71
|
import './editor.css'; // Import the CSS file
|
|
64
72
|
|
|
@@ -74,24 +82,47 @@ You have several options for styling your editor components:
|
|
|
74
82
|
|
|
75
83
|
Choose the method or combination of methods that best suits your project needs and team preferences. Connect Studio (`ph connect`) will allow you to see your styles applied in real-time.
|
|
76
84
|
|
|
85
|
+
:::warning **Best practices for consistent reliable styles**
|
|
86
|
+
|
|
87
|
+
In any package the styles are being generated through the styles.css file with the help of the tailwindcss/cli package.
|
|
88
|
+
|
|
89
|
+
**1. Centralize style imports**
|
|
90
|
+
|
|
91
|
+
- Do not import styles directly in .tsx files.
|
|
92
|
+
- This works in development mode but will not be picked up in static production builds.
|
|
93
|
+
- Move all style imports into your main styles.css file.
|
|
94
|
+
|
|
95
|
+
**2. Use file imports instead of URL imports**
|
|
96
|
+
|
|
97
|
+
- @import url("...") → **Incorrect**, Ignored by tailwindcss/cli
|
|
98
|
+
- @import "..." → **Correct**, resolves from local files or node_modules
|
|
99
|
+
- Always prefer the file import syntax.
|
|
100
|
+
|
|
101
|
+
**Using `ph install` includes package styles automatically**
|
|
102
|
+
|
|
103
|
+
- When installing a package with `ph install` on any instance, package styles are automatically added to styles.css. This ensures production builds always include the required package styles.
|
|
104
|
+
:::
|
|
105
|
+
|
|
77
106
|
### State management in editors
|
|
78
107
|
|
|
79
108
|
When you build an editor in Powerhouse, your main editor component receives `EditorProps`. These props are crucial for interacting with the document:
|
|
80
109
|
|
|
81
|
-
|
|
82
|
-
|
|
110
|
+
- **`document`**: This object contains the entire document structure, including its current state. You'll typically access the global document state via `document.state.global`.
|
|
111
|
+
- **`dispatch`**: This function is your gateway to modifying the document's state. You call `dispatch` with an action object (usually created by action creators from your document model's generated code) to signal an intended change.
|
|
83
112
|
|
|
84
113
|
**Local vs. Global State:**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
114
|
+
|
|
115
|
+
- **Local Component State**: For UI-specific state that doesn't need to be part of the persisted document model (e.g., the current text in an input field before submission, visibility of a dropdown), use React's `useState` hook.
|
|
116
|
+
```typescript
|
|
117
|
+
const [inputValue, setInputValue] = useState('');
|
|
118
|
+
// ...
|
|
119
|
+
<input value={inputValue} onChange={(e) => setInputValue(e.target.value)} />
|
|
120
|
+
```
|
|
121
|
+
- **Global Document State**: For data that is part of the document itself and should be saved (e.g., the items in a to-do list), you modify it by dispatching actions. The `document.state.global` object provides read-only access to this state within your editor.
|
|
92
122
|
|
|
93
123
|
**Dispatching Actions:**
|
|
94
124
|
Your document model's generated code (e.g., in `document-models/your-model/index.js` or `document-models/your-model/gen/operations.js`) will provide action creators.
|
|
125
|
+
|
|
95
126
|
```typescript
|
|
96
127
|
// Assuming 'actions' are imported from your document model
|
|
97
128
|
// import { actions } from '../../document-models/to-do-list/index.js';
|
|
@@ -110,6 +141,7 @@ Your document model's generated code (e.g., in `document-models/your-model/index
|
|
|
110
141
|
// };
|
|
111
142
|
// }
|
|
112
143
|
```
|
|
144
|
+
|
|
113
145
|
The actual state modification logic resides in your document model's reducers, ensuring that all changes are consistent and follow the defined operations.
|
|
114
146
|
|
|
115
147
|
## Powerhouse component library
|
|
@@ -117,19 +149,26 @@ The actual state modification logic resides in your document model's reducers, e
|
|
|
117
149
|
Powerhouse provides a rich set of reusable UI components through the **`@powerhousedao/document-engineering/scalars`** package. These components are designed for consistency, efficiency, and seamless integration with the Powerhouse ecosystem, with many based on GraphQL scalar types. For more information read our chapter on the [Component Library](/academy/ComponentLibrary/DocumentEngineering)
|
|
118
150
|
|
|
119
151
|
### Exploring components
|
|
152
|
+
|
|
120
153
|
You can explore available components, see usage examples, and understand their properties (props) using our Storybook instance:
|
|
121
154
|
[https://storybook.powerhouse.academy](https://storybook.powerhouse.academy)
|
|
122
155
|
|
|
123
156
|
Storybook allows you to:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
157
|
+
|
|
158
|
+
- Visually inspect each component.
|
|
159
|
+
- Interact with different states and variations.
|
|
160
|
+
- View code snippets for basic implementation.
|
|
161
|
+
- Consult the props table for detailed configuration options.
|
|
128
162
|
|
|
129
163
|
### Using components
|
|
164
|
+
|
|
130
165
|
1. **Import**: Add an import statement at the top of your editor file:
|
|
131
166
|
```typescript
|
|
132
|
-
import {
|
|
167
|
+
import {
|
|
168
|
+
Checkbox,
|
|
169
|
+
StringField,
|
|
170
|
+
Form,
|
|
171
|
+
} from "@powerhousedao/document-engineering/scalars";
|
|
133
172
|
```
|
|
134
173
|
2. **Implement**: Use the component in your JSX, configuring it with props:
|
|
135
174
|
```typescript
|
|
@@ -149,11 +188,11 @@ Storybook allows you to:
|
|
|
149
188
|
|
|
150
189
|
## Build a To-do List editor
|
|
151
190
|
|
|
152
|
-
In this final part of our tutorial we will continue with the interface or editor implementation of the **To-do List** document model. This means you will create a simple user interface for the **To-do List** document model which will be used inside the Connect app to create, update and delete your To-do List items, but also dispaly the statistics we've implemented in our reducers.
|
|
191
|
+
In this final part of our tutorial we will continue with the interface or editor implementation of the **To-do List** document model. This means you will create a simple user interface for the **To-do List** document model which will be used inside the Connect app to create, update and delete your To-do List items, but also dispaly the statistics we've implemented in our reducers.
|
|
153
192
|
|
|
154
193
|
## Generate the editor template
|
|
155
194
|
|
|
156
|
-
Run the command below to generate the editor template for the **To-do List** document model.
|
|
195
|
+
Run the command below to generate the editor template for the **To-do List** document model.
|
|
157
196
|
This command reads the **To-do List** document model definition from the `document-models` folder and generates the editor template in the `editors/to-do-list` folder as `editor.tsx`.
|
|
158
197
|
|
|
159
198
|
Notice the `--editor` flag which specifies the **To-do List** document model, and the `--document-types` flag defines the document type `powerhouse/todolist`.
|
|
@@ -164,12 +203,11 @@ ph generate --editor ToDoList --document-types powerhouse/todolist
|
|
|
164
203
|
|
|
165
204
|
Once complete, navigate to the `editors/to-do-list/editor.tsx` file and open it in your editor.
|
|
166
205
|
|
|
167
|
-
|
|
168
206
|
### Editor implementation options
|
|
169
207
|
|
|
170
208
|
When building your editor component within the Powerhouse ecosystem, you have several options for styling, allowing you to leverage your preferred methods:
|
|
171
209
|
|
|
172
|
-
1. **Default HTML Styling:** Standard HTML tags (`<h1>`, `<p>`, `<button>`, etc.) will render with default styles offered through the boilerplate.
|
|
210
|
+
1. **Default HTML Styling:** Standard HTML tags (`<h1>`, `<p>`, `<button>`, etc.) will render with default styles offered through the boilerplate.
|
|
173
211
|
2. **Tailwind CSS:** Connect Studio comes with Tailwind CSS integrated. You can directly use Tailwind utility classes for rapid, consistent styling without writing separate CSS files.
|
|
174
212
|
3. **Custom CSS Files:** You can import traditional CSS files (`.css`) to apply custom styles or integrate existing style libraries.
|
|
175
213
|
|
|
@@ -180,9 +218,9 @@ Connect Studio provides a dynamic local environment (`ph connect`) to visualize
|
|
|
180
218
|
## To-do List editor
|
|
181
219
|
|
|
182
220
|
:::tip Implementing components
|
|
183
|
-
The editor we are about to implement makes use of some components from **Powerhouse Document Engineering**.
|
|
221
|
+
The editor we are about to implement makes use of some components from **Powerhouse Document Engineering**.
|
|
184
222
|
When you add the editor code, you'll see it makes use of two components, the `Checkbox` and `InputField`.
|
|
185
|
-
These are imported from the Powerhouse Document Engineering design system (`@powerhousedao/document-engineering/scalars`) which you should find under 'devdependencies' in your package.json file.
|
|
223
|
+
These are imported from the Powerhouse Document Engineering design system (`@powerhousedao/document-engineering/scalars`) which you should find under 'devdependencies' in your package.json file.
|
|
186
224
|
|
|
187
225
|
This system provides a library of reusable components to ensure consistency and speed up development.
|
|
188
226
|
You can explore available components, see usage examples, and understand their properties (props) using our Storybook instance. For a detailed guide on how to leverage the Document Engineering design system and Storybook, see [Using the Powerhouse Document Engineering](/academy/ComponentLibrary/DocumentEngineering) page.
|
|
@@ -196,23 +234,24 @@ For this tutorial, create a `components` folder inside `editors/to-do-list`. The
|
|
|
196
234
|
import { Form, BooleanField } from "@powerhousedao/document-engineering/scalars";
|
|
197
235
|
|
|
198
236
|
interface CheckboxProps {
|
|
199
|
-
|
|
200
|
-
|
|
237
|
+
value: boolean;
|
|
238
|
+
onChange: (value: boolean) => void;
|
|
201
239
|
}
|
|
202
240
|
|
|
203
241
|
export const Checkbox = ({ value, onChange }: CheckboxProps) => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
242
|
+
return (
|
|
243
|
+
<Form onSubmit={() => {}}>
|
|
244
|
+
<BooleanField
|
|
207
245
|
name="checked"
|
|
208
246
|
description="Check this box to mark the todo as completed"
|
|
209
247
|
value={value}
|
|
210
248
|
onChange={onChange}
|
|
211
249
|
/>
|
|
212
|
-
|
|
213
|
-
|
|
250
|
+
</Form>
|
|
251
|
+
);
|
|
214
252
|
};
|
|
215
|
-
|
|
253
|
+
|
|
254
|
+
````
|
|
216
255
|
</details>
|
|
217
256
|
|
|
218
257
|
<details>
|
|
@@ -254,9 +293,9 @@ export const InputField = (props: InputFieldProps) => {
|
|
|
254
293
|
</Form>
|
|
255
294
|
);
|
|
256
295
|
};
|
|
257
|
-
|
|
258
|
-
</details>
|
|
296
|
+
````
|
|
259
297
|
|
|
298
|
+
</details>
|
|
260
299
|
|
|
261
300
|
Below is the complete code for the To-Do List editor. It primarily uses Tailwind CSS for styling and imports the local `Checkbox` and `InputField` components you created in the previous step. These local components, in turn, utilize elements from the Powerhouse Document Engineering design system.
|
|
262
301
|
|
|
@@ -483,6 +522,7 @@ export default function Editor(props: IProps) {
|
|
|
483
522
|
);
|
|
484
523
|
}
|
|
485
524
|
```
|
|
525
|
+
|
|
486
526
|
</details>
|
|
487
527
|
|
|
488
528
|
Now you can run the Connect app and see the **To-do List** editor in action.
|
|
@@ -494,14 +534,15 @@ ph connect
|
|
|
494
534
|
In Connect, in the bottom right corner you'll find a new Document Model that you can create: **To-do List**. Click on it to create a new To-do List document.
|
|
495
535
|
|
|
496
536
|
:::tip Connect as your dynamic development environment
|
|
497
|
-
The editor will update dynamically, so you can play around with your editor styling while seeing your results appear in Connect Studio.
|
|
537
|
+
The editor will update dynamically, so you can play around with your editor styling while seeing your results appear in Connect Studio.
|
|
498
538
|
:::
|
|
499
539
|
|
|
500
540
|
</details>
|
|
501
541
|
|
|
502
542
|
Congratulations!
|
|
503
|
-
If you managed to follow this tutorial until this point, you have successfully implemented the **To-do List** document model with its reducer operations and editor.
|
|
543
|
+
If you managed to follow this tutorial until this point, you have successfully implemented the **To-do List** document model with its reducer operations and editor.
|
|
544
|
+
|
|
545
|
+
## Up Next
|
|
504
546
|
|
|
505
|
-
|
|
506
|
-
Now you can move on to creating a [custom drive explorer](/academy/MasteryTrack/BuildingUserExperiences/BuildingADriveExplorer) for your To-do List document.
|
|
547
|
+
Now you can move on to creating a [custom drive explorer](/academy/MasteryTrack/BuildingUserExperiences/BuildingADriveExplorer) for your To-do List document.
|
|
507
548
|
Imagine you have many To-do Lists sitting in a drive. A custom drive explorer will allow you to organize and track them at a glance, opening up a new world of possibilities to increase the functionality of your documents!
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# Configure a drive
|
|
2
2
|
|
|
3
|
-
A drive in Powerhouse is a container for documents and data. It's a place where you can organize and store your documents and share them with others. This guide walks you through configuring and managing drives in your Powerhouse environment.
|
|
3
|
+
A drive in Powerhouse is a container for documents and data. It's a place where you can organize and store your documents and share them with others. This guide walks you through configuring and managing drives in your Powerhouse environment.
|
|
4
4
|
|
|
5
5
|
:::info **Prerequisites**
|
|
6
6
|
|
|
7
7
|
Before configuring a drive, ensure you have:
|
|
8
|
+
|
|
8
9
|
- Powerhouse [CLI installed](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
9
10
|
- Access to a Powerhouse instance
|
|
10
11
|
- Appropriate permissions to create and manage drives
|
|
11
|
-
:::
|
|
12
|
+
:::
|
|
12
13
|
|
|
13
14
|
## Understanding drives
|
|
14
15
|
|
|
@@ -16,7 +17,7 @@ Before configuring a drive, ensure you have:
|
|
|
16
17
|
|
|
17
18
|
A local drive is a container for local documents and data, hosted on your local machine. Technically, a drive is itself a document that contains a list of the documents inside it. When you run Connect locally with `ph connect`, a local drive is automatically added. You can also create a new local drive by clicking **'Create New Drive'** in Connect.
|
|
18
19
|
|
|
19
|
-
### Remote drives vs. reactors
|
|
20
|
+
### Remote drives vs. reactors
|
|
20
21
|
|
|
21
22
|
Remote drives in Powerhouse allow you to connect to and work with data stored in external systems or cloud services. These drives act as bridges between Powerhouse contributors or other data sources, enabling seamless data synchronization. Drives can exist in three types of locations:
|
|
22
23
|
|
|
@@ -25,23 +26,22 @@ Remote drives in Powerhouse allow you to connect to and work with data stored in
|
|
|
25
26
|
- **Decentralized Storage**: Such as Ceramic or IPFS, enabling distributed and blockchain-based storage options.
|
|
26
27
|
|
|
27
28
|
:::tip **Explainer**
|
|
28
|
-
**Powerhouse Reactors** are the nodes in the network that store and synchronize documents and drives, resolve conflicts, and rerun operations to verify document event histories.
|
|
29
|
-
Reactors can be configured for local storage, centralized cloud storage, or a decentralized storage network.
|
|
29
|
+
**Powerhouse Reactors** are the nodes in the network that store and synchronize documents and drives, resolve conflicts, and rerun operations to verify document event histories.
|
|
30
|
+
Reactors can be configured for local storage, centralized cloud storage, or a decentralized storage network.
|
|
30
31
|
|
|
31
32
|
A reactor allows you to store multiple documents and host **drives** and Drive Explorers with different organizational purposes, users, access rights, and more.
|
|
32
33
|
:::
|
|
33
34
|
|
|
34
|
-
A drive uses a reactor and its underlying storage layer. A reactor is the low-level component that enables the synchronization of documents and drives.
|
|
35
|
+
A drive uses a reactor and its underlying storage layer. A reactor is the low-level component that enables the synchronization of documents and drives.
|
|
35
36
|
|
|
36
|
-
### Drive apps
|
|
37
|
+
### Drive apps
|
|
37
38
|
|
|
38
|
-
**Drive Explorers** (also known as Drive Apps) are specialized interfaces that enhance how users interact with documents within a drive. As mentioned, a drive is technically just another document containing a list of other documents. This means you can create a custom editor for your drive document.
|
|
39
|
+
**Drive Explorers** (also known as Drive Apps) are specialized interfaces that enhance how users interact with documents within a drive. As mentioned, a drive is technically just another document containing a list of other documents. This means you can create a custom editor for your drive document.
|
|
39
40
|
|
|
40
|
-
These customized editors are called Drive Explorers or Drive Apps. They provide custom views, organization tools, and interactive features tailored to specific use cases. For example, a Drive Explorer might present data as a Kanban board, provide aggregated insights, or offer specialized widgets for data processing.
|
|
41
|
+
These customized editors are called Drive Explorers or Drive Apps. They provide custom views, organization tools, and interactive features tailored to specific use cases. For example, a Drive Explorer might present data as a Kanban board, provide aggregated insights, or offer specialized widgets for data processing.
|
|
41
42
|
|
|
42
43
|
To learn more about building and customizing Drive Explorers, check out our [Building a Drive Explorer](/academy/MasteryTrack/BuildingUserExperiences/BuildingADriveExplorer) guide.
|
|
43
44
|
|
|
44
|
-
|
|
45
45
|
## Creating a new drive
|
|
46
46
|
|
|
47
47
|
<figure className="image-container">
|
|
@@ -50,7 +50,8 @@ To learn more about building and customizing Drive Explorers, check out our [Bui
|
|
|
50
50
|
</figure>
|
|
51
51
|
|
|
52
52
|
To create a new drive in Powerhouse, follow these steps:
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
1. Click the "**Create New Drive**" button in the Connect interface or the **+** icon in the Connect sidebar.
|
|
54
55
|
2. In the modal that appears, enter a name for your drive in the "**Drive Name**" field.
|
|
55
56
|
3. Select the desired Drive App (such as the Generic Drive Explorer, or any other Drive App you've installed).
|
|
56
57
|
4. Choose the location for your drive: **Local** (only available to you), **Cloud** (available to people in this drive), or **Public** (available to everyone).
|
|
@@ -62,13 +63,14 @@ To create a new drive in Powerhouse, follow these steps:
|
|
|
62
63
|
You can also add a new remote drive to your Connect environment programmatically using GraphQL mutations. This is especially useful for automation, scripting, or integrating with external systems.
|
|
63
64
|
|
|
64
65
|
:::info **Prerequisites**
|
|
65
|
-
|
|
66
|
+
|
|
67
|
+
- Access to the Switchboard or remote reactor (server node) of your Connect instance. In your local project, you can start your Reactor by running the following command in a different terminal from Connect Studio.
|
|
66
68
|
`bash
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
ph reactor
|
|
70
|
+
`
|
|
69
71
|
- The GraphQL endpoint of your instance. For example, for the staging environment, use: `https://staging.switchboard.phd/graphql/system` (this is a supergraph gateway. Read more about [subgraphs and supergraphs here](/academy/MasteryTrack/WorkWithData/UsingSubgraphs).
|
|
70
72
|
- Appropriate permissions to perform mutations.
|
|
71
|
-
:::
|
|
73
|
+
:::
|
|
72
74
|
|
|
73
75
|
<figure className="image-container">
|
|
74
76
|
<img src={require("./images/CreateNewDrive.png").default} alt="Create a new drive" />
|
|
@@ -76,58 +78,70 @@ You can also add a new remote drive to your Connect environment programmatically
|
|
|
76
78
|
</figure>
|
|
77
79
|
|
|
78
80
|
### 1. **Navigate to the GraphQL Playground or use a GraphQL client**
|
|
79
|
-
|
|
81
|
+
|
|
82
|
+
- Open [https://switchboard.phd/graphql/system](https://switchboard.phd/graphql/system) in your browser, or use a tool like [GraphQL Playground](https://www.apollographql.com/docs/apollo-server/testing/graphql-playground/).
|
|
80
83
|
|
|
81
84
|
### 2. **Prepare the Mutation**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
85
|
+
|
|
86
|
+
- Use the following mutation to create a new drive:
|
|
87
|
+
|
|
88
|
+
```graphql title="Create Drive Mutation"
|
|
89
|
+
mutation Mutation(
|
|
90
|
+
$name: String!
|
|
91
|
+
$icon: String
|
|
92
|
+
$addDriveId: String
|
|
93
|
+
$slug: String
|
|
94
|
+
) {
|
|
95
|
+
addDrive(name: $name, icon: $icon, id: $addDriveId, slug: $slug) {
|
|
96
|
+
icon
|
|
97
|
+
id
|
|
98
|
+
name
|
|
99
|
+
slug
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- These are the example variables, feel free to change these as you like and add a different name or logo for your drive:
|
|
105
|
+
|
|
106
|
+
```json title="Example Variables"
|
|
107
|
+
{
|
|
108
|
+
"name": "AcademyTest",
|
|
109
|
+
"icon": "https://static.thenounproject.com/png/3009860-200.png",
|
|
110
|
+
"addDriveId": null,
|
|
111
|
+
"slug": null
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- You can also provide a custom `id` or `slug` if needed.
|
|
105
116
|
|
|
106
117
|
### 3. **Execute the Mutation**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
|
|
119
|
+
- Run the mutation. On success, you will receive a response containing the new drive's `icon`, `id`, `name`, and `slug`:
|
|
120
|
+
|
|
121
|
+
```json title="Successful Response"
|
|
122
|
+
{
|
|
123
|
+
"data": {
|
|
124
|
+
"addDrive": {
|
|
125
|
+
"icon": "https://static.thenounproject.com/png/3009860-200.png",
|
|
126
|
+
"id": "6461580b-d317-4596-942d-f6b3d1bfc8fd",
|
|
127
|
+
"name": "AcademyTest",
|
|
128
|
+
"slug": "6461580b-d317-4596-942d-f6b3d1bfc8fd"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
121
133
|
|
|
122
134
|
### 4. **Construct the Drive URL**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
135
|
+
|
|
136
|
+
- Once you have the `id` or `slug`, you can construct the drive URL for Connect:
|
|
137
|
+
- Format: `domain/d/<driveId>` or `domain/d/<driveSlug>`
|
|
138
|
+
- Depending on whether you are using a hosted or a local environment, the domain in your URL will change.
|
|
139
|
+
- Example: `https://connect.phd/d/6461580b-d317-4596-942d-f6b3d1bfc8fd`
|
|
140
|
+
- Example: `https://localhost:4001/d/6461580b-d317-4596-942d-f6b3d1bfc8fd`
|
|
128
141
|
|
|
129
142
|
### 5. **Add the Drive in Connect**
|
|
130
|
-
|
|
143
|
+
|
|
144
|
+
- Use the constructed URL to add or access the drive in your Connect environment via the 'Add Drive' button.
|
|
131
145
|
|
|
132
146
|
<figure className="image-container">
|
|
133
147
|
<img src={require("./images/AddDrive.png").default} alt="Create a new drive" />
|
|
@@ -138,11 +152,12 @@ You can also add a new remote drive to your Connect environment programmatically
|
|
|
138
152
|
|
|
139
153
|
This approach allows you to automate drive creation and integration with other systems, making it easy to manage drives at scale.
|
|
140
154
|
|
|
141
|
-
## Up next
|
|
155
|
+
## Up next
|
|
142
156
|
|
|
143
|
-
You've now experienced the use of GraphQL to modify or read data captured in Powerhouse for the first time.
|
|
157
|
+
You've now experienced the use of GraphQL to modify or read data captured in Powerhouse for the first time.
|
|
144
158
|
You can now either continue with:
|
|
145
|
-
|
|
159
|
+
|
|
160
|
+
- User interfaces and [build a custom drive experiences](/academy/MasteryTrack/BuildingUserExperiences/BuildingADriveExplorer)
|
|
146
161
|
- Keep playing with data and the [Switchboard API](/academy/MasteryTrack/WorkWithData/UsingTheAPI)
|
|
147
162
|
|
|
148
163
|
Enjoy!
|