@powerhousedao/academy 2.5.0-dev.25 → 2.5.0-dev.27
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 +8 -0
- package/docs/academy/01-GetStarted/00-ExploreDemoPackage.md +4 -8
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +3 -1
- package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +1 -1
- package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +4 -4
- package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +5 -9
- package/docs/academy/01-GetStarted/home.mdx +1 -9
- package/docs/academy/01-GetStarted/styles.module.css +31 -0
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +7 -3
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +1 -1
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +14 -14
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +70 -2
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +58 -3
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +32 -12
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +103 -38
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +85 -228
- package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +5 -2
- package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +27 -16
- package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +8 -7
- package/package.json +1 -1
- package/sidebars.ts +0 -2
- package/docs/academy/06-ComponentLibrary/04-ScalarVsUIComponents.md +0 -28
- /package/docs/academy/{09-AIResources.md → 09-AIResources} +0 -0
|
@@ -15,19 +15,29 @@ Here are the key points to understand:
|
|
|
15
15
|
- **Custom Scalars:** Besides the built-in scalars, you can define custom scalars (e.g., a Date type) if you need to handle more specific formats or validations. Powerhouse does this specific for the web3 ecosystem.
|
|
16
16
|
:::
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
## Scalars vs. General UI Components
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### Scalar Components
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
2. **Complex Component** has an object/array value
|
|
25
|
-
- Group of components (e.g. sidebar tree view)
|
|
26
|
-
3. **Layout Component** will contain other components
|
|
27
|
-
- Containers for other components, Sections (e.g. list of other components, color layouts, etc.)
|
|
28
|
-
4. **fragments Component**
|
|
22
|
+
Scalars are here to help you define custom fields in your document model schema and speed up the development process.
|
|
23
|
+
There are two applications of scalar components in the document model workflow:
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
1. At the **schema definition** level where you build your schema and write your GraphQL state schema.
|
|
26
|
+
2. At the **frontend / react** level where you import it and place it in your UI to represent the scalar field
|
|
27
|
+
|
|
28
|
+
These are specialized form components, each corresponding to a GraphQL scalar type (e.g., String, Number, Boolean, Currency, PHID). They are built on top of react-hook-form, offering out-of-the-box validation but must be wrapped with a Form component in order to work properly.
|
|
29
|
+
|
|
30
|
+
**Location:** @powerhousedao/document-engineering/scalars
|
|
31
|
+
https://github.com/powerhouse-inc/document-engineering
|
|
32
|
+
|
|
33
|
+
**Key Feature**: Must be used within a Form component provided by this library.
|
|
34
|
+
|
|
35
|
+
### General-Purpose UI Components
|
|
36
|
+
|
|
37
|
+
This category includes a broader range of UI elements such as simplified versions of the Scalar components (which don't require a Form wrapper but lack built-in validation), as well as other versatile components like Dropdown, Tooltip, Sidebar, ObjectSetTable and more. These are designed for crafting diverse and complex user interfaces.
|
|
38
|
+
|
|
39
|
+
**Location:** @powerhousedao/document-engineering/ui
|
|
40
|
+
https://github.com/powerhouse-inc/document-engineering
|
|
31
41
|
|
|
32
42
|
## Exploring Components with Storybook
|
|
33
43
|
|
|
@@ -39,8 +49,15 @@ We use Storybook as an interactive catalog for our design system components. It
|
|
|
39
49
|
2. **Usage Snippet:** Below the demo, you'll typically find a basic code example demonstrating how to include the component in your code (e.g., `<Checkbox defaultValue label="Accept terms and conditions" />`). This provides a starting point for implementation.
|
|
40
50
|
3. **Props Table:** Further down, a table lists the properties (`props`) the component accepts. Props are like settings or configuration options. For the `Checkbox`, this table would show props like `label`, `defaultValue`, `value`, `onChange`, etc., often with descriptions of what they control.
|
|
41
51
|
|
|
52
|
+
## **Storybook vs. Source Code:**
|
|
53
|
+
|
|
54
|
+
Storybook serves as essential documentation and a usage guide. Our developers write Storybook "stories" to demonstrate components and document their common props. However, the **ultimate source of truth** for a component's capabilities is its actual source code (e.g., the `.tsx` file within the `@powerhousedao/document-engineering/scalars` package).
|
|
55
|
+
While Storybook aims for accuracy, there might occasionally be discrepancies or undocumented props.
|
|
56
|
+
|
|
42
57
|
## Implementing a Component
|
|
43
58
|
|
|
59
|
+
@callme-t
|
|
60
|
+
|
|
44
61
|
Let's walk through the typical workflow for using a component from the document-engineering system, using the `Checkbox` from the [To-do List editor](/academy/GetStarted/BuildToDoListEditor).
|
|
45
62
|
|
|
46
63
|
1. **Identify the Need:** While building your feature (e.g., the To-do List editor in `editor.tsx`), you determine the need for a standard UI element, like a checkbox.
|
|
@@ -124,12 +141,6 @@ Within the project, the following import maps are available:
|
|
|
124
141
|
- `#ui` - UI components
|
|
125
142
|
- `#graphql` - GraphQL related utilities
|
|
126
143
|
|
|
127
|
-
|
|
128
|
-
## **Storybook vs. Source Code:**
|
|
129
|
-
|
|
130
|
-
Storybook serves as essential documentation and a usage guide. Our developers write Storybook "stories" to demonstrate components and document their common props. However, the **ultimate source of truth** for a component's capabilities is its actual source code (e.g., the `.tsx` file within the `@powerhousedao/document-engineering/scalars` package).
|
|
131
|
-
While Storybook aims for accuracy, there might occasionally be discrepancies or undocumented props.
|
|
132
|
-
|
|
133
144
|
Please don't hesitate to reach out in our discord channels with any questions.
|
|
134
145
|
Happy designing!
|
|
135
146
|
|
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
This tutorial provides step-by-step instructions for creating custom scalars & components, and to contributing to the document-engineering project.
|
|
4
4
|
The github repo for the Document-Engineering can be found [here](https://github.com/powerhouse-inc/document-engineering/tree/main)
|
|
5
5
|
|
|
6
|
-
:::info
|
|
7
|
-
When contributing as an open source developer please submit a pull request to the Powerhouse team.
|
|
8
|
-
Although a design or UI for your scalar is not mandatory, it definitely helps reviewers if there's a visual reference.
|
|
9
|
-
That said, not all scalars require a dedicated UI component.
|
|
10
|
-
Some scalars, like scalar Title or scalar Description, might both map to a string and use the same UI, in this case scalars plays more semantic role than a type definition.
|
|
11
|
-
:::
|
|
12
|
-
|
|
13
6
|
## Table of Contents
|
|
14
7
|
|
|
15
8
|
- [Creating New GraphQL Scalars](#creating-new-graphql-scalars)
|
|
@@ -393,6 +386,14 @@ export const type = 'string'
|
|
|
393
386
|
export const schema = z.string().datetime()
|
|
394
387
|
```
|
|
395
388
|
|
|
389
|
+
:::info
|
|
390
|
+
**Contributing and UI for Scalars**
|
|
391
|
+
|
|
392
|
+
- **Open Source**: Please submit contributions as a pull request to the Powerhouse team.
|
|
393
|
+
- **UI is Optional but Helpful**: A design or UI for your scalar isn't required, but it helps reviewers understand its purpose.
|
|
394
|
+
- **Semantic Scalars**: Some scalars don't need a unique UI. For instance, `Title` and `Description` might both use a simple text input but serve a semantic role by adding specific meaning and validation to the schema.
|
|
395
|
+
:::
|
|
396
|
+
|
|
396
397
|
### Tips
|
|
397
398
|
|
|
398
399
|
- Always follow the naming convention: use PascalCase for scalar names
|
package/package.json
CHANGED
package/sidebars.ts
CHANGED
|
@@ -122,7 +122,6 @@ const sidebars = {
|
|
|
122
122
|
},
|
|
123
123
|
'academy/ComponentLibrary/CreateCustomScalars',
|
|
124
124
|
'academy/ComponentLibrary/IntegrateIntoAReactComponent',
|
|
125
|
-
'academy/ComponentLibrary/ScalarVsUIComponents',
|
|
126
125
|
],
|
|
127
126
|
},
|
|
128
127
|
|
|
@@ -134,7 +133,6 @@ const sidebars = {
|
|
|
134
133
|
},
|
|
135
134
|
{ type: 'doc', id: 'academy/Cookbook', label: 'Cookbook' },
|
|
136
135
|
{ type: 'doc', id: 'academy/Glossary', label: 'Glossary' },
|
|
137
|
-
{ type: 'doc', id: 'academy/AIResources', label: 'AI Resources' },
|
|
138
136
|
// ...add more as needed
|
|
139
137
|
],
|
|
140
138
|
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Tabs, TabItem } from '@theme/Tabs';
|
|
2
|
-
|
|
3
|
-
# Scalar vs. UI component
|
|
4
|
-
|
|
5
|
-
Scalars are here to help you define custom fields in your document model schema and speed up the development process.
|
|
6
|
-
There are two applications of scalar components in the document model workflow:
|
|
7
|
-
|
|
8
|
-
1. At the **schema definition** level where you build your schema and write your GraphQL state schema.
|
|
9
|
-
2. At the **frontend / react** level where you import it and place it in your UI to represent the scalar field
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
The Document Engineering library provides two main categories of components.
|
|
13
|
-
|
|
14
|
-
https://github.com/powerhouse-inc/document-engineering
|
|
15
|
-
|
|
16
|
-
### Scalar Components
|
|
17
|
-
|
|
18
|
-
These are specialized form components, each corresponding to a GraphQL scalar type (e.g., String, Number, Boolean, Currency, PHID). They are built on top of react-hook-form, offering out-of-the-box validation but must be wrapped with a Form component in order to work properly.
|
|
19
|
-
|
|
20
|
-
Location: @powerhousedao/document-engineering/scalars
|
|
21
|
-
|
|
22
|
-
**Key Feature**: Must be used within a Form component provided by this library.
|
|
23
|
-
|
|
24
|
-
### General-Purpose UI Components
|
|
25
|
-
|
|
26
|
-
This category includes a broader range of UI elements such as simplified versions of the Scalar components (which don't require a Form wrapper but lack built-in validation), as well as other versatile components like Dropdown, Tooltip, Sidebar, ObjectSetTable and more. These are designed for crafting diverse and complex user interfaces.
|
|
27
|
-
|
|
28
|
-
Location: @powerhousedao/document-engineering/ui
|
|
File without changes
|