Skip to content

Commit

Permalink
Create project skeleton, add navbar, router, and redux, start of conf…
Browse files Browse the repository at this point in the history
…ig page
  • Loading branch information
eliasmpw committed Sep 11, 2021
1 parent 1c5bb7c commit 2a440a7
Show file tree
Hide file tree
Showing 47 changed files with 13,838 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {}
}
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.vscode
23 changes: 23 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.vscode
Empty file added .prettierrc.json
Empty file.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
# parachain-utilities
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

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

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
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.\
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.\
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/).
1 change: 1 addition & 0 deletions antd.customize.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@primary-color: #e6007a;
5 changes: 5 additions & 0 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const CracoAntDesignPlugin = require("craco-antd");

module.exports = {
plugins: [{ plugin: CracoAntDesignPlugin }],
};
67 changes: 67 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "parachain-utilities",
"version": "0.1.0",
"private": true,
"dependencies": {
"@ant-design/icons": "^4.6.4",
"@craco/craco": "^6.3.0",
"@polkadot/api": "^5.8.3",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"antd": "^4.16.13",
"craco-antd": "^1.19.0",
"moment": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.5",
"react-router-dom": "^5.3.0",
"react-scripts": "4.0.3",
"redux": "^4.1.1",
"redux-thunk": "^2.3.0",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1",
"webfontloader": "^1.6.28"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject",
"eslint": "eslint {public,src}/**/*.{js,jsx,ts,tsx}",
"prettier": "prettier --check {public,src}/**/*.{js,jsx,ts,tsx,htm,html,json,xml,yml,css,scss,sass,less,webmanifest,svg}",
"prettier:fix": "prettier --write {public,src}/**/*.{js,jsx,ts,tsx,htm,html,json,xml,yml,css,scss,sass,less,webmanifest,svg}"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/react-router-dom": "^5.1.8",
"@types/webfontloader": "^1.6.33",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.25.1",
"prettier": "^2.4.0"
}
}
Binary file added public/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file added public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
33 changes: 33 additions & 0 deletions src/App.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@import "~antd/dist/antd.less";
@import "styles/variables.less";

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Work Sans", "Segoe UI",
"Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
"Helvetica Neue", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}

.app-layout {
min-height: 100vh;
}

.app-content {
min-height: 100%;
}

.app-footer {
text-align: center;
font-style: italic;
}

.app-content {
margin-top: 64px;
}
9 changes: 9 additions & 0 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
38 changes: 38 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';
import { Layout, Spin } from "antd";
import { BrowserRouter, Switch, Route, Redirect } from "react-router-dom";
import NavbarComponent from './components/Navbar';
import './App.less';
import CustomSpinner from './components/CustomSpinner';
import AddressBook from './components/AddressBook';
import Configuration from './components/Configuration';
import AverageBlockTime from './components/AverageBlockTime';
import BlockTime from './components/BlockTime';
import BlockAuthor from './components/BlockAuthor';
import { useAppSelector } from './store/hooks';

function App(): React.ReactElement {
const isLoading = useAppSelector((state) => state.address.isLoading);

return (
<BrowserRouter>
<Spin spinning={isLoading} indicator={CustomSpinner}>
<Layout className="app-layout">
<NavbarComponent />
<Layout.Content className="app-content">
<Switch>
<Route exact path="/address-book" component={AddressBook} />
<Route exact path="/average-block-time" component={AverageBlockTime} />
<Route exact path="/block-time" component={BlockTime} />
<Route exact path="/block-author" component={BlockAuthor} />
<Route exact path="/config" component={Configuration} />
<Redirect to="/address-book"/>
</Switch>
</Layout.Content>
</Layout>
</Spin>
</BrowserRouter>
);
}

export default App;
3 changes: 3 additions & 0 deletions src/components/AddressBook.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.address-book-container {
padding: 25px;
}
8 changes: 8 additions & 0 deletions src/components/AddressBook.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react"
import "./AddressBook.less"

const AddressBook = function NavbarComponent(): React.ReactElement {
return <div className='address-book-container'>Placeholder AddressBook</div>
}

export default AddressBook
3 changes: 3 additions & 0 deletions src/components/AverageBlockTime.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.average-block-time-container {
padding: 25px;
}
8 changes: 8 additions & 0 deletions src/components/AverageBlockTime.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react"
import "./AverageBlockTime.less"

const AverageBlockTime = function NavbarComponent(): React.ReactElement {
return <div className='address-book-container'>Placeholder AverageBlockTime</div>
}

export default AverageBlockTime
3 changes: 3 additions & 0 deletions src/components/BlockAuthor.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.block-author-container {
padding: 25px;
}
8 changes: 8 additions & 0 deletions src/components/BlockAuthor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react"
import "./BlockAuthor.less"

const BlockAuthor = function NavbarComponent(): React.ReactElement {
return <div className='address-book-container'>Placeholder BlockAuthor</div>
}

export default BlockAuthor
Loading

0 comments on commit 2a440a7

Please sign in to comment.