Skip to content

Commit 6ef2359

Browse files
authored
feat(delete collections): remove collections from the tool (#1271)
* feat(delete collections): remove collections from the tool - pocket decommission - HNT-1730 - fix lint issues - update README
1 parent f0d30a3 commit 6ef2359

153 files changed

Lines changed: 312 additions & 15181 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.aws/src/config/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const prodDomain = 'readitlater.com';
55
export const isDev = process.env.NODE_ENV === 'development';
66
const environment = isDev ? 'Dev' : 'Prod';
77
const domain = `${domainPrefix}.` + (isDev ? devDomain : prodDomain);
8-
const collectionApiEndpoint =
9-
'https://collection-api.' + (isDev ? devDomain : prodDomain) + '/admin';
108
// We use production client api always,
119
// because the dev one will not have item data and that is all we are going to use it for
1210
const clientApiEndpoint = 'https://client-api.getpocket.com';
@@ -34,7 +32,6 @@ export const config = {
3432
branch,
3533
},
3634
envVars: {
37-
collectionApiEndpoint,
3835
clientApiEndpoint,
3936
oauth2ClientId,
4037
oauth2Provider,

.aws/src/pocketAlbApplication.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ export function createPocketAlbApplication(
7373
name: 'NODE_ENV',
7474
value: process.env.NODE_ENV, // this gives us a nice lowercase production and development
7575
},
76-
{
77-
name: 'REACT_APP_COLLECTION_API_ENDPOINT',
78-
value: config.envVars.collectionApiEndpoint,
79-
},
8076
{
8177
name: 'REACT_APP_CLIENT_API_ENDPOINT',
8278
value: config.envVars.clientApiEndpoint,

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ RUN REACT_APP_ENV=${APP_ENV} npm run build
1212

1313
# production environment
1414
FROM nginx:1.21.6@sha256:2bcabc23b45489fb0885d69a06ba1d648aeda973fae7bb981bafbb884165e514
15-
# Copy collections build into nginx html directory for now,
16-
# collections will be at the root of the server
15+
# Copy app build into nginx html directory
1716
COPY --from=builder /usr/src/app/build /usr/share/nginx/html
1817
COPY --from=builder /usr/src/app/.docker/nginx.conf /etc/nginx/nginx.conf
1918
ENV PORT 80

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
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.
44

55
We also use:
6+
67
- [Material UI](https://mui.com/) for the UI,
78
- [Apollo Client](https://www.apollographql.com/docs/react/) for connecting to the APIs the tools interact with,
89
- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) for unit testing,
@@ -84,24 +85,24 @@ npm run test
8485

8586
- 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.
8687

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-
8988
- `src/curated-corpus` houses the Curated Corpus Tool.
9089

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):
9293

9394
```bash
94-
collections/
95+
curated-corpus/
9596
├─ components/
9697
├─ pages/
9798
├─ utils/
9899
```
99100

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`.
101102

102103
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.
103104

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)
105106

106107
## Working with the Admin API
107108

@@ -116,12 +117,13 @@ The generated types and custom hooks are saved in a file named `generatedTypes.t
116117

117118
Now that the generated code is ready to use, you can:
118119

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`.
121122

122123
## Troubleshooting
124+
123125
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:
124-
```shell
125-
nvm install
126-
nvm use
127-
```
126+
```shell
127+
nvm install
128+
nvm use
129+
```

0 commit comments

Comments
 (0)