Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit afd90b8

Browse files
working initial UI, no GraphQL
0 parents  commit afd90b8

20 files changed

+13616
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Discuss clone in Dgraph GraphQL
2+
3+
This app is intended to show off Dgraph quick start, and integration with Auth0.
4+
5+
# Running
6+
7+
To run, you just need to
8+
9+
```
10+
yarn install
11+
yarn start
12+
```
13+
14+
# How it was built
15+
16+
There's a blog about building this app (FIXME: insert link)
17+
18+
Basic setup:
19+
20+
```
21+
npx create-react-app discuss-clone --template typescript
22+
23+
yarn add graphql @apollo/client react-router-dom
24+
25+
yarn add -D @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typescript-react-apollo @graphql-codegen/add @graphql-codegen/near-operation-file-preset
26+
27+
yarn add -D @types/react-router-dom
28+
```

package.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "discuss-clone",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@apollo/client": "^3.0.0-rc.6",
7+
"@testing-library/jest-dom": "^4.2.4",
8+
"@testing-library/react": "^9.3.2",
9+
"@testing-library/user-event": "^7.1.2",
10+
"@types/jest": "^24.0.0",
11+
"@types/node": "^12.0.0",
12+
"@types/react": "^16.9.0",
13+
"@types/react-dom": "^16.9.0",
14+
"graphql": "^15.1.0",
15+
"react": "^16.9.0",
16+
"react-dom": "^16.9.0",
17+
"react-router-dom": "^5.2.0",
18+
"react-scripts": "3.4.1",
19+
"semantic-ui-css": "^2.4.1",
20+
"semantic-ui-react": "^0.88.2",
21+
"typescript": "~3.7.2"
22+
},
23+
"scripts": {
24+
"start": "react-scripts start",
25+
"build": "react-scripts build",
26+
"test": "react-scripts test",
27+
"eject": "react-scripts eject",
28+
"generate-types": "graphql-codegen --config codegen.yml"
29+
},
30+
"eslintConfig": {
31+
"extends": "react-app"
32+
},
33+
"browserslist": {
34+
"production": [
35+
">0.2%",
36+
"not dead",
37+
"not op_mini all"
38+
],
39+
"development": [
40+
"last 1 chrome version",
41+
"last 1 firefox version",
42+
"last 1 safari version"
43+
]
44+
},
45+
"devDependencies": {
46+
"@graphql-codegen/add": "^1.15.4",
47+
"@graphql-codegen/cli": "^1.15.4",
48+
"@graphql-codegen/near-operation-file-preset": "^1.15.4",
49+
"@graphql-codegen/typescript": "^1.15.4",
50+
"@graphql-codegen/typescript-operations": "^1.15.4",
51+
"@graphql-codegen/typescript-react-apollo": "^1.15.4",
52+
"@types/react-router-dom": "^5.1.5"
53+
}
54+
}

public/diggy.png

549 KB
Loading

public/index.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>Dgraph Discuss</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
43+
</html>

public/manifest.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "Dgraph Discuss",
3+
"name": "Discuss clone build with Dgraph GraphQL",
4+
"icons": [
5+
{
6+
"src": "diggy.png",
7+
"type": "image/png",
8+
"sizes": "64x64 32x32 24x24 16x16"
9+
}
10+
],
11+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

public/robots.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:

src/App.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.App {
2+
text-align: center;
3+
}
4+
5+
.App-logo {
6+
height: 40vmin;
7+
pointer-events: none;
8+
}
9+
10+
@media (prefers-reduced-motion: no-preference) {
11+
.App-logo {
12+
animation: App-logo-spin infinite 20s linear;
13+
}
14+
}
15+
16+
.App-header {
17+
background-color: #282c34;
18+
min-height: 100vh;
19+
display: flex;
20+
flex-direction: column;
21+
align-items: center;
22+
justify-content: center;
23+
font-size: calc(10px + 2vmin);
24+
color: white;
25+
}
26+
27+
.App-link {
28+
color: #61dafb;
29+
}
30+
31+
@keyframes App-logo-spin {
32+
from {
33+
transform: rotate(0deg);
34+
}
35+
to {
36+
transform: rotate(360deg);
37+
}
38+
}

src/App.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import { render } from '@testing-library/react';
3+
import App from './App';
4+
5+
test('renders learn react link', () => {
6+
const { getByText } = render(<App />);
7+
const linkElement = getByText(/learn react/i);
8+
expect(linkElement).toBeInTheDocument();
9+
});

src/App.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
import logo from './logo.svg';
3+
import './App.css';
4+
import { Home } from './components';
5+
6+
export function App() {
7+
return (
8+
<div className="App">
9+
{Home()}
10+
</div>
11+
);
12+
}

src/components/header.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react"
2+
import { Container, Image, Menu, Icon } from "semantic-ui-react"
3+
4+
export function AppHeader() {
5+
return (
6+
<Menu fixed="top">
7+
<Container>
8+
<Menu.Item as="a" header>
9+
<Image
10+
size="tiny"
11+
src="/diggy.png"
12+
style={{ marginRight: "1.5em" }}
13+
/>
14+
Dgraph Discuss
15+
</Menu.Item>
16+
<Menu.Item as="a">
17+
<Icon name="home" />
18+
Home
19+
</Menu.Item>
20+
</Container>
21+
</Menu>
22+
)
23+
}

0 commit comments

Comments
 (0)