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

Commit

Permalink
Merge pull request #55 from paritytech/w3f-deploy-1.1
Browse files Browse the repository at this point in the history
v1.1
  • Loading branch information
miabarbir authored Oct 30, 2023
2 parents 0bdff11 + 502a7c4 commit 3148991
Show file tree
Hide file tree
Showing 357 changed files with 7,496 additions and 7,062 deletions.
63 changes: 30 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
# Contribution Guide

## Introduction

This section aims to familiarise developers to the Polkadot Staking Dashboard [[GitHub](https://github.com/paritytech/polkadot-staking-dashboard), [Demo](https://paritytech.github.io/polkadot-staking-dashboard/#/overview)] for the purpose of contributing to the project.

Reach out to [email protected] for clarification of any content within this document.

## Submitting Pull Requests

This project follows the Conventional Commits specification. Pull requests are merged and squashed, with the pull request title being used as the commit message. Commit messages should adhere to the following structure:

```
<type>(<scope>): <summary>
```

Some example PR titles:

- `feat: implement help overlay`
- `feat(auth): implement login API`
- `fix(button): resolve issue with button alignment`
- `docs(readme): add installation section`
- `chore(tests): refactor user tests`

The `(scope)` could be anything specifying the place of the commit change. For example, api, app, cli, etc.

If you would like to know more about the Conventional Commits specification, please visit the [Conventional Commits website](https://www.conventionalcommits.org/).

## Releases

[Release Please](https://github.com/googleapis/release-please) is used for automating staking dashboard's changelog and release generation.

Release Please is a GitHub action maintained by Google that automates CHANGELOG generation, the creation of GitHub releases, and version bumps. [[Gtihub docs](https://github.com/googleapis/release-please), [Action](https://github.com/marketplace/actions/release-please-action)]

## Major Packages Used

- React 18
Expand All @@ -17,18 +41,9 @@ Reach out to [email protected] for clarification of any content within this documen

## Environment Variables

Optionally apply the following envrionment variables in an environment file such as `.env` or with `yarn build` to customise the build of staking dashboard:

```
# disable all mentioning of fiat values and token prices
VITE_DISABLE_FIAT=1
# display an organisation label in the network bar
VITE_ORGANISATION="© Parity Technologies"
Optionally apply envrionment variables in an environment file such as `.env` or with `yarn build` to customise the build of staking dashboard.

# provide a privacy policy url in the network bar
VITE_PRIVACY_URL=https://www.parity.io/privacy/
```
Refer to the [`.env`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/.env) file in the root of the repository for all supported variables.

## Config Files

Expand All @@ -47,7 +62,6 @@ Folders are structured in the [`src/`](https://github.com/paritytech/polkadot-st
- [`library`](https://github.com/paritytech/polkadot-staking-dashboard/tree/main/src/library): reusable components that could eventually be abstracted into a separate UI library.
- [`modals`](https://github.com/paritytech/polkadot-staking-dashboard/tree/main/src/modals): the various modal pop-ups used in the app.
- [`pages`](https://github.com/paritytech/polkadot-staking-dashboard/tree/main/src/pages): similar to modals, page components and components that comprise pages.
- [`theme`](https://github.com/paritytech/polkadot-staking-dashboard/tree/main/src/theme): the theming configuration of the app.
- [`workers`](https://github.com/paritytech/polkadot-staking-dashboard/tree/main/src/workers): web workers that crunch process-heavy scripts. Only one exists right now, that iterates `erasStakers` and calculates active nominators and minimum nomination bond.

## App Entry
Expand All @@ -57,12 +71,7 @@ Going from the top-most component, the component hierarchy is set up as follows:
- [`index.tsx`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/index.tsx): DOM render, of little interest.
- [`App.tsx`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/App.tsx): wraps `<App />` in the theme provider context and determines the active network from local storage.
- [`Providers.tsx`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/Providers.tsx): imports and wraps `<Router />` with all the contexts using a withProviders hook. We also wrap styled component's theme provider context here to make the theme configuration work.
- [`Router.tsx`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/Router.tsx): contains react router `<Route>`'s, in addition to the major app presentational components. Beyond `<Route>` components, this file is also the entry point for the following components:
- `<Modal />`: top-level of the modal.
- `<Help />`: top-level of the help module.
- `<Headers />`: fixed header of the app containing the stash / controller and accounts toggle buttons.
- `<NetworkBar />`: fixed network bar at the bottom of the app.
- `<Notifications />`: smaller context-based popups. Currently used on click-to-copy, or to display extrinsic status (pending, success).
- [`Router.tsx`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/Router.tsx): contains react router `<Route>`'s, in addition to the major app presentational components.

## Development Patterns

Expand All @@ -78,16 +87,4 @@ Documenting some of the development patterns used:

The majority of components have types. Type additions are welcome for data that makes sense to type (e.g. data that is unlikely to change as we continue development).

We develop in strict mode, so types are always required for objects. Use any initially to adhere to this requirement.

## Testing Support State

**Tests have not yet been developed.**

Testing could be initialised on a per-component basis, such as isolating library components and testing them within a storybook environment.

Integration tests make sense for the app itself, ensuring the page layout, help module, and modals display the correct content at various app states. These states currently persist of:

- Connecting to the network, fetching from API, fully synced.
- Actively staking, not actively staking.
- Account connected, no account connected.
Strict mode is used in development, so types are always required for objects.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

The Polkadot Staking Dashboard is a community-driven project, and we welcome contributions to bolster the dashboard's functionality and features.

- **Web Extensions**: Submit PR to the [Polkadot Cloud repository](https://github.com/paritytech/polkadot-cloud/tree/main/packages/community#adding-web-extension-wallets) to add a web extension. The extension will then be available in the `@polkadot-cloud/community` NPM package. Full instructions can be found [here](https://github.com/paritytech/polkadot-cloud/tree/main/packages/community#adding-web-extension-wallets).
- **Web Extensions**: Submit PR to the [Polkadot Cloud repository](https://github.com/paritytech/polkadot-cloud/tree/main/packages/assets#adding-web-extension-wallets) to add a web extension. The extension will then be available in the `@polkadot-cloud/assets` NPM package. Full instructions can be found [here](https://github.com/paritytech/polkadot-cloud/tree/main/packages/assets#adding-web-extension-wallets).

- **Validator Operators**: Submit PR to the [Polkadot Cloud repository](https://github.com/paritytech/polkadot-cloud/tree/main/packages/community#adding-validator-operators) to add a validator operator. The operator will then be available in the `@polkadot-cloud/community` NPM package. Full instructions can be found [here](https://github.com/paritytech/polkadot-cloud/tree/main/packages/community#adding-validator-operators).
- **Validator Operators**: Submit PR to the [Polkadot Cloud repository](https://github.com/paritytech/polkadot-cloud/tree/main/packages/assets#adding-validator-operators) to add a validator operator. The operator will then be available in the `@polkadot-cloud/assets` NPM package. Full instructions can be found [here](https://github.com/paritytech/polkadot-cloud/tree/main/packages/assets#adding-validator-operators).

## URL Variable Support

Expand Down
67 changes: 35 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,80 +21,83 @@
"visualizer": "vite-bundle-visualizer"
},
"dependencies": {
"@dotlottie/player-component": "^2.5.4",
"@dotlottie/player-component": "^2.7.0",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@ledgerhq/hw-transport-webhid": "^6.27.19",
"@polkadot-cloud/community": "0.1.11",
"@polkadot-cloud/core": "^0.1.29",
"@polkadot-cloud/react": "0.1.47",
"@polkadot-cloud/utils": "^0.0.11",
"@polkadot/api": "^10.9.1",
"@polkadot-cloud/assets": "^0.1.32",
"@polkadot-cloud/core": "^1.0.30",
"@polkadot-cloud/react": "^0.1.101",
"@polkadot-cloud/utils": "^0.0.23",
"@polkadot/api": "^10.10.1",
"@polkadot/keyring": "^12.1.1",
"@polkadot/rpc-provider": "^10.9.1",
"@polkadot/util": "^12.4.2",
"@polkadot/util-crypto": "12.4.2",
"@substrate/connect": "^0.7.31",
"@zondax/ledger-substrate": "^0.41.2",
"@polkadot/util-crypto": "12.5.1",
"@polkawatch/ddp-client": "^2.0.8",
"@substrate/connect": "^0.7.34",
"@zondax/ledger-substrate": "^0.41.3",
"bignumber.js": "^9.1.2",
"bn.js": "^5.2.1",
"buffer": "^6.0.3",
"chart.js": "^4.4.0",
"chroma-js": "^2.4.2",
"date-fns": "^2.29.3",
"framer-motion": "^10.16.3",
"i18next": "^23.5.1",
"i18next": "^23.6.0",
"i18next-browser-languagedetector": "^7.1.0",
"lodash.throttle": "^4.1.1",
"qrcode-generator": "1.4.4",
"rc-slider": "^10.2.1",
"rc-slider": "^10.3.1",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.11",
"react-helmet": "^6.1.0",
"react-i18next": "^13.2.2",
"react-i18next": "^13.3.1",
"react-qr-reader": "^2.2.1",
"react-router-dom": "^6.16.0",
"react-scroll": "^1.8.9",
"styled-components": "^6.0.8"
"react-router-dom": "^6.17.0",
"react-scroll": "^1.9.0",
"styled-components": "^6.1.0"
},
"devDependencies": {
"@ledgerhq/logs": "^6.10.1",
"@types/chroma-js": "^2.4.0",
"@types/lodash.throttle": "^4.1.7",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react-helmet": "^6.1.6",
"@types/react-qr-reader": "^2.1.4",
"@types/react-scroll": "^1.8.6",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"@vitejs/plugin-react-swc": "^3.3.2",
"eslint": "^8.49.0",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"@types/react-helmet": "^6.1.8",
"@types/react-qr-reader": "^2.1.6",
"@types/react-scroll": "^1.8.9",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@vitejs/plugin-react-swc": "^3.4.0",
"eslint": "^8.52.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-import": "^2.28.1",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prefer-arrow-functions": "^3.1.4",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-prefer-arrow-functions": "^3.2.4",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-unused-imports": "^3.0.0",
"gh-pages": "^6.0.0",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.3",
"sass": "^1.66.1",
"sass": "^1.69.5",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite": "^4.4.11",
"vite-bundle-visualizer": "^0.10.0",
"vite-plugin-checker": "^0.6.2",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-svgr": "^3.2.0",
"vite-plugin-svgr": "^4.1.0",
"vite-tsconfig-paths": "^4.2.1",
"vitest": "^0.34.4"
"vitest": "^0.34.5"
}
}
8 changes: 7 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { DefaultNetwork } from 'consts';
import { ThemesProvider } from 'contexts/Themes';
import { i18next } from 'locale';
import { Providers } from 'Providers';
import { NetworkProvider } from 'contexts/Network';
import { ActiveAccountsProvider } from 'contexts/ActiveAccounts';

export const App: React.FC = () => {
let network = localStorage.getItem('network');
Expand All @@ -19,7 +21,11 @@ export const App: React.FC = () => {
return (
<I18nextProvider i18n={i18next}>
<ThemesProvider>
<Providers />
<NetworkProvider>
<ActiveAccountsProvider>
<Providers />
</ActiveAccountsProvider>
</NetworkProvider>
</ThemesProvider>
</I18nextProvider>
);
Expand Down
Loading

0 comments on commit 3148991

Please sign in to comment.