Skip to content

Commit

Permalink
feat: Loading indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Jan 14, 2020
1 parent bf930b6 commit a463e40
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 68 deletions.
48 changes: 5 additions & 43 deletions examples/react-graphql/client/README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,6 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
# Client

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
```
yarn
yarn start
```
6 changes: 5 additions & 1 deletion examples/react-graphql/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const App: React.FC = () => {
refetchQueries: [{ query: queries.managedIdentitiesQuery }],
})
const { data: managedIdentitiesData } = useQuery(queries.managedIdentitiesQuery)
const { data: serviceMessagesData } = useQuery(queries.serviceMessagesSince, { variables: { ts: [] } })
const {
loading: serviceMessagesLoading,
data: serviceMessagesData,
} = useQuery(queries.serviceMessagesSince, { variables: { ts: [] } })
const [signVc] = useMutation(queries.actionSignVcMutation)
const [sendJwt] = useMutation(queries.actionSendJwtMutation)

Expand Down Expand Up @@ -173,6 +176,7 @@ const App: React.FC = () => {
<Box p={3}>
<Card width={'auto'} mx={'auto'}>
<Heading>Messages</Heading>
{serviceMessagesLoading ? <Loader size="20px" /> : <div style={{ height: '20px' }} />}
<Table>
<thead>
<tr>
Expand Down
1 change: 1 addition & 0 deletions examples/react-graphql/client/src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const actionSendJwtMutation = gql`
export const serviceMessagesSince = gql`
query m($ts: [LastMessageTimestampForInstance]!) {
serviceMessagesSince(ts: $ts) {
id
type
timestamp
data
Expand Down
6 changes: 6 additions & 0 deletions examples/react-graphql/server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Server

```
npm i
npm start
```
48 changes: 24 additions & 24 deletions examples/react-graphql/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a463e40

Please sign in to comment.