You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
This repository is home to a suite of internal tools for Pocket curators developed with React and TypeScript. With React, we use functional components and hooks throughout.
4
4
5
5
We also use:
6
+
6
7
-[Material UI](https://mui.com/) for the UI,
7
8
-[Apollo Client](https://www.apollographql.com/docs/react/) for connecting to the APIs the tools interact with,
8
9
-[React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) for unit testing,
@@ -84,24 +85,24 @@ npm run test
84
85
85
86
- The `src/api` folder contains GraphQL queries and mutations the app needs to execute to retrieve and manipulate data, as well as generated types for these and the Apollo Client connection.
86
87
87
-
-`src/collections` is the home for Collections Admin Tool that lets Pocket curators create, edit and publish collections of stories for Pocket users.
88
-
89
88
-`src/curated-corpus` houses the Curated Corpus Tool.
90
89
91
-
Within the folder for each tool, the structure is as follows (taking Collections as an example):
90
+
-`src/moderation` DEPRECATED home of moderation of a legacy Pocket feature
91
+
92
+
Within the folder for each tool, the structure is as follows (taking Curated Corpus as an example):
92
93
93
94
```bash
94
-
collections/
95
+
curated-corpus/
95
96
├─ components/
96
97
├─ pages/
97
98
├─ utils/
98
99
```
99
100
100
-
The `components` folder houses any components specific to that particular tool, for example, `CollectionListCard`. The `pages` folder is home to page-level components, i.e. `AddCollectionPage`.
101
+
The `components` folder houses any components specific to that particular tool, for example, `ApprovedItemListCard`. The `pages` folder is home to page-level components, i.e. `CorpusItemPage`.
101
102
102
103
All components are functional React components. Each component lives in its own folder. Unit tests, styles, validation schemas (for form components) are placed in separate files alongside each component.
103
104
104
-
Routing within the app is set up with React Router. The entrypoint to the app, [App.tsx](/src/App.tsx), sets up all requests to be routed to specific paths within the apps - `/collections` for Collections and `/prospects` for the Prospecting tool, for example. More detailed routing, for example, individual collection pages, is set up within the landing page - see [this example for Collections](/src/collections/pages/CollectionsLandingPage/CollectionsLandingPage.tsx)
105
+
Routing within the app is set up with React Router. The entrypoint to the app, [App.tsx](/src/App.tsx), sets up all requests to be routed to specific paths within the apps - `/prospects` for the Prospecting tool, for example. More detailed routing, for example, individual curated corpus pages, is set up within the landing page - see [this example for Curated Corpus](/src/curated-corpus/pages/CuratedCorpusLandingPage/CuratedCorpusLandingPage.tsx)
105
106
106
107
## Working with the Admin API
107
108
@@ -116,12 +117,13 @@ The generated types and custom hooks are saved in a file named `generatedTypes.t
116
117
117
118
Now that the generated code is ready to use, you can:
118
119
119
-
- Use the generated types elsewhere in the code to type hint the shape of the returned data or data that is expected by components in the app, for example, `Collection` or `CollectionAuthor`.
120
-
- Use strongly typed custom Apollo hooks to fetch and manipulate data. Apollo Client has generic `useQuery`, `useLazyQuery`, `useMutation` and `useSubscription` hooks. GraphQL Code Generator builds on that by providing hooks that are specific to the queries and mutations you need to run, for example, `useGetCollectionByExternalIdQuery`.
120
+
- Use the generated types elsewhere in the code to type hint the shape of the returned data or data that is expected by components in the app, for example, `ApprovedCorpusItem` or `CorpusLanguage`.
121
+
- Use strongly typed custom Apollo hooks to fetch and manipulate data. Apollo Client has generic `useQuery`, `useLazyQuery`, `useMutation` and `useSubscription` hooks. GraphQL Code Generator builds on that by providing hooks that are specific to the queries and mutations you need to run, for example, `useGetSectionsWithSectionItemsQuery`.
121
122
122
123
## Troubleshooting
124
+
123
125
1. If you receive an error similar to the following `error:xyz:digital envelope routines`, make sure you are using the correct Node version. Run `nvm use` in the project root to switch to the version specified in `.nvmrc` (currently Node 18). If you don't have it installed:
0 commit comments