@powerhousedao/academy 3.2.0-dev.2 → 3.2.0-dev.3
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/CHANGELOG.md +10 -0
- package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +188 -0
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +10 -12
- package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +8 -8
- package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +11 -11
- package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +13 -13
- package/docs/academy/01-GetStarted/_04-BuildToDoListEditor +12 -12
- package/docs/academy/01-GetStarted/home.mdx +50 -51
- package/docs/academy/01-GetStarted/images/Connect.png +0 -0
- package/docs/academy/01-GetStarted/images/Packagemanager.png +0 -0
- package/docs/academy/01-GetStarted/images/TodoDriveApp.png +0 -0
- package/docs/academy/01-GetStarted/styles.module.css +7 -14
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +22 -22
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +17 -17
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +15 -15
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +11 -9
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +15 -15
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +9 -9
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +15 -15
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +14 -14
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +4 -4
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +28 -30
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +7 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +9 -10
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/01-OperationHistory.md +11 -11
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/02-RevisionHistoryTimeline.md +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/08-Authorization/01-RenownAuthenticationFlow.md +8 -8
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/08-Authorization/02-Authorization.md +8 -8
- package/docs/academy/02-MasteryTrack/04-WorkWithData/01-ReadingAndWritingThroughTheAPI.mdx +5 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/02-GraphQLAtPowerhouse.md +3 -3
- package/docs/academy/02-MasteryTrack/04-WorkWithData/03-WorkingWithSubgraphs/02-GraphQLAndSubgraphs.mdx +8 -8
- package/docs/academy/02-MasteryTrack/04-WorkWithData/03-WorkingWithSubgraphs/03-WorkingWithSubgraphs.md +28 -28
- package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +4 -4
- package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/01-SetupBuilderEnvironment.md +14 -14
- package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/02-CreateNewPowerhouseProject.md +2 -2
- package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/03-GenerateAnAnalyticsProcessor.md +6 -6
- package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/04-UpdateAnalyticsProcessor.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +2 -2
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +4 -4
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +7 -7
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +6 -6
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/browser.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +5 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/pg.md +2 -2
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/index.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +12 -12
- package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +9 -9
- package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +8 -8
- package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +35 -35
- package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +8 -8
- package/docs/academy/02-MasteryTrack/_category_.json +1 -1
- package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +5 -5
- package/docs/academy/07-Cookbook.md +105 -105
- package/package.json +1 -1
- package/sidebars.ts +9 -10
- package/src/css/custom.css +18 -0
- package/docs/academy/01-GetStarted/00-ExploreDemoPackage.md +0 -88
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Specify the
|
|
1
|
+
# Specify the state schema
|
|
2
2
|
|
|
3
3
|
The state schema is the backbone of your document model. It defines the structure, data types, and relationships of the information your document will hold. In Powerhouse, we use the GraphQL Schema Definition Language (SDL) to define this schema. A well-defined state schema is crucial for ensuring data integrity, consistency, and for enabling powerful querying and manipulation capabilities.
|
|
4
4
|
|
|
5
|
-
## Core
|
|
5
|
+
## Core concepts
|
|
6
6
|
|
|
7
7
|
### Types
|
|
8
8
|
At the heart of GraphQL SDL are **types**. Types define the shape of your data. You can define custom object types that represent the entities in your document. For example, in a `ToDoList` document, you might have a `ToDoListState` type and a `ToDoItem` type.
|
|
@@ -23,12 +23,13 @@ GraphQL has a set of built-in **scalar types**:
|
|
|
23
23
|
|
|
24
24
|
In addition to these standard types, the Powerhouse Document-Engineering system introduces custom scalars that are linked to reusable front-end components. These scalars are tailored for the web3 ecosystem and will be explored in the Component Library section of the documentation.
|
|
25
25
|
|
|
26
|
-
### Lists and
|
|
26
|
+
### Lists and non-null
|
|
27
|
+
|
|
27
28
|
You can modify types using lists and non-null indicators:
|
|
28
29
|
* **Lists**: To indicate that a field will return a list of a certain type, you wrap the type in square brackets, e.g., `[ToDoItem!]!`. This means the field `items` in `ToDoListState` will be a list of `ToDoItem` objects.
|
|
29
30
|
* **Non-Null**: To indicate that a field cannot be null, you add an exclamation mark `!` after the type name, e.g., `String!`. This means that the `text` field of a `ToDoItem` must always have a value. The outer `!` in `[ToDoItem!]!` means the list itself cannot be null (it must be at least an empty list), and the inner `!` on `ToDoItem!` means that every item within that list must also be non-null.
|
|
30
31
|
|
|
31
|
-
## Example: ToDoList
|
|
32
|
+
## Example: ToDoList state schema
|
|
32
33
|
|
|
33
34
|
Let's revisit the `ToDoList` example from the "Define the ToDoList document specification" tutorial.
|
|
34
35
|
Only this time, we'll also add a 'Stats' type. Since we want to keep track of the number of completed To-Do's.
|
|
@@ -71,7 +72,7 @@ type ToDoListStats {
|
|
|
71
72
|
* `checked: Int!`: The number of to-do items that are marked as completed. This must be an integer and cannot be null.
|
|
72
73
|
* `unchecked: Int!`: The number of to-do items that are still pending. This also must be an integer and cannot be null.
|
|
73
74
|
|
|
74
|
-
## Best
|
|
75
|
+
## Best practices for designing your state schema
|
|
75
76
|
|
|
76
77
|
1. **Start Simple, Iterate**: Begin with the core entities and properties. You can always expand and refine your schema as your understanding of the document's requirements grows.
|
|
77
78
|
2. **Clarity and Explicitness**: Name your types and fields clearly and descriptively. This makes the schema easier to understand and maintain.
|
|
@@ -85,12 +86,12 @@ type ToDoListStats {
|
|
|
85
86
|
|
|
86
87
|
By carefully defining your state schema, you lay a solid foundation for your Powerhouse document model, making it robust, maintainable, and easy to work with. The schema dictates not only how data is stored but also how it can be queried and mutated through operations, which will be covered in the next section.
|
|
87
88
|
|
|
88
|
-
## Practical
|
|
89
|
+
## Practical implementation: defining the state schema in Connect
|
|
89
90
|
|
|
90
91
|
Now that you understand the concepts behind the state schema, let's put it into practice. This section will guide you through creating a document model specification for the advanced ToDoList example discussed above.
|
|
91
92
|
|
|
92
93
|
<details>
|
|
93
|
-
<summary>Tutorial: The
|
|
94
|
+
<summary>Tutorial: The state schema specification</summary>
|
|
94
95
|
|
|
95
96
|
### Prerequisites
|
|
96
97
|
|
|
@@ -105,7 +106,7 @@ Now that you understand the concepts behind the state schema, let's put it into
|
|
|
105
106
|
|
|
106
107
|
2. **Define Document Metadata**:
|
|
107
108
|
- **Name**: Give your document model a descriptive name, for example, `ToDoList`. **Pay close attention to capitalization, as it influences our code.**
|
|
108
|
-
- **Document Type**: In the 'Document Type' field, enter a unique identifier for this document type
|
|
109
|
+
- **Document Type**: In the 'Document Type' field, enter a unique identifier for this document type: `powerhouse/todolist`.
|
|
109
110
|
|
|
110
111
|
3. **Specify the State Schema**:
|
|
111
112
|
- In the code editor provided, you'll see a template for a GraphQL schema.
|
|
@@ -115,6 +116,7 @@ Now that you understand the concepts behind the state schema, let's put it into
|
|
|
115
116
|
# The state of our ToDoList
|
|
116
117
|
type ToDoListState {
|
|
117
118
|
items: [ToDoItem!]!
|
|
119
|
+
stats: ToDoListStats!
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
# A single to-do item
|
|
@@ -141,5 +143,5 @@ By completing these steps, you have successfully specified the data structure fo
|
|
|
141
143
|
|
|
142
144
|
</details>
|
|
143
145
|
|
|
144
|
-
For a complete, working example, you can always
|
|
146
|
+
For a complete, working example, you can always have a look at the [Example ToDoList Repository](/academy/MasteryTrack/DocumentModelCreation/ExampleToDoListRepository) which contains the full implementation of the concepts discussed in this Mastery Track.
|
|
145
147
|
|
package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# Specify
|
|
1
|
+
# Specify document operations
|
|
2
2
|
|
|
3
3
|
In the previous section, we defined the state schema for our document model. Now, we turn our attention to a critical aspect of document model creation: **specifying document operations**. These operations are the heart of your document's behavior, dictating how its state can be modified.
|
|
4
4
|
|
|
5
|
-
## What are
|
|
5
|
+
## What are document operations?
|
|
6
6
|
|
|
7
7
|
In Powerhouse, document models adhere to event sourcing principles. This means that every change to a document's state is the result of a sequence of operations (or events). Instead of directly mutating the state, you define specific, named operations that describe the intended change.
|
|
8
8
|
|
|
9
|
-
For example, in our `
|
|
9
|
+
For example, in our `To-do List` document model, operations might include:
|
|
10
10
|
|
|
11
11
|
* `ADD_TODO_ITEM`: To add a new task.
|
|
12
12
|
* `UPDATE_TODO_ITEM`: To modify an existing task (e.g., change its text or mark it as completed).
|
|
@@ -14,9 +14,9 @@ For example, in our `ToDoList` document model, operations might include:
|
|
|
14
14
|
|
|
15
15
|
Each operation acts as a command that, when applied, transitions the document from one state to the next. The complete history of these operations defines the document's journey to its current state.
|
|
16
16
|
|
|
17
|
-
## Connecting
|
|
17
|
+
## Connecting operations to the schema
|
|
18
18
|
|
|
19
|
-
In the "Define
|
|
19
|
+
In the "Define To-do List Document Model" chapter in the "Get Started" guide, we used GraphQL `input` types to define the structure of the data required for each operation. Let's revisit that:
|
|
20
20
|
|
|
21
21
|
```graphql
|
|
22
22
|
# Defines a GraphQL input type for adding a new to-do item
|
|
@@ -46,7 +46,7 @@ These `input` types are not just abstract definitions; they are the **specificat
|
|
|
46
46
|
|
|
47
47
|
The Powerhouse Connect application uses these GraphQL input types when you define operations within a module (e.g., the `to_do_list` module with operations `ADD_TODO_ITEM`, `UPDATE_TODO_ITEM`, `DELETE_TODO_ITEM`).
|
|
48
48
|
|
|
49
|
-
## Designing
|
|
49
|
+
## Designing effective document operations
|
|
50
50
|
|
|
51
51
|
Careful design of your document operations is crucial for a robust and maintainable document model. Here are some key considerations:
|
|
52
52
|
|
|
@@ -57,7 +57,7 @@ Operations should be granular enough to represent distinct user intentions or lo
|
|
|
57
57
|
* **Too fine:** While possible, having separate operations like `SET_TODO_ITEM_TEXT` and `SET_TODO_ITEM_CHECKED_STATUS` might be overly verbose if these are often updated together. `UPDATE_TODO_ITEM` with optional fields offers a good balance.
|
|
58
58
|
* **Just right:** The `ADD_TODO_ITEM`, `UPDATE_TODO_ITEM`, and `DELETE_TODO_ITEM` operations for our `ToDoList` are good examples. They represent clear, atomic changes.
|
|
59
59
|
|
|
60
|
-
### 2. Naming
|
|
60
|
+
### 2. Naming conventions
|
|
61
61
|
Clear and consistent naming makes your operations understandable. A common convention is `VERB_NOUN` or `VERB_NOUN_SUBJECT`.
|
|
62
62
|
|
|
63
63
|
* Examples: `ADD_ITEM`, `UPDATE_USER_PROFILE`, `ASSIGN_TASK_TO_USER`.
|
|
@@ -65,7 +65,7 @@ Clear and consistent naming makes your operations understandable. A common conve
|
|
|
65
65
|
|
|
66
66
|
The name you provide in the Connect UI (e.g., `ADD_TODO_ITEM`) directly corresponds to the operation type that will be recorded and that your reducers will handle.
|
|
67
67
|
|
|
68
|
-
### 3. Input
|
|
68
|
+
### 3. Input types (payloads)
|
|
69
69
|
The input type for an operation (its payload) should contain all the necessary information to perform that operation, and nothing more.
|
|
70
70
|
|
|
71
71
|
* **Completeness:** If an operation needs a user ID to authorize a change, include it in the input.
|
|
@@ -74,15 +74,15 @@ The input type for an operation (its payload) should contain all the necessary i
|
|
|
74
74
|
|
|
75
75
|
The GraphQL `input` types we defined earlier (`AddTodoItemInput`, `UpdateTodoItemInput`, `DeleteTodoItemInput`) serve precisely this purpose. They ensure that whoever triggers an operation provides the correct data in the correct format.
|
|
76
76
|
|
|
77
|
-
### 4. Immutability and
|
|
77
|
+
### 4. Immutability and pure functions
|
|
78
78
|
While not specified in the operation definition itself, remember that the *implementation* of these operations (the reducers) should treat state as immutable and behave as pure functions. The operation specification (input type) provides the data for these pure functions.
|
|
79
79
|
|
|
80
|
-
## Role in
|
|
80
|
+
## Role in event sourcing and CQRS
|
|
81
81
|
|
|
82
82
|
* **Events:** Each successfully executed operation is recorded as an event in the document's history. This history provides an audit trail and allows for replaying events to reconstruct state, which is invaluable for debugging and understanding how a document evolved.
|
|
83
83
|
* **Commands:** Document operations are essentially "commands" in a Command Query Responsibility Segregation (CQRS) pattern. They represent an intent to change the state. The processing of this command (by the reducer) leads to one or more events being stored and the state being updated.
|
|
84
84
|
|
|
85
|
-
## From
|
|
85
|
+
## From specification to implementation
|
|
86
86
|
|
|
87
87
|
Specifying your document operations is the bridge between defining your data structure (the state schema) and implementing the logic that changes that data (the reducers).
|
|
88
88
|
|
|
@@ -110,14 +110,14 @@ export const reducer: ToDoListToDoListOperations = {
|
|
|
110
110
|
};
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
## Practical
|
|
113
|
+
## Practical implementation: Defining operations in Connect
|
|
114
114
|
|
|
115
|
-
Now that you understand the theory, let's walk through the practical steps of defining these operations for our `
|
|
115
|
+
Now that you understand the theory, let's walk through the practical steps of defining these operations for our `To-do List` document model within the Powerhouse Connect application.
|
|
116
116
|
|
|
117
117
|
<details>
|
|
118
|
-
<summary>Tutorial: Specifying
|
|
118
|
+
<summary>Tutorial: Specifying To-do List operations</summary>
|
|
119
119
|
|
|
120
|
-
Assuming you have already defined the state schema for the `
|
|
120
|
+
Assuming you have already defined the state schema for the `To-do List` as covered in the previous section, follow these steps to add the operations:
|
|
121
121
|
|
|
122
122
|
1. **Create a Module for Operations:**
|
|
123
123
|
Below the schema editor in Connect, find the input field labeled `Add module`. Modules help organize your operations.
|
package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Use the
|
|
1
|
+
# Use the document model generator
|
|
2
2
|
|
|
3
3
|
In the Powerhouse Document Model development workflow, after specifying your document model's state schema and operations within the Connect application and exporting it as a `.phdm.zip` file, the next crucial step is to translate this specification into a tangible codebase. This is where the Powerhouse Document Model Generator comes into play.
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ Before you can use the Document Model Generator, ensure you have the following:
|
|
|
13
13
|
1. **Powerhouse CLI (`ph-cmd`) Installed:** The generator is part of the Powerhouse CLI. If you haven't installed it, refer to the [Builder Tools documentation](/academy/MasteryTrack/BuilderEnvironment/BuilderTools#installing-the-powerhouse-cli).
|
|
14
14
|
2. **Document Model Specification File (`.phdm.zip`):** You must have already defined your document model in Connect and exported it. This file (e.g., `YourModelName.phdm.zip`) contains the GraphQL schema for your document's state and operations. This process is typically covered in a preceding step, such as "Define [YourModelName] Document Model."
|
|
15
15
|
|
|
16
|
-
## The
|
|
16
|
+
## The command
|
|
17
17
|
|
|
18
18
|
The core command to invoke the Document Model Generator is:
|
|
19
19
|
|
|
@@ -29,7 +29,7 @@ ph generate Invoice.phdm.zip
|
|
|
29
29
|
|
|
30
30
|
When executed, this command reads and parses the specification file and generates a set of files and directories within your Powerhouse project.
|
|
31
31
|
|
|
32
|
-
## What
|
|
32
|
+
## What happens under the hood? A deep dive into the generated artifacts
|
|
33
33
|
|
|
34
34
|
Running `ph generate` triggers a series of actions that lay the groundwork for your document model's implementation. Let's explore the typical output structure and the significance of each generated component.
|
|
35
35
|
|
|
@@ -79,7 +79,7 @@ For example, using `Invoice.phdm.zip` would result in a directory structure unde
|
|
|
79
79
|
* **Purpose:** You can create this directory for any custom utility functions specific to your document model's implementation that don't fit directly into the reducers.
|
|
80
80
|
* **Significance:** Helps in organizing shared logic or complex computations that might be used across multiple reducers or other parts of your model's ecosystem.
|
|
81
81
|
|
|
82
|
-
## Benefits of
|
|
82
|
+
## Benefits of using the document model generator
|
|
83
83
|
|
|
84
84
|
Leveraging the `ph generate` command offers numerous advantages:
|
|
85
85
|
|
|
@@ -90,14 +90,14 @@ Leveraging the `ph generate` command offers numerous advantages:
|
|
|
90
90
|
5. **Alignment with Powerhouse Ecosystem:** The generated code is designed to integrate seamlessly with other parts of the Powerhouse ecosystem, such as the reducer execution engine and UI components.
|
|
91
91
|
6. **Single Source of Truth:** Ensures that your codebase (especially types and action creators) stays synchronized with the document model specification defined in Connect. If the specification changes, regenerating the model will update these components accordingly.
|
|
92
92
|
|
|
93
|
-
## Practical
|
|
93
|
+
## Practical implementation: Generating the `To-do List` model
|
|
94
94
|
|
|
95
|
-
Now that you understand what the Document Model Generator does, let's walk through the practical steps of using it with our `
|
|
95
|
+
Now that you understand what the Document Model Generator does, let's walk through the practical steps of using it with our `To-do List` example.
|
|
96
96
|
|
|
97
97
|
<details>
|
|
98
|
-
<summary>Tutorial: Generating the
|
|
98
|
+
<summary>Tutorial: Generating the `To-do List` document model</summary>
|
|
99
99
|
|
|
100
|
-
This tutorial assumes you have completed the previous steps in this Mastery Track, where you defined the state schema and operations for the `
|
|
100
|
+
This tutorial assumes you have completed the previous steps in this Mastery Track, where you defined the state schema and operations for the `To-do List` model in Connect and exported it.
|
|
101
101
|
|
|
102
102
|
### Prerequisites
|
|
103
103
|
|
|
@@ -127,7 +127,7 @@ With these files generated, you have successfully scaffolded your document model
|
|
|
127
127
|
|
|
128
128
|
</details>
|
|
129
129
|
|
|
130
|
-
## Next
|
|
130
|
+
## Next steps
|
|
131
131
|
|
|
132
132
|
Once the Document Model Generator has successfully scaffolded your project, the immediate next step is to implement the logic for each operation within the generated reducer files (e.g., `document-models/YourModelName/src/reducers/your-model-name.ts`). This involves taking the current state and the action input, and returning the new state of the document.
|
|
133
133
|
|
package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# Implement
|
|
1
|
+
# Implement document reducers
|
|
2
2
|
|
|
3
|
-
## The
|
|
3
|
+
## The heart of document logic
|
|
4
4
|
|
|
5
5
|
In our journey through Powerhouse Document Model creation, we've defined the "what" – the structure of our data ([State Schema](02-SpecifyTheStateSchema.md)) and the ways it can be changed ([Document Operations](03-SpecifyDocumentOperations.md)). We've also seen how the [Document Model Generator](04-UseTheDocumentModelGenerator.md) translates these specifications into a coded scaffold. Now, we arrive at the "how": implementing **Document Reducers**.
|
|
6
6
|
|
|
7
7
|
Reducers are the core logic units of your document model. They are the functions that take the current state of your document and an operation (an "action"), and then determine the *new* state of the document. They are the embodiment of your business rules and the engine that drives state transitions in a predictable, auditable, and immutable way.
|
|
8
8
|
|
|
9
|
-
## Recap: The
|
|
9
|
+
## Recap: The journey to reducer implementation
|
|
10
10
|
|
|
11
11
|
Before diving into the specifics of writing reducers, let's recall the preceding steps:
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Before diving into the specifics of writing reducers, let's recall the preceding
|
|
|
16
16
|
|
|
17
17
|
This generated reducer file is our starting point. It will contain function stubs or an object structure expecting your reducer implementations, all typed according to your schema.
|
|
18
18
|
|
|
19
|
-
## What is a
|
|
19
|
+
## What is a reducer? The core principles
|
|
20
20
|
|
|
21
21
|
In the context of Powerhouse and inspired by patterns like Redux, a reducer is a **pure function** with the following signature (conceptually):
|
|
22
22
|
|
|
@@ -30,7 +30,7 @@ Let's break down its components and principles:
|
|
|
30
30
|
* An `input` property (or similar, like `payload`): An object containing the data necessary for the operation, matching the GraphQL `input` type you defined (e.g., `{ id: '1', text: 'Buy groceries' }` for `AddTodoItemInput`).
|
|
31
31
|
* **`newState`**: The reducer must return a *new* state object representing the state after the operation has been applied. If the operation does not result in a state change, the reducer should return the `currentState` object itself.
|
|
32
32
|
|
|
33
|
-
### Key
|
|
33
|
+
### Key principles guiding reducer implementation:
|
|
34
34
|
|
|
35
35
|
1. **Purity**:
|
|
36
36
|
* **Deterministic**: Given the same `currentState` and `action`, a reducer must *always* produce the same `newState`.
|
|
@@ -43,7 +43,7 @@ Let's break down its components and principles:
|
|
|
43
43
|
|
|
44
44
|
3. **Single Source of Truth**: The document state managed by reducers is the single source of truth for that document instance. All UI rendering and data queries are derived from this state.
|
|
45
45
|
|
|
46
|
-
4. **Delegation to
|
|
46
|
+
4. **Delegation to specific operation handlers**:
|
|
47
47
|
While you can write one large reducer that uses a `switch` statement or `if/else if` blocks based on `action.type`, Powerhouse's generated code typically encourages a more modular approach. You'll often implement a separate function for each operation, which are then combined into a main reducer object or map. The `ph generate` command usually sets up this structure for you. For example, in your `document-models/to-do-list/src/reducers/to-do-list.ts`, you'll find an object structure like this:
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
@@ -73,7 +73,7 @@ Let's break down its components and principles:
|
|
|
73
73
|
|
|
74
74
|
The `dispatch` parameter is an advanced feature allowing a reducer to trigger subsequent operations. While powerful for complex workflows, it's often not needed for basic operations and can be ignored if unused.
|
|
75
75
|
|
|
76
|
-
## Implementing
|
|
76
|
+
## Implementing reducer logic: A practical guide
|
|
77
77
|
|
|
78
78
|
Let's use our familiar `ToDoList` example to illustrate common patterns. For this example, we'll assume our state schema has been updated to include a `stats` object to track the number of total, checked, and unchecked items.
|
|
79
79
|
|
|
@@ -102,7 +102,7 @@ And our action creators (from `../../gen/creators` or `../../gen/operations.js`)
|
|
|
102
102
|
* `actions.updateTodoItem({ id: 'item-id', text: 'Updated Task Text', checked: true })`
|
|
103
103
|
* `actions.deleteTodoItem({ id: 'item-id' })`
|
|
104
104
|
|
|
105
|
-
### 1. Adding an
|
|
105
|
+
### 1. Adding an item (e.g., `addTodoItemOperation`)
|
|
106
106
|
|
|
107
107
|
To add a new item to the `items` array immutably:
|
|
108
108
|
|
|
@@ -125,7 +125,7 @@ addTodoItemOperation(state: ToDoListState, action: /* AddTodoItemActionType */ a
|
|
|
125
125
|
* We use the spread operator (`...state`) to copy top-level properties from the old state into the new state object.
|
|
126
126
|
* For the `items` array, we create a *new* array by spreading the existing `state.items` and then appending the `newItem`.
|
|
127
127
|
|
|
128
|
-
### 2. Updating an
|
|
128
|
+
### 2. Updating an item (e.g., `updateTodoItemOperation`)
|
|
129
129
|
|
|
130
130
|
To update an existing item in the `items` array immutably:
|
|
131
131
|
|
|
@@ -171,7 +171,7 @@ if (!itemToUpdate) {
|
|
|
171
171
|
// ... proceed with map
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
### 3. Deleting an
|
|
174
|
+
### 3. Deleting an item (e.g., `deleteTodoItemOperation`)
|
|
175
175
|
|
|
176
176
|
To remove an item from the `items` array immutably:
|
|
177
177
|
|
|
@@ -189,7 +189,7 @@ deleteTodoItemOperation(state: ToDoListState, action: /* DeleteTodoItemActionTyp
|
|
|
189
189
|
**Explanation**:
|
|
190
190
|
* We use the `filter` array method, which returns a *new* array containing only the elements for which the callback function returns `true`.
|
|
191
191
|
|
|
192
|
-
## Leveraging
|
|
192
|
+
## Leveraging generated types
|
|
193
193
|
|
|
194
194
|
As highlighted in [Using the Document Model Generator](04-UseTheDocumentModelGenerator.md), `ph generate` produces TypeScript types for your state (e.g., `ToDoListState`, `ToDoItem`) and the inputs for your operations (e.g., `AddTodoItemInput`, `UpdateTodoItemInput`).
|
|
195
195
|
|
|
@@ -232,16 +232,16 @@ Using these types provides:
|
|
|
232
232
|
* **Autocompletion and IntelliSense**: Improved developer experience in your IDE.
|
|
233
233
|
* **Clearer code**: Types serve as documentation for the expected data structures.
|
|
234
234
|
|
|
235
|
-
## Practical
|
|
235
|
+
## Practical implementation: Writing the `ToDoList` reducers
|
|
236
236
|
|
|
237
237
|
Now that you understand the principles, let's put them into practice by implementing the reducers for our `ToDoList` document model.
|
|
238
238
|
|
|
239
239
|
<details>
|
|
240
|
-
<summary>Tutorial: Implementing the ToDoList
|
|
240
|
+
<summary>Tutorial: Implementing the ToDoList reducers</summary>
|
|
241
241
|
|
|
242
242
|
This tutorial assumes you have followed the steps in the previous chapters, especially using `ph generate ToDoList.phdm.zip` to scaffold your document model's code.
|
|
243
243
|
|
|
244
|
-
### Implement the
|
|
244
|
+
### Implement the operation reducers
|
|
245
245
|
|
|
246
246
|
Navigate to `document-models/to-do-list/src/reducers/to-do-list.ts`. The generator will have created a skeleton file. Replace its contents with the following logic.
|
|
247
247
|
|
|
@@ -332,7 +332,7 @@ export const reducer: ToDoListToDoListOperations = {
|
|
|
332
332
|
|
|
333
333
|
</details>
|
|
334
334
|
|
|
335
|
-
## Reducers and the
|
|
335
|
+
## Reducers and the event sourcing model
|
|
336
336
|
|
|
337
337
|
Every time a reducer processes an operation and returns a new state, Powerhouse records the original operation (the "event") in an append-only log associated with the document instance. The current state of the document is effectively a "fold" or "reduction" of all past events, applied sequentially by the reducers.
|
|
338
338
|
|
package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# Implement
|
|
1
|
+
# Implement document model tests
|
|
2
2
|
|
|
3
|
-
## Ensuring
|
|
3
|
+
## Ensuring robustness and reliability
|
|
4
4
|
|
|
5
5
|
In the previous chapter, we implemented the core reducer logic for our document model. Now, we reach a critical stage that underpins the reliability and correctness of our entire model: **Implementing Document Model Tests**.
|
|
6
6
|
|
|
7
7
|
Testing is not an afterthought; it's an integral part of the development lifecycle, especially in systems like Powerhouse where data integrity and predictable state transitions are paramount. Well-crafted tests serve as a safety net, allowing you to refactor and extend your document model with confidence.
|
|
8
8
|
|
|
9
|
-
This document provides a practical, hands-on tutorial for testing the `
|
|
9
|
+
This document provides a practical, hands-on tutorial for testing the `To-do List` document model reducers you have just built.
|
|
10
10
|
|
|
11
|
-
## Practical
|
|
11
|
+
## Practical implementation: Writing and running the To-do List tests
|
|
12
12
|
|
|
13
|
-
This tutorial assumes you have implemented the `
|
|
13
|
+
This tutorial assumes you have implemented the `To-do List` reducers as described in the previous chapter and that the code generator has created a test file skeleton at `document-models/to-do-list/src/reducers/tests/to-do-list.test.ts`.
|
|
14
14
|
|
|
15
15
|
<details>
|
|
16
|
-
<summary>Tutorial: Implementing and
|
|
16
|
+
<summary>Tutorial: Implementing and running the `To-do List` reducer tests</summary>
|
|
17
17
|
|
|
18
|
-
### 1. Implement the
|
|
18
|
+
### 1. Implement the reducer tests
|
|
19
19
|
|
|
20
20
|
With the reducer logic in place, it's critical to test it. Navigate to the generated test file at `document-models/to-do-list/src/reducers/tests/to-do-list.test.ts` and replace its contents with the following test suite.
|
|
21
21
|
|
|
@@ -96,7 +96,7 @@ describe('Todolist Operations', () => {
|
|
|
96
96
|
});
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
### 2. Run the
|
|
99
|
+
### 2. Run the tests
|
|
100
100
|
|
|
101
101
|
Now, run the tests from your project's root directory to verify your implementation.
|
|
102
102
|
|
|
@@ -104,11 +104,11 @@ Now, run the tests from your project's root directory to verify your implementat
|
|
|
104
104
|
pnpm run test
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
If all tests pass, you have successfully verified the core logic of your `
|
|
107
|
+
If all tests pass, you have successfully verified the core logic of your `To-do List` document model. This ensures that the reducers you wrote behave exactly as expected.
|
|
108
108
|
|
|
109
109
|
</details>
|
|
110
110
|
|
|
111
|
-
## Best
|
|
111
|
+
## Best practices for document model tests
|
|
112
112
|
|
|
113
113
|
While the tutorial provides a concrete example, keep these general best practices in mind when writing your tests:
|
|
114
114
|
|
|
@@ -122,7 +122,7 @@ While the tutorial provides a concrete example, keep these general best practice
|
|
|
122
122
|
* **Cover Edge Cases**: Test what happens when an operation receives invalid input (e.g., trying to update an item that doesn't exist). Your test should confirm the reducer either throws an error or returns the state unchanged, depending on your implementation.
|
|
123
123
|
* **Run Tests Frequently**: Integrate testing into your development workflow. Run tests after making changes to ensure you haven't broken anything. The `pnpm run test` command is your friend.
|
|
124
124
|
|
|
125
|
-
## Conclusion: The
|
|
125
|
+
## Conclusion: The payoff of diligent testing
|
|
126
126
|
|
|
127
127
|
Implementing comprehensive tests for your document model reducers is an investment that pays dividends in the long run. It leads to:
|
|
128
128
|
|
|
@@ -133,7 +133,7 @@ Implementing comprehensive tests for your document model reducers is an investme
|
|
|
133
133
|
|
|
134
134
|
By following the tutorial and applying these best practices, you can build a strong suite of tests that safeguard the integrity and functionality of your document models. This diligence is a hallmark of a "Mastery Track" developer, ensuring that the solutions you build are not just functional but also stable, maintainable, and trustworthy.
|
|
135
135
|
|
|
136
|
-
## Up
|
|
137
|
-
In the next chapter of the Mastery Track - Building User Experiences you will learn how to implement an editor for your document model so you can see a simple user interface for the **
|
|
136
|
+
## Up next
|
|
137
|
+
In the next chapter of the Mastery Track - Building User Experiences you will learn how to implement an [editor](/academy/MasteryTrack/BuildingUserExperiences/BuildingDocumentEditors) for your document model so you can see a simple user interface for the **To-do List** document model in action.
|
|
138
138
|
|
|
139
|
-
For a complete, working example, you can always
|
|
139
|
+
For a complete, working example, you can always have a look at the [Example To-do List Repository](/academy/MasteryTrack/DocumentModelCreation/ExampleToDoListRepository) which contains the full implementation of the concepts discussed in this Mastery Track.
|
package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Example:
|
|
1
|
+
# Example: Todo demo package
|
|
2
2
|
|
|
3
3
|
:::info
|
|
4
4
|
|
|
@@ -9,12 +9,12 @@ https://github.com/powerhouse-inc/todo-demo-package
|
|
|
9
9
|
|
|
10
10
|
There are several ways to explore this package:
|
|
11
11
|
|
|
12
|
-
### Option 1: Rebuild the
|
|
12
|
+
### Option 1: Rebuild the todo demo package
|
|
13
13
|
|
|
14
14
|
The ToDo Demo package and repository are your main reference points during the Mastery Track.
|
|
15
15
|
Follow the steps in the "Mastery Track – Document Model Creation" chapters to build along with the examples.
|
|
16
16
|
|
|
17
|
-
### Option 2: Clone and
|
|
17
|
+
### Option 2: Clone and run the code locally
|
|
18
18
|
|
|
19
19
|
The package includes:
|
|
20
20
|
- The Document Model
|
|
@@ -29,7 +29,7 @@ You can clone the repository and run Connect Studio to see all the code in actio
|
|
|
29
29
|
ph connect
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
### Option 3: Install the
|
|
32
|
+
### Option 3: Install the todo demo package in a (local) host app
|
|
33
33
|
|
|
34
34
|
Alternatively, you can install this package in a Powerhouse project or in your deployed host apps:
|
|
35
35
|
|
package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Build
|
|
1
|
+
# Build document editors
|
|
2
2
|
|
|
3
|
-
## Build with
|
|
3
|
+
## Build with react on powerhouse
|
|
4
4
|
|
|
5
5
|
At Powerhouse, frontend development for document editors follows a simple and familiar flow, leveraging the power and flexibility of React.
|
|
6
6
|
|
|
7
|
-
### Development
|
|
7
|
+
### Development environment
|
|
8
8
|
|
|
9
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).
|
|
@@ -19,18 +19,18 @@ Powerhouse aims to keep your developer experience clean, familiar, and focused:
|
|
|
19
19
|
- Use styling approaches you're comfortable with.
|
|
20
20
|
- Trust Connect Studio to handle the setup and build processes for you.
|
|
21
21
|
|
|
22
|
-
### Generating
|
|
22
|
+
### Generating your editor template
|
|
23
23
|
|
|
24
24
|
To kickstart your editor development, Powerhouse provides a command to generate a basic editor template. This command reads your document model specifications and creates the initial `editor.tsx` file.
|
|
25
25
|
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
26
|
|
|
27
|
-
For example, to generate an editor for a `
|
|
27
|
+
For example, to generate an editor for a `To-do List` document model with a document type `powerhouse/todolist`:
|
|
28
28
|
```bash
|
|
29
29
|
ph generate --editor ToDoList --document-types powerhouse/todolist
|
|
30
30
|
```
|
|
31
31
|
This will create the template in the `editors/to-do-list/editor.tsx` folder.
|
|
32
32
|
|
|
33
|
-
### Styling
|
|
33
|
+
### Styling your editor
|
|
34
34
|
|
|
35
35
|
You have several options for styling your editor components:
|
|
36
36
|
|
|
@@ -74,7 +74,7 @@ You have several options for styling your editor components:
|
|
|
74
74
|
|
|
75
75
|
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
76
|
|
|
77
|
-
### State
|
|
77
|
+
### State management in editors
|
|
78
78
|
|
|
79
79
|
When you build an editor in Powerhouse, your main editor component receives `EditorProps`. These props are crucial for interacting with the document:
|
|
80
80
|
|
|
@@ -112,11 +112,11 @@ Your document model's generated code (e.g., in `document-models/your-model/index
|
|
|
112
112
|
```
|
|
113
113
|
The actual state modification logic resides in your document model's reducers, ensuring that all changes are consistent and follow the defined operations.
|
|
114
114
|
|
|
115
|
-
## Powerhouse
|
|
115
|
+
## Powerhouse component library
|
|
116
116
|
|
|
117
117
|
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.
|
|
118
118
|
|
|
119
|
-
### Exploring
|
|
119
|
+
### Exploring components
|
|
120
120
|
You can explore available components, see usage examples, and understand their properties (props) using our Storybook instance:
|
|
121
121
|
[https://storybook.powerhouse.academy](https://storybook.powerhouse.academy)
|
|
122
122
|
|
|
@@ -126,7 +126,7 @@ Storybook allows you to:
|
|
|
126
126
|
* View code snippets for basic implementation.
|
|
127
127
|
* Consult the props table for detailed configuration options.
|
|
128
128
|
|
|
129
|
-
### Using
|
|
129
|
+
### Using components
|
|
130
130
|
1. **Import**: Add an import statement at the top of your editor file:
|
|
131
131
|
```typescript
|
|
132
132
|
import { Checkbox, StringField, Form } from '@powerhousedao/document-engineering/scalars';
|
|
@@ -145,18 +145,18 @@ Storybook allows you to:
|
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
<details>
|
|
148
|
-
<summary>Tutorial: Implementing the `
|
|
148
|
+
<summary>Tutorial: Implementing the `To-do List` Editor</summary>
|
|
149
149
|
|
|
150
|
-
## Build a
|
|
150
|
+
## Build a To-do List editor
|
|
151
151
|
|
|
152
|
-
In this final part of our tutorial we will continue with the interface or editor implementation of the **
|
|
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.
|
|
153
153
|
|
|
154
154
|
## Generate the editor template
|
|
155
155
|
|
|
156
|
-
Run the command below to generate the editor template for the **
|
|
157
|
-
This command reads the **
|
|
156
|
+
Run the command below to generate the editor template for the **To-do List** document model.
|
|
157
|
+
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
158
|
|
|
159
|
-
Notice the `--editor` flag which specifies the **
|
|
159
|
+
Notice the `--editor` flag which specifies the **To-do List** document model, and the `--document-types` flag defines the document type `powerhouse/todolist`.
|
|
160
160
|
|
|
161
161
|
```bash
|
|
162
162
|
ph generate --editor ToDoList --document-types powerhouse/todolist
|
|
@@ -165,7 +165,7 @@ ph generate --editor ToDoList --document-types powerhouse/todolist
|
|
|
165
165
|
Once complete, navigate to the `editors/to-do-list/editor.tsx` file and open it in your editor.
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
### Editor
|
|
168
|
+
### Editor implementation options
|
|
169
169
|
|
|
170
170
|
When building your editor component within the Powerhouse ecosystem, you have several options for styling, allowing you to leverage your preferred methods:
|
|
171
171
|
|
|
@@ -177,13 +177,12 @@ Connect Studio provides a dynamic local environment (`ph connect`) to visualize
|
|
|
177
177
|
|
|
178
178
|
---
|
|
179
179
|
|
|
180
|
-
##
|
|
180
|
+
## To-do List editor
|
|
181
181
|
|
|
182
|
-
:::tip
|
|
183
|
-
### Implementing Components
|
|
182
|
+
:::tip Implementing components
|
|
184
183
|
The editor we are about to implement makes use of some components from **Powerhouse Document Engineering**.
|
|
185
184
|
When you add the editor code, you'll see it makes use of two components, the `Checkbox` and `InputField`.
|
|
186
|
-
These are imported from the Powerhouse Document Engineering design system (`@powerhousedao/document-engineering/scalars`).
|
|
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.
|
|
187
186
|
|
|
188
187
|
This system provides a library of reusable components to ensure consistency and speed up development.
|
|
189
188
|
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.
|
|
@@ -262,7 +261,7 @@ export const InputField = (props: InputFieldProps) => {
|
|
|
262
261
|
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.
|
|
263
262
|
|
|
264
263
|
<details>
|
|
265
|
-
<summary>Complete
|
|
264
|
+
<summary>Complete To-do List Editor Example (using Tailwind CSS)</summary>
|
|
266
265
|
|
|
267
266
|
```typescript
|
|
268
267
|
import { EditorProps } from 'document-model'; // Core type for editor components.
|
|
@@ -273,7 +272,7 @@ import {
|
|
|
273
272
|
ToDoItem, // Type for a single item in the list.
|
|
274
273
|
actions, // Object containing action creators for dispatching changes.
|
|
275
274
|
ToDoListDocument // The complete document structure including state and metadata.
|
|
276
|
-
} from '
|
|
275
|
+
} from '../../document-models/to-do-list/index.js'; // Path to your document model definition.
|
|
277
276
|
import { useState } from 'react'; // React hook for managing component-local state.
|
|
278
277
|
import { Checkbox } from './components/checkbox.js'; // Custom Checkbox component.
|
|
279
278
|
import { InputField } from './components/inputfield.js'; // Custom InputField component.
|
|
@@ -486,23 +485,22 @@ export default function Editor(props: IProps) {
|
|
|
486
485
|
```
|
|
487
486
|
</details>
|
|
488
487
|
|
|
489
|
-
Now you can run the Connect app and see the **
|
|
488
|
+
Now you can run the Connect app and see the **To-do List** editor in action.
|
|
490
489
|
|
|
491
490
|
```bash
|
|
492
491
|
ph connect
|
|
493
492
|
```
|
|
494
493
|
|
|
495
|
-
In Connect, in the bottom right corner you'll find a new Document Model that you can create: **
|
|
496
|
-
Click on it to create a new ToDoList document.
|
|
494
|
+
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.
|
|
497
495
|
|
|
498
|
-
:::
|
|
496
|
+
:::tip Connect as your dynamic development environment
|
|
499
497
|
The editor will update dynamically, so you can play around with your editor styling while seeing your results appear in Connect Studio.
|
|
500
498
|
:::
|
|
501
499
|
|
|
502
500
|
</details>
|
|
503
501
|
|
|
504
502
|
Congratulations!
|
|
505
|
-
If you managed to follow this tutorial until this point, you have successfully implemented the **
|
|
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.
|
|
506
504
|
|
|
507
|
-
Now you can move on to creating a [custom drive explorer](/academy/MasteryTrack/BuildingUserExperiences/BuildingADriveExplorer) for your
|
|
508
|
-
Imagine you have many
|
|
505
|
+
Now you can move on to creating a [custom drive explorer](/academy/MasteryTrack/BuildingUserExperiences/BuildingADriveExplorer) for your To-do List document.
|
|
506
|
+
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!
|