From fe185100b4099917dfd2e0aa79b29b4830fd3a04 Mon Sep 17 00:00:00 2001 From: Thomas McDonald Date: Fri, 8 Dec 2023 12:50:28 -0700 Subject: [PATCH 01/82] new repo for this image (#35) --- creditcoin-staking-dashboard-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creditcoin-staking-dashboard-ci.yml b/creditcoin-staking-dashboard-ci.yml index 5eb81ffbd..1027ea855 100644 --- a/creditcoin-staking-dashboard-ci.yml +++ b/creditcoin-staking-dashboard-ci.yml @@ -32,7 +32,7 @@ jobs: displayName: 'Build Docker Image' inputs: containerRegistry: 'substrate-relayer' - repository: 'gluwa/staking-dashboard' + repository: 'gluwa/cc3-staking-dashboard' command: 'buildAndPush' Dockerfile: '**/Dockerfile' tags: | From 6a7ed92e7f3c0bf4269f2db1db2ebab9f4979ef6 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Fri, 8 Dec 2023 21:15:12 +0200 Subject: [PATCH 02/82] Make an ephemeral deployment of Staking Dashboard from the current PR NOTES: - removing execution of this job from main/dev branches because we're not building docker images automatically from them --- .github/workflows/docker.yml | 54 ++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index aeea32f0f..72b562f7a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,13 +1,13 @@ name: Docker on: - push: - branches: [main, dev] pull_request: branches: [main, dev] jobs: build: + permissions: + pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -15,3 +15,53 @@ jobs: - name: Build docker image run: | docker build -t gluwa/creditcoin3-staking-dashboard . + + - name: Extract application from docker image + run: | + docker images + + docker run -d --rm --name ephemeral-container gluwa/creditcoin3-staking-dashboard + sleep 10 + + mkdir ./build/ + docker cp ephemeral-container:/usr/share/nginx/html ./build/ + docker kill ephemeral-container + + - name: Install Azure cli tools + run: | + # https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#option-1-install-with-one-command + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + + - name: Azure login + if: env.GITHUB_TOKEN + env: + GITHUB_TOKEN: ${{ secrets.CREDITCOIN_GITHUB_API_TOKEN }} + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + allow-no-subscriptions: true + + - name: Upload application to Azure Storage + id: upload + if: env.GITHUB_TOKEN + env: + GITHUB_TOKEN: ${{ secrets.CREDITCOIN_GITHUB_API_TOKEN }} + run: | + AZURE_STORAGE_KEY=${{ secrets.LLVM_AZURE_STORAGE_KEY }} + export AZURE_STORAGE_KEY + PR_NUMBER=$(echo "$GITHUB_REF" | sed "s|refs/pull/||" | sed "s|/merge||") + DESTINATION_PATH="cc3-staking-dashboard/PR-$PR_NUMBER" + export DESTINATION_PATH + + az storage blob upload-batch --account-name staticsitellvmhtml --auth-mode key -d "\$web" --destination-path "$DESTINATION_PATH" --overwrite -s ./build/ + + echo "message=**[Staking Dashboad Preview](https://staticsitellvmhtml.z13.web.core.windows.net/$DESTINATION_PATH/html/)!**" >> "$GITHUB_OUTPUT" + + - name: Post comment to PR + if: env.GITHUB_TOKEN + uses: mshick/add-pr-comment@v2 + env: + GITHUB_TOKEN: ${{ secrets.CREDITCOIN_GITHUB_API_TOKEN }} + with: + message: ${{ steps.upload.outputs.message }} + allow-repeats: false From b22073de87cb0bb0f69e916ee8dd0c755fe0280b Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Tue, 12 Dec 2023 18:40:36 +0200 Subject: [PATCH 03/82] Use relative paths for the PR preview build --- .github/workflows/docker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 72b562f7a..1ec03bbf7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,6 +12,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Tweak build configuration + if: github.base_ref == 'dev' + run: | + # Use relative paths for the PR preview build + sed -i "s|vite build --base '/'|vite build --base './'|" package.json + - name: Build docker image run: | docker build -t gluwa/creditcoin3-staking-dashboard . From 96cd84091aef752973c84a5b8388d9993d6384da Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Tue, 12 Dec 2023 20:25:43 +0200 Subject: [PATCH 04/82] Use 'development' mode for the PR preview build which activates the CreditcoinLocal network in the menu, which in turn enables testing the PR preview build with a locally running creditcoin3-node --- .github/workflows/docker.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1ec03bbf7..14a0c9be7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,6 +18,10 @@ jobs: # Use relative paths for the PR preview build sed -i "s|vite build --base '/'|vite build --base './'|" package.json + # Specify development mode which activates the CreditcoinLocal network in the menu, + # which in turn enables testing the PR preview build with a locally running creditcoin3-node + sed -i "s|vite build|vite build --mode development|" package.json + - name: Build docker image run: | docker build -t gluwa/creditcoin3-staking-dashboard . From b3785a5d71b5eb55f361230c558acfa9ce7b1162 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Tue, 12 Dec 2023 20:29:11 +0200 Subject: [PATCH 05/82] Update wording on Staking Dashboard Preview comment in order to make it more explicit that the preview build can be used for early testing as well. --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 14a0c9be7..9d45dd5a6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -65,7 +65,7 @@ jobs: az storage blob upload-batch --account-name staticsitellvmhtml --auth-mode key -d "\$web" --destination-path "$DESTINATION_PATH" --overwrite -s ./build/ - echo "message=**[Staking Dashboad Preview](https://staticsitellvmhtml.z13.web.core.windows.net/$DESTINATION_PATH/html/)!**" >> "$GITHUB_OUTPUT" + echo "message=**Test before merge -> [Staking Dashboad Preview](https://staticsitellvmhtml.z13.web.core.windows.net/$DESTINATION_PATH/html/)!**" >> "$GITHUB_OUTPUT" - name: Post comment to PR if: env.GITHUB_TOKEN From 58bb5ce8797470390762dbf9d3d1fe385359ef24 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Tue, 12 Dec 2023 20:35:46 +0200 Subject: [PATCH 06/82] Execute this workflow on dev/main branches again b/c we still want to see the sanity docker build (and whetever sanity tests we may add in the future) succeeding after a PR has been merged. Conditionally skip preview builds and uploads to Azure because they are valid only in the context of a pull request! --- .github/workflows/docker.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9d45dd5a6..c95fb2c0e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,6 +1,8 @@ name: Docker on: + push: + branches: [main, dev] pull_request: branches: [main, dev] @@ -13,7 +15,7 @@ jobs: - uses: actions/checkout@v4 - name: Tweak build configuration - if: github.base_ref == 'dev' + if: ${{ github.event_name == 'pull_request' && github.base_ref == 'dev' }} run: | # Use relative paths for the PR preview build sed -i "s|vite build --base '/'|vite build --base './'|" package.json @@ -26,7 +28,8 @@ jobs: run: | docker build -t gluwa/creditcoin3-staking-dashboard . - - name: Extract application from docker image + - name: Extract application files from docker image + if: ${{ github.event_name == 'pull_request' }} run: | docker images @@ -38,12 +41,13 @@ jobs: docker kill ephemeral-container - name: Install Azure cli tools + if: ${{ github.event_name == 'pull_request' }} run: | # https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#option-1-install-with-one-command curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash - name: Azure login - if: env.GITHUB_TOKEN + if: ${{ github.event_name == 'pull_request' && env.GITHUB_TOKEN }} env: GITHUB_TOKEN: ${{ secrets.CREDITCOIN_GITHUB_API_TOKEN }} uses: azure/login@v1 @@ -51,9 +55,9 @@ jobs: creds: ${{ secrets.AZURE_CREDENTIALS }} allow-no-subscriptions: true - - name: Upload application to Azure Storage + - name: Upload application files to Azure Storage id: upload - if: env.GITHUB_TOKEN + if: ${{ github.event_name == 'pull_request' && env.GITHUB_TOKEN }} env: GITHUB_TOKEN: ${{ secrets.CREDITCOIN_GITHUB_API_TOKEN }} run: | @@ -68,7 +72,7 @@ jobs: echo "message=**Test before merge -> [Staking Dashboad Preview](https://staticsitellvmhtml.z13.web.core.windows.net/$DESTINATION_PATH/html/)!**" >> "$GITHUB_OUTPUT" - name: Post comment to PR - if: env.GITHUB_TOKEN + if: ${{ github.event_name == 'pull_request' && env.GITHUB_TOKEN }} uses: mshick/add-pr-comment@v2 env: GITHUB_TOKEN: ${{ secrets.CREDITCOIN_GITHUB_API_TOKEN }} From eb7a013b345f1d385113849ad95ab8742badb826 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Tue, 12 Dec 2023 20:40:58 +0200 Subject: [PATCH 07/82] Split preview build configuration into separate steps because I want to adjust the conditionals later --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c95fb2c0e..6da149014 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,12 +14,15 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Tweak build configuration + - name: Preview build configuration - Use relative paths if: ${{ github.event_name == 'pull_request' && github.base_ref == 'dev' }} run: | # Use relative paths for the PR preview build sed -i "s|vite build --base '/'|vite build --base './'|" package.json + - name: Preview build configuration - Use 'development' mode + if: ${{ github.event_name == 'pull_request' && github.base_ref == 'dev' }} + run: | # Specify development mode which activates the CreditcoinLocal network in the menu, # which in turn enables testing the PR preview build with a locally running creditcoin3-node sed -i "s|vite build|vite build --mode development|" package.json From b0b532b24d362d809bb499ca77d6256ba22a71b2 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Tue, 12 Dec 2023 20:43:21 +0200 Subject: [PATCH 08/82] Update conditions for dev/main branches and preview build config for PRs against `main` we still want to have the preview functionality. however a "development" build is not the same as a "production" build so we don't want to take the risk and do that! To elaborate, "the risk" is that we build a development preview build, maybe test it directly from the PR preview URL, instead of building it locally and then declaring it PASS, while in reality a production build may be failing! IMO the above mentioned risk is extremely small in practice, however in theory it isn't zero! This change renders the PR preview build impossible to connect to the CreditcoinLocal network which eliminates the risk of testing one thing but shipping another! The inconvenience is that any testing on PRs against `main` branch will require also testing against Devnet (or Testnet, or Mainnet)! --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6da149014..58d3ef493 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,12 +15,15 @@ jobs: - uses: actions/checkout@v4 - name: Preview build configuration - Use relative paths - if: ${{ github.event_name == 'pull_request' && github.base_ref == 'dev' }} + # NOTE: doesn't affect app functionality compared to a production build! + if: ${{ github.event_name == 'pull_request' }} run: | # Use relative paths for the PR preview build sed -i "s|vite build --base '/'|vite build --base './'|" package.json - name: Preview build configuration - Use 'development' mode + # WARNING: may affect app functionality compared to a production build! + # keep it enabled only for PRs against `dev` branch for now! if: ${{ github.event_name == 'pull_request' && github.base_ref == 'dev' }} run: | # Specify development mode which activates the CreditcoinLocal network in the menu, From 5b5242329b0411f84ebc831d7a7d3d20376b787f Mon Sep 17 00:00:00 2001 From: nbass3 <70085020+nbass3@users.noreply.github.com> Date: Sat, 16 Dec 2023 03:54:41 +0900 Subject: [PATCH 09/82] Feature/v1.0.0 (#38) * [SS-457] Connect - order of web wallets doesn't match Gluwa's preferences * [SS-456] Removed hardware wallet option * [SS-454] Remove extra links in Resources view * [SS-453] Remove hardware wallet link on resources view * [SS-453][SS-446] Remove Language, Theme icon on footer --- src/config/help.ts | 18 +++++++------ src/library/SideMenu/index.tsx | 14 +++++----- src/modals/Connect/index.tsx | 49 +++++++++++++++++++++++++++++++--- 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/src/config/help.ts b/src/config/help.ts index 7e9abdd73..50cf4593a 100644 --- a/src/config/help.ts +++ b/src/config/help.ts @@ -54,8 +54,8 @@ export const HelpConfig: HelpItems = [ 'Pool Commission Change Rate', ], external: [ - ['createPools', 'https://docs.creditcoin.org', 'docs.creditcoin.org'], - ['claimRewards', 'https://docs.creditcoin.org', 'docs.creditcoin.org'], + // ['createPools', 'https://docs.creditcoin.org', 'docs.creditcoin.org'], + // ['claimRewards', 'https://docs.creditcoin.org', 'docs.creditcoin.org'], ], }, { @@ -89,16 +89,18 @@ export const HelpConfig: HelpItems = [ { key: 'ledger', definitions: [ - 'Ledger Hardware Wallets', - 'Ledger Rejected Transaction', - 'Ledger Request Timeout', - 'Open App On Ledger', - 'Wrong Transaction', + // 'Ledger Hardware Wallets', + // 'Ledger Rejected Transaction', + // 'Ledger Request Timeout', + // 'Open App On Ledger', + // 'Wrong Transaction', ], external: [], }, { key: 'vault', - definitions: ['Polkadot Vault'], + definitions: [ + // 'Polkadot Vault', + ], }, ]; diff --git a/src/library/SideMenu/index.tsx b/src/library/SideMenu/index.tsx index 6b7fc2b58..78f82f400 100644 --- a/src/library/SideMenu/index.tsx +++ b/src/library/SideMenu/index.tsx @@ -12,14 +12,14 @@ import { useTranslation } from 'react-i18next'; import { SideMenuStickyThreshold } from 'consts'; import { useApi } from 'contexts/Api'; import { useHelp } from 'contexts/Help'; -import { useTheme } from 'contexts/Themes'; +// import { useTheme } from 'contexts/Themes'; import { useUi } from 'contexts/UI'; import type { UIContextInterface } from 'contexts/UI/types'; import CogOutlineSVG from 'img/cog-outline.svg?react'; -import LanguageSVG from 'img/language.svg?react'; +// import LanguageSVG from 'img/language.svg?react'; import LogoGithubSVG from 'img/logo-github.svg?react'; -import MoonOutlineSVG from 'img/moon-outline.svg?react'; -import SunnyOutlineSVG from 'img/sunny-outline.svg?react'; +// import MoonOutlineSVG from 'img/moon-outline.svg?react'; +// import SunnyOutlineSVG from 'img/sunny-outline.svg?react'; import { useOutsideAlerter } from 'library/Hooks'; import { useOverlay } from '@polkadot-cloud/react/hooks'; import { useNetwork } from 'contexts/Network'; @@ -32,7 +32,7 @@ export const SideMenu = () => { const { t } = useTranslation('base'); const { apiStatus } = useApi(); const { networkData, network } = useNetwork(); - const { mode, toggleTheme } = useTheme(); + // const { mode, toggleTheme } = useTheme(); const { openModal } = useOverlay().modal; const { setSideMenu, @@ -146,7 +146,7 @@ export const SideMenu = () => { > - - )} + )} */} ); diff --git a/src/modals/Connect/index.tsx b/src/modals/Connect/index.tsx index 12e67906d..aa6bcca8f 100644 --- a/src/modals/Connect/index.tsx +++ b/src/modals/Connect/index.tsx @@ -12,7 +12,7 @@ import { ModalPadding, ModalSection, } from '@polkadot-cloud/react'; -import { ExtensionsArray } from '@polkadot-cloud/assets/extensions'; +import { ExtensionsArray as OriginExtensionsArray } from '@polkadot-cloud/assets/extensions'; import { useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { @@ -30,11 +30,53 @@ import { ReadOnly } from './ReadOnly'; import { Vault } from './Vault'; import { ExtensionsWrapper } from './Wrappers'; +const desiredOrder = [ + 'subwallet-js', + 'metamask-polkadot-snap', + 'talisman', + 'enkrypt', + 'polkagate', + 'fearless-wallet', +]; + +interface ExtensionItem { + title: string; + website: string | [string, string]; + // eslint-disable-next-line @typescript-eslint/consistent-type-imports + features: '*' | import('@polkadot-cloud/assets/types').ExtensionFeature[]; + id: string; +} + export const Connect = () => { const { t } = useTranslation('modals'); const { extensionsStatus } = useExtensions(); const { replaceModal, setModalHeight, modalMaxHeight } = useOverlay().modal; + const sortByDesiredOrder = ( + dataArray: ExtensionItem[], + orderArray: string[] + ) => { + const orderMap = new Map(); + orderArray.forEach((id, index) => { + orderMap.set(id, index); + }); + + return dataArray.slice().sort((a, b) => { + const orderA = orderMap.get(a.id); + const orderB = orderMap.get(b.id); + + if (orderA === undefined) return 1; + if (orderB === undefined) return -1; + + return orderA - orderB; + }); + }; + + const ExtensionsArray = sortByDesiredOrder( + OriginExtensionsArray, + desiredOrder + ); + const inNova = !!window?.walletExtension?.isNovaWallet || false; // If in Nova Wallet, only display it in extension options, otherwise, remove developer tool extensions from web options. @@ -87,6 +129,7 @@ export const Connect = () => { }, []); // Hardware connect options JSX. + // eslint-disable-next-line @typescript-eslint/no-unused-vars const ConnectHardwareJSX = ( <> @@ -118,13 +161,13 @@ export const Connect = () => { // If in Nova Wallet, display extensions before hardware. const ConnectCombinedJSX = !inNova ? ( <> - {ConnectHardwareJSX} + {/* {ConnectHardwareJSX} */} {ConnectExtensionsJSX} ) : ( <> {ConnectExtensionsJSX} - {ConnectHardwareJSX} + {/* {ConnectHardwareJSX} */} ); From a646147b81d7b38bd94e4770a583ee145c54401f Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Fri, 15 Dec 2023 14:59:52 +0200 Subject: [PATCH 10/82] Add `git diff` in CI for easier debugging of PR preview builds --- .github/workflows/docker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 58d3ef493..9cbae1847 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,6 +20,9 @@ jobs: run: | # Use relative paths for the PR preview build sed -i "s|vite build --base '/'|vite build --base './'|" package.json + echo "===== DEBUG =====" + git diff + echo "===== END =====" - name: Preview build configuration - Use 'development' mode # WARNING: may affect app functionality compared to a production build! @@ -29,6 +32,9 @@ jobs: # Specify development mode which activates the CreditcoinLocal network in the menu, # which in turn enables testing the PR preview build with a locally running creditcoin3-node sed -i "s|vite build|vite build --mode development|" package.json + echo "===== DEBUG =====" + git diff + echo "===== END =====" - name: Build docker image run: | From 780239110200fd25509781bde83d4f7b95d5c34c Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Fri, 15 Dec 2023 15:28:16 +0200 Subject: [PATCH 11/82] Change how we build the PR preview builds It turns out that we need NODE_ENV='development' is we want to use `vite build`. Otherwise the CreditcoinLocal network doesn't show in the preview build! --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9cbae1847..88dd8f616 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -31,7 +31,7 @@ jobs: run: | # Specify development mode which activates the CreditcoinLocal network in the menu, # which in turn enables testing the PR preview build with a locally running creditcoin3-node - sed -i "s|vite build|vite build --mode development|" package.json + sed -i "s|yarn build|export NODE_ENV='development' \&\& yarn build|" Dockerfile echo "===== DEBUG =====" git diff echo "===== END =====" From cb316c6ba793c8feddfd4b81c3b7632061e47b7d Mon Sep 17 00:00:00 2001 From: frankli-dev <51565705+frankli-dev@users.noreply.github.com> Date: Tue, 19 Dec 2023 09:22:10 -0700 Subject: [PATCH 12/82] CSUB-959: Change LeavePool label to Unbond funds --- src/locale/en/modals.json | 2 ++ src/modals/ManagePool/Tasks.tsx | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/locale/en/modals.json b/src/locale/en/modals.json index ee9b3e8e9..fc98356b3 100644 --- a/src/locale/en/modals.json +++ b/src/locale/en/modals.json @@ -256,12 +256,14 @@ "unbondAll": "Unbond All", "unbondErrorBelowMinimum": "Unable to unbond. Your bonded funds are below the minumum of {{bond}} {{unit}}.", "unbondErrorNoFunds": "You have no {{unit}} to unbond.", + "unbondFunds": "Unbond Funds", "unbondFundsLeavePool": "Unbond your funds and leave the nomination pool.", "unbondMemberFunds": "Unbond Member Funds", "unbondSomeOfYour": "Unbond some of your", "unbondToMaintain": "Unbond up to the {{minJoinBondUnit}} {{unit}} minimum to maintain your pool membership", "unbondToMinimum": "Unbond To Minimum", "unbondToMinimumCreate": "Unbond up to the {{minCreateBondUnit}} {{unit}} minimum bond for pool depositors.", + "unbondYourFunds": "Unbond your funds", "unbonding": "Unbonding", "unbondingWithdraw": "Unbonding will also withdraw your outstanding rewards of", "undergoingMaintenance": "Undergoing Maintenance", diff --git a/src/modals/ManagePool/Tasks.tsx b/src/modals/ManagePool/Tasks.tsx index d678f4cf7..8cceef1e9 100644 --- a/src/modals/ManagePool/Tasks.tsx +++ b/src/modals/ManagePool/Tasks.tsx @@ -137,8 +137,8 @@ export const Tasks = forwardRef(({ setSection, setTask }: any, ref: any) => { }} >
-

{t('leavePool')}

-

{t('unbondFundsLeavePool')}

+

{t('unbondFunds')}

+

{t('unbondYourFunds')}

)} From 9b58b88b1565d092dc64c7e5ecd9bf286cfd1a1e Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Tue, 19 Dec 2023 21:26:35 +0200 Subject: [PATCH 13/82] Revert "CSUB-959: Change LeavePool label to Unbond funds" This reverts commit c461333807878e700756742f4eba41e9105ecddf. --- src/locale/en/modals.json | 2 -- src/modals/ManagePool/Tasks.tsx | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/locale/en/modals.json b/src/locale/en/modals.json index fc98356b3..ee9b3e8e9 100644 --- a/src/locale/en/modals.json +++ b/src/locale/en/modals.json @@ -256,14 +256,12 @@ "unbondAll": "Unbond All", "unbondErrorBelowMinimum": "Unable to unbond. Your bonded funds are below the minumum of {{bond}} {{unit}}.", "unbondErrorNoFunds": "You have no {{unit}} to unbond.", - "unbondFunds": "Unbond Funds", "unbondFundsLeavePool": "Unbond your funds and leave the nomination pool.", "unbondMemberFunds": "Unbond Member Funds", "unbondSomeOfYour": "Unbond some of your", "unbondToMaintain": "Unbond up to the {{minJoinBondUnit}} {{unit}} minimum to maintain your pool membership", "unbondToMinimum": "Unbond To Minimum", "unbondToMinimumCreate": "Unbond up to the {{minCreateBondUnit}} {{unit}} minimum bond for pool depositors.", - "unbondYourFunds": "Unbond your funds", "unbonding": "Unbonding", "unbondingWithdraw": "Unbonding will also withdraw your outstanding rewards of", "undergoingMaintenance": "Undergoing Maintenance", diff --git a/src/modals/ManagePool/Tasks.tsx b/src/modals/ManagePool/Tasks.tsx index 8cceef1e9..d678f4cf7 100644 --- a/src/modals/ManagePool/Tasks.tsx +++ b/src/modals/ManagePool/Tasks.tsx @@ -137,8 +137,8 @@ export const Tasks = forwardRef(({ setSection, setTask }: any, ref: any) => { }} >
-

{t('unbondFunds')}

-

{t('unbondYourFunds')}

+

{t('leavePool')}

+

{t('unbondFundsLeavePool')}

)} From 632b7765709cbfb140e1ecceccbf4672e21d8563 Mon Sep 17 00:00:00 2001 From: yiseul <46887050+rosee-xo@users.noreply.github.com> Date: Thu, 4 Jan 2024 18:21:00 +0900 Subject: [PATCH 14/82] [SS-465] [CC3 Dashboard] When leaving pool change message (#57) --- src/locale/en/modals.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locale/en/modals.json b/src/locale/en/modals.json index ee9b3e8e9..4a8a9cd99 100644 --- a/src/locale/en/modals.json +++ b/src/locale/en/modals.json @@ -181,7 +181,7 @@ "notToClaim": "Validators usually claim payouts on behalf of their nominators. If you decide not to claim here, it is likely you will receive your payouts within 1-2 days of them becoming available.", "notePoolDepositorMinBond_depositor": "As the pool depositor you must maintain a bond of at least {{bond}} {{unit}}.", "notePoolDepositorMinBond_member": "As a pool member you must maintain a bond of at least {{bond}} {{unit}}.", - "onceUnbonding": "Once unbonding, your funds to become available after {{bondDurationFormatted}}.", + "onceUnbonding": "You will leave the pool once your funds are completely unbonded. The unbonding process takes {{bondDurationFormatted}} to complete.", "openAppOnLedger": "Open the {{appName}} app on your Ledger device.", "openFeedback": "Open Creditcoin Community Forum", "payeeAdded": "Payee Added", From 4689161bbb102c83ca9415490561d7e698bdf57d Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 19:31:54 +0200 Subject: [PATCH 15/82] Bash format --- .shell/build-container.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.shell/build-container.sh b/.shell/build-container.sh index 5a3cde22b..5cc3b42ef 100755 --- a/.shell/build-container.sh +++ b/.shell/build-container.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash podman build \ - -t polkadot-staking-dashboard \ - -t psd \ - . + -t polkadot-staking-dashboard \ + -t psd \ + . From a0d82ecd2a9c1817c03baa707a26b9749257fa44 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 20:26:46 +0200 Subject: [PATCH 16/82] Fix markdown lint issues --- CONTRIBUTING.md | 4 ++-- README.md | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bed439733..2f5dd83e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,13 +2,13 @@ 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 ross@parity.io for clarification of any content within this document. +Reach out to 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: -``` +```text (): ``` diff --git a/README.md b/README.md index a2651a1a5..79b1f1a90 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ -![ci](https://github.com/gluwa/creditcoin-staking-dashboard/actions/workflows/ci.yml/badge.svg) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) - # Creditcoin Staking Dashboard -#### Production: +![ci](https://github.com/gluwa/creditcoin-staking-dashboard/actions/workflows/ci.yml/badge.svg) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -https://staking.creditcoin.org +**Production URL:** ## Validator Operator Setup Guide @@ -37,7 +35,7 @@ Next, add your operator details to the `ValidatorCommunity` object. Only provide The following example defines 2 validators on the Creditcoin Mainnet, and 1 on the Creditcoin Testnet: -``` +```typescript export const ValidatorCommunity = [ ... { From 4aa88f2dd48dc98773832a1643fa003011766a46 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 20:36:33 +0200 Subject: [PATCH 17/82] Disable spell checkers because they choke on almost everything which is source code and report too many false positive --- .mega-linter.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .mega-linter.yml diff --git a/.mega-linter.yml b/.mega-linter.yml new file mode 100644 index 000000000..eb4ba147f --- /dev/null +++ b/.mega-linter.yml @@ -0,0 +1,4 @@ +--- +DISABLE_LINTERS: + - SPELL_CSPELL + - SPELL_MISSPELL From 9f3446e003953cefa47c877cd33dac0f977d620e Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 20:38:11 +0200 Subject: [PATCH 18/82] Disable JSCPD copy-paste checker again, too many false positives --- .mega-linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.mega-linter.yml b/.mega-linter.yml index eb4ba147f..3822f445c 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -1,4 +1,5 @@ --- DISABLE_LINTERS: + - COPYPASTE_JSCPD - SPELL_CSPELL - SPELL_MISSPELL From 173fe72afbb9f0170f52800856d00ad582bd9ccd Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 20:43:09 +0200 Subject: [PATCH 19/82] Remove Release section from CONTRIBUTING.md + related GH action because our releases aren't automated in the same way as upstream --- .github/workflows/gh-publish.yml | 23 ----------------------- CONTRIBUTING.md | 6 ------ 2 files changed, 29 deletions(-) delete mode 100644 .github/workflows/gh-publish.yml diff --git a/.github/workflows/gh-publish.yml b/.github/workflows/gh-publish.yml deleted file mode 100644 index 97d2397d4..000000000 --- a/.github/workflows/gh-publish.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: GitHub Pages Publish - -on: - push: - branches: [main] - -jobs: - gh-deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - registry-url: https://registry.npmjs.org - - run: yarn install - - name: Build - working-directory: '.' - run: yarn build:pages - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: build diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f5dd83e5..282180816 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,12 +24,6 @@ The `(scope)` could be anything specifying the place of the commit change. For e 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 From f39f37018bfad303b5d60885cd41b542ca714435 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 20:44:19 +0200 Subject: [PATCH 20/82] Replace upstream URLs with ours --- CONTRIBUTING.md | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 282180816..fa6c080e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,6 @@ # Contribution Guide -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 for clarification of any content within this document. +This section aims to familiarise developers to the Polkadot Staking Dashboard [[GitHub](https://github.com/gluwa/creditcoin3-staking-dashboard), [Demo](https://paritytech.github.io/polkadot-staking-dashboard/#/overview)] for the purpose of contributing to the project. ## Submitting Pull Requests @@ -37,45 +35,45 @@ If you would like to know more about the Conventional Commits specification, ple Optionally apply envrionment variables in an environment file such as `.env` or with `yarn build` to customise the build of staking dashboard. -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. +Refer to the [`.env`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/.env) file in the root of the repository for all supported variables. ## Config Files There are some ad-hoc files defining app configuration where needed. These just provide a means of bootstrapping app data, and further abstraction could be explored in the future. -- [`config/pages.ts`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/config/pages.ts): provides the pages and page categories of the app. -- [`config/help.ts`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/config/help.ts): provides the help content. -- [`Utils.ts`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/Utils.ts): Various general helper functions used throughout the app, such as formatting utilities. +- [`config/pages.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/config/pages.ts): provides the pages and page categories of the app. +- [`config/help.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/config/help.ts): provides the help content. +- [`Utils.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/Utils.ts): Various general helper functions used throughout the app, such as formatting utilities. ## Folders -Folders are structured in the [`src/`](https://github.com/paritytech/polkadot-staking-dashboard/tree/main/src) directory to separate functional, presentational and context components: +Folders are structured in the [`src/`](https://github.com/gluwa/creditcoin3-staking-dashboard/tree/main/src) directory to separate functional, presentational and context components: -- [`contexts`](https://github.com/paritytech/polkadot-staking-dashboard/tree/main/src/contexts): context providers for the app. All Polkadot JS API interaction happens in these files. -- [`img`](https://github.com/paritytech/polkadot-staking-dashboard/tree/main/src/img): app SVGs. -- [`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. -- [`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. +- [`contexts`](https://github.com/gluwa/creditcoin3-staking-dashboard/tree/main/src/contexts): context providers for the app. All Polkadot JS API interaction happens in these files. +- [`img`](https://github.com/gluwa/creditcoin3-staking-dashboard/tree/main/src/img): app SVGs. +- [`library`](https://github.com/gluwa/creditcoin3-staking-dashboard/tree/main/src/library): reusable components that could eventually be abstracted into a separate UI library. +- [`modals`](https://github.com/gluwa/creditcoin3-staking-dashboard/tree/main/src/modals): the various modal pop-ups used in the app. +- [`pages`](https://github.com/gluwa/creditcoin3-staking-dashboard/tree/main/src/pages): similar to modals, page components and components that comprise pages. +- [`workers`](https://github.com/gluwa/creditcoin3-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 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 `` 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 `` 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 ``'s, in addition to the major app presentational components. +- [`index.tsx`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/index.tsx): DOM render, of little interest. +- [`App.tsx`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/App.tsx): wraps `` in the theme provider context and determines the active network from local storage. +- [`Providers.tsx`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/Providers.tsx): imports and wraps `` 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/gluwa/creditcoin3-staking-dashboard/blob/main/src/Router.tsx): contains react router ``'s, in addition to the major app presentational components. ## Development Patterns Documenting some of the development patterns used: - We use the **"Wrapper" terminology for styled components** that wrap a functional component. -- **Styles are defined on a per-component basis**, being defined in the same folder as the component markup itself. Where unavoidable (such as global styles, interface layout), styled components should reside in [`src/Wrappers.ts`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/Wrappers.tsx). -- **Theme values** are configured in [`styles/theme.scss`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/styles/theme.scss), and can be included in any styled component as custom properties. Graph colors are configurable from [`styles/graphs.ts`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/styles/graphs.ts). -- **Constants or default values** (such as those waiting for Polkadot API) are defined in [`src/constants.ts`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/constants.ts). -- Packages with **missing TypeScript definitions** can be declared in [`src/react-app-env.d.ts`](https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/react-app-env.d.ts). +- **Styles are defined on a per-component basis**, being defined in the same folder as the component markup itself. Where unavoidable (such as global styles, interface layout), styled components should reside in [`src/Wrappers.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/Wrappers.tsx). +- **Theme values** are configured in [`styles/theme.scss`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/styles/theme.scss), and can be included in any styled component as custom properties. Graph colors are configurable from [`styles/graphs.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/styles/graphs.ts). +- **Constants or default values** (such as those waiting for Polkadot API) are defined in [`src/constants.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/constants.ts). +- Packages with **missing TypeScript definitions** can be declared in [`src/react-app-env.d.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/react-app-env.d.ts). ## TypeScript Support From 3ad647f8ec2250f7562cb884f6a127b39004976b Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 20:51:03 +0200 Subject: [PATCH 21/82] Fix broken URLs that return 404 - replace with their current equivalent or - remove entirely if referenced file not found --- .github/workflows/mega-linter.yml | 4 ++-- .lycheeignore | 1 + CONTRIBUTING.md | 12 +++++------- 3 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 .lycheeignore diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index d9ddd771d..195b985c3 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -35,10 +35,10 @@ jobs: - name: MegaLinter id: ml # You can override MegaLinter flavor used to have faster performances - # More info at https://megalinter.io/flavors/ + # More info at https://megalinter.io/latest/flavors/ uses: oxsecurity/megalinter/flavors/javascript@v7 env: - # All available variables are described at https://megalinter.io/configuration/ + # All available variables are described at https://megalinter.io/latest/configuration/ # and configured in .mega-linter.yml VALIDATE_ALL_CODEBASE: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 000000000..b43761704 --- /dev/null +++ b/.lycheeignore @@ -0,0 +1 @@ +staticsitellvmhtml.z13.web.core.windows.net diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fa6c080e6..5dd26906c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,9 +41,8 @@ Refer to the [`.env`](https://github.com/gluwa/creditcoin3-staking-dashboard/blo There are some ad-hoc files defining app configuration where needed. These just provide a means of bootstrapping app data, and further abstraction could be explored in the future. -- [`config/pages.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/config/pages.ts): provides the pages and page categories of the app. +- [`config/pages.tsx`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/config/pages.tsx): provides the pages and page categories of the app. - [`config/help.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/config/help.ts): provides the help content. -- [`Utils.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/Utils.ts): Various general helper functions used throughout the app, such as formatting utilities. ## Folders @@ -60,7 +59,7 @@ Folders are structured in the [`src/`](https://github.com/gluwa/creditcoin3-stak Going from the top-most component, the component hierarchy is set up as follows: -- [`index.tsx`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/index.tsx): DOM render, of little interest. +- [`main.tsx`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/main.tsx): DOM render, of little interest. - [`App.tsx`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/App.tsx): wraps `` in the theme provider context and determines the active network from local storage. - [`Providers.tsx`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/Providers.tsx): imports and wraps `` 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/gluwa/creditcoin3-staking-dashboard/blob/main/src/Router.tsx): contains react router ``'s, in addition to the major app presentational components. @@ -70,10 +69,9 @@ Going from the top-most component, the component hierarchy is set up as follows: Documenting some of the development patterns used: - We use the **"Wrapper" terminology for styled components** that wrap a functional component. -- **Styles are defined on a per-component basis**, being defined in the same folder as the component markup itself. Where unavoidable (such as global styles, interface layout), styled components should reside in [`src/Wrappers.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/Wrappers.tsx). -- **Theme values** are configured in [`styles/theme.scss`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/styles/theme.scss), and can be included in any styled component as custom properties. Graph colors are configurable from [`styles/graphs.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/styles/graphs.ts). -- **Constants or default values** (such as those waiting for Polkadot API) are defined in [`src/constants.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/constants.ts). -- Packages with **missing TypeScript definitions** can be declared in [`src/react-app-env.d.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/react-app-env.d.ts). +- **Styles are defined on a per-component basis**, being defined in the same folder as the component markup itself. Where unavoidable (such as global styles, interface layout), styled components should reside in `src//Wrappers.ts`. +- **Theme values** are configured in [`styles/index.scss`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/styles/index.scss), and can be included in any styled component as custom properties. Graph colors are configurable from [`styles/graphs.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/styles/graphs.ts). +- **Constants or default values** (such as those waiting for Polkadot API) are defined in [`src/consts.ts`](https://github.com/gluwa/creditcoin3-staking-dashboard/blob/main/src/consts.ts). ## TypeScript Support From 368b9b8c52da222e8c8b440cd4bd46edf22a0017 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 20:56:58 +0200 Subject: [PATCH 22/82] Nuke upstream's Changelog file it is full with broken URLs and we should keep our own changelog anyway --- CHANGELOG.md | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72666910c..fbc913d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,36 +1,6 @@ # Changelog -## [1.1.0](https://github.com/paritytech/polkadot-staking-dashboard/compare/v1.0.9...v1.1.0) (2023-10-30) +## [20231208-devnet](https://github.com/gluwa/creditcoin3-staking-dashboard/releases/tag/20231208-devnet) (2023-12-08) -### Features - -- Add newly supported proxy calls ([#1554](https://github.com/paritytech/polkadot-staking-dashboard/issues/1554)) ([4ff9717](https://github.com/paritytech/polkadot-staking-dashboard/commit/4ff9717c3dce4068f31ec0dcc34c128df7eb4f06)) -- add sync state for eraRewardPoints fetch ([aae111c](https://github.com/paritytech/polkadot-staking-dashboard/commit/aae111c538f2091a1694a13e21b14d1bcef47e8f)) -- add validator performance ranks & quartiles, quartiles in generation methods ([#1546](https://github.com/paritytech/polkadot-staking-dashboard/issues/1546)) ([2955e70](https://github.com/paritytech/polkadot-staking-dashboard/commit/2955e706927eaf4da8952790ac7a3d2ed63d79f4)) -- Add validator pulse graph to list items ([#1530](https://github.com/paritytech/polkadot-staking-dashboard/issues/1530)) ([e41168b](https://github.com/paritytech/polkadot-staking-dashboard/commit/e41168b93378f03a13c760af19a51af4d5a583e3)) -- allow selection of RPC providers ([#1557](https://github.com/paritytech/polkadot-staking-dashboard/issues/1557)) ([c0553c2](https://github.com/paritytech/polkadot-staking-dashboard/commit/c0553c2c9b466a37b9d55811dbce1b8fbb6dafd3)) -- **ci:** Add Release Please CI, update `CONTRIBUTING` ([#1470](https://github.com/paritytech/polkadot-staking-dashboard/issues/1470)) ([6b7dc60](https://github.com/paritytech/polkadot-staking-dashboard/commit/6b7dc60cece70cfeb4190ac4dacc205112578288)) -- **cleanup:** remove deprecated `Nominate` and `NominatePools` modals ([#1540](https://github.com/paritytech/polkadot-staking-dashboard/issues/1540)) ([56ed4c0](https://github.com/paritytech/polkadot-staking-dashboard/commit/56ed4c0056278f706010a0eabee7978c2bebd03c)) -- **context:** `ExtensionAccounts` provider ([#1494](https://github.com/paritytech/polkadot-staking-dashboard/issues/1494)) ([e8f11e9](https://github.com/paritytech/polkadot-staking-dashboard/commit/e8f11e92730dbb4b624b2ad6fa9fb5cf37732a1f)) -- **help:** remove controller help items ([#1527](https://github.com/paritytech/polkadot-staking-dashboard/issues/1527)) ([743510f](https://github.com/paritytech/polkadot-staking-dashboard/commit/743510f30d87dc7d60d01bc5f530e856d416c6e2)) -- Order nominations by nomination status. ([#1543](https://github.com/paritytech/polkadot-staking-dashboard/issues/1543)) ([0ab87f4](https://github.com/paritytech/polkadot-staking-dashboard/commit/0ab87f46db16576cd9ee9a795dfb28f82b6391c9)) -- Refactor for reusable `ExtensionAccountsProvider` context ([#1466](https://github.com/paritytech/polkadot-staking-dashboard/issues/1466)) ([13380bb](https://github.com/paritytech/polkadot-staking-dashboard/commit/13380bb5049fe8b55695d58e24a3928432b730d3)) -- **refactor:** remove `NominateFromFavorites` modal ([#1528](https://github.com/paritytech/polkadot-staking-dashboard/issues/1528)) ([4bc62a3](https://github.com/paritytech/polkadot-staking-dashboard/commit/4bc62a373e3c4129adb5b717b56333356efc6b26)) -- **refactor:** Separate titles from lists, reformat filters, fixes ([#1539](https://github.com/paritytech/polkadot-staking-dashboard/issues/1539)) ([ae5f95e](https://github.com/paritytech/polkadot-staking-dashboard/commit/ae5f95ed1036e7383ae59e2e6ff89833e5d6a179)) -- **refactor:** use simple cloud react imports ([#1493](https://github.com/paritytech/polkadot-staking-dashboard/issues/1493)) ([839cc06](https://github.com/paritytech/polkadot-staking-dashboard/commit/839cc06c0dc4655f5ce383ed4c72d95cb0a32f39)) -- Replace icons to cloud, remove dead wallet connect option ([#1506](https://github.com/paritytech/polkadot-staking-dashboard/issues/1506)) ([7e3efd2](https://github.com/paritytech/polkadot-staking-dashboard/commit/7e3efd2c8ec9864ca40ccc165c7ab5f76b581f94)) -- store `eraRewardPoints` from recent eras ([#1529](https://github.com/paritytech/polkadot-staking-dashboard/issues/1529)) ([690ba51](https://github.com/paritytech/polkadot-staking-dashboard/commit/690ba51e7b8cfc7285fbdb90748362d85e848460)) -- **ux:** min non-zero bar segment width ([#1555](https://github.com/paritytech/polkadot-staking-dashboard/issues/1555)) ([9377776](https://github.com/paritytech/polkadot-staking-dashboard/commit/9377776369fb6c63629c8622fd3ab9087ab70502)) -- **ux:** Polkadot JS to developer tools category ([#1576](https://github.com/paritytech/polkadot-staking-dashboard/issues/1576)) ([5684c0a](https://github.com/paritytech/polkadot-staking-dashboard/commit/5684c0aaf45426ca9839abbb9b845bb5fee175ec)) -- **ux:** Pool rewards worker & pool performance graphs ([#1547](https://github.com/paritytech/polkadot-staking-dashboard/issues/1547)) ([be4a556](https://github.com/paritytech/polkadot-staking-dashboard/commit/be4a5568fa7e46b33295f48ded3b7a2c81eec14c)) - -### Bug Fixes - -- avoid negative free balance ([8fd61dd](https://github.com/paritytech/polkadot-staking-dashboard/commit/8fd61dd4bc68c8a4fa5982839761066accba20aa)) -- **ci:** fix earliest release commit ([d873517](https://github.com/paritytech/polkadot-staking-dashboard/commit/d8735175cdb2a3ff2baf45df388634973eb6ee33)) -- **ci:** last-release-sha ([7c9cea5](https://github.com/paritytech/polkadot-staking-dashboard/commit/7c9cea5dc4d04f05b59e46a6b2e5544e8a6b3ab3)) -- fix bug on favorite pools visit ([#1526](https://github.com/paritytech/polkadot-staking-dashboard/issues/1526)) ([2f8ea85](https://github.com/paritytech/polkadot-staking-dashboard/commit/2f8ea85f6c639cf18d8154e6b908ef483122781a)) -- fix new era reward points processing ([214da8d](https://github.com/paritytech/polkadot-staking-dashboard/commit/214da8d5c05f723c42c739f700d2180318bcf60f)) -- fixed lag in timeleft refreh in last hour ([7b703cf](https://github.com/paritytech/polkadot-staking-dashboard/commit/7b703cfff83acd89a20b5075d0de6827cdfc22d8)) -- miscellaneous fixes. ([#1538](https://github.com/paritytech/polkadot-staking-dashboard/issues/1538)) ([24d0ca6](https://github.com/paritytech/polkadot-staking-dashboard/commit/24d0ca6ed4b5c0d081db941c3cae898468fecdcc)) -- payee toggle fix on setup ([3fe3031](https://github.com/paritytech/polkadot-staking-dashboard/commit/3fe30315d18691be6e7be846b945eb84cf89b8cf)) +- Pre-release +- For internal use only! From 56a8c1404641b719eab5c3adab19ce8b5bcea771 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 20:58:35 +0200 Subject: [PATCH 23/82] Disable eslint as part of the MegaLinter workflow there is `yarn lint` which is executed as part of another CI job that takes care of this --- .mega-linter.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.mega-linter.yml b/.mega-linter.yml index 3822f445c..80876a8d4 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -1,5 +1,8 @@ --- DISABLE_LINTERS: - COPYPASTE_JSCPD + - JAVASCRIPT_ES - SPELL_CSPELL - SPELL_MISSPELL + - TSX_ESLINT + - TYPESCRIPT_ES From 14c4307072025da16b927c3785f53e28bfec04e3 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Wed, 20 Dec 2023 21:10:24 +0200 Subject: [PATCH 24/82] Disable markdown-table-formatter because it conflicts with eslint and the opposing formats will cause builds to fail in CI --- .mega-linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.mega-linter.yml b/.mega-linter.yml index 80876a8d4..e60f30883 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -2,6 +2,7 @@ DISABLE_LINTERS: - COPYPASTE_JSCPD - JAVASCRIPT_ES + - MARKDOWN_MARKDOWN_TABLE_FORMATTER - SPELL_CSPELL - SPELL_MISSPELL - TSX_ESLINT From 7e05a9c91f534ad44aeb62f5e1389fe5990d3852 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 13:18:31 +0200 Subject: [PATCH 25/82] Remove extra curly braces to satisfy actionlint --- .github/workflows/mega-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 195b985c3..4a7ecd44f 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -45,7 +45,7 @@ jobs: # Upload MegaLinter artifacts - name: Archive production artifacts - if: ${{ success() }} || ${{ failure() }} + if: success() || failure() uses: actions/upload-artifact@v3 with: name: MegaLinter reports From 453b2b0d55f62198198fdf14094edb13c9b2b1f9 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 13:24:43 +0200 Subject: [PATCH 26/82] Ensure to-level permissions are not set to write-all --- .github/workflows/ci.yml | 2 ++ .github/workflows/codeql.yml | 4 ++-- .github/workflows/docker.yml | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 313eb5855..204af0686 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,8 @@ on: pull_request: branches: [main, dev] +permissions: read-all + jobs: check-license-lines: runs-on: ubuntu-latest diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 75c59ccd0..943dcd24d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -12,12 +12,12 @@ name: 'CodeQL' on: - push: - branches: ['dev'] pull_request: # The branches below must be a subset of the branches above branches: ['dev'] +permissions: read-all + jobs: analyze: name: Analyze diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 88dd8f616..06663702d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,6 +6,8 @@ on: pull_request: branches: [main, dev] +permissions: read-all + jobs: build: permissions: From 3bded65f752492c793f2e9572c5e69cd73a78889 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 13:31:35 +0200 Subject: [PATCH 27/82] Consolidate RUN instructions - make hadolint happy --- Dockerfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba775e5ca..03a803cbf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ # build environment FROM node:21 as build + +WORKDIR /tmp +RUN npm install yarn --legacy-peer-deps + WORKDIR /app COPY . . -RUN npm install yarn --legacy-peer-deps -RUN git config --global url."https://github.com/".insteadOf git@github.com: -RUN git config --global url."https://".insteadOf ssh://git -RUN yarn install -RUN yarn build +RUN git config --global url."https://github.com/".insteadOf git@github.com: \ + && git config --global url."https://".insteadOf ssh://git \ + && yarn install \ + && yarn build # production environment FROM nginx:1.25.3-alpine From 168c49aec1933da233d926206ad55d87b51a38e1 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 13:32:30 +0200 Subject: [PATCH 28/82] hadolint ignore: warning: Pin versions in npm this is only used for a global installation of yarn inside the build environment. The application itself pins dependencies versions via package.json & yarn.lock files --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 03a803cbf..54d9a0491 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# hadolint global ignore=DL3016 + # build environment FROM node:21 as build From 9029e164c07015de78666c77053d30322ef561bf Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 13:37:13 +0200 Subject: [PATCH 29/82] Allow comments in jsonlint and fix some issues --- .mega-linter.yml | 1 + tsconfig.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.mega-linter.yml b/.mega-linter.yml index e60f30883..42851f49f 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -7,3 +7,4 @@ DISABLE_LINTERS: - SPELL_MISSPELL - TSX_ESLINT - TYPESCRIPT_ES +JSON_JSONLINT_ARGUMENTS: --comments diff --git a/tsconfig.json b/tsconfig.json index 9a4e47a62..5da1adcd5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,8 +19,8 @@ "jsx": "react-jsx", "types": [ "react", - "react-dom", - ], + "react-dom" + ] }, "include": [ "src", From fecf4a27231bcb14278325142268528ba7b196ba Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 13:55:56 +0200 Subject: [PATCH 30/82] ignore leaked token for a source file which doesn't exist this is something that came from upstream anyway Finding: const BoardToken = 'REDACTED' Secret: REDACTED RuleID: generic-api-key Entropy: 3.662573 File: src/pages/explore/Feedback.tsx Line: 10 Commit: 134962d4e7773659a867901f75244101b6c05edc Author: Ross Bulat Email: ross@jkrbinvestments.com Date: 2022-04-25T06:06:04Z Fingerprint: 134962d4e7773659a867901f75244101b6c05edc:src/pages/explore/Feedback.tsx:generic-api-key:10 --- .gitleaksignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitleaksignore diff --git a/.gitleaksignore b/.gitleaksignore new file mode 100644 index 000000000..6d78ac4df --- /dev/null +++ b/.gitleaksignore @@ -0,0 +1 @@ +134962d4e7773659a867901f75244101b6c05edc:src/pages/explore/Feedback.tsx:generic-api-key:10 From dbdb95cfffb9b88fdab32ceb5a22f5b5703b0807 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 14:00:25 +0200 Subject: [PATCH 31/82] Disable ts-standard b/c it conflicts with current eslint configuration --- .mega-linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.mega-linter.yml b/.mega-linter.yml index 42851f49f..c9f4d7217 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -7,4 +7,5 @@ DISABLE_LINTERS: - SPELL_MISSPELL - TSX_ESLINT - TYPESCRIPT_ES + - TYPESCRIPT_STANDARD JSON_JSONLINT_ARGUMENTS: --comments From 30066b9ac24c72c2cd538c4a7a238267456f396b Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 14:17:22 +0200 Subject: [PATCH 32/82] Disable deprecated scss-lint linter MegaLinter tells us to disable this linter: https://megalinter.io/latest/descriptors/css_scss_lint/ Also it's SpaceAfterPropertyColon rule conflicts with the chosen format (yarn lint) in this repository. --- .mega-linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.mega-linter.yml b/.mega-linter.yml index c9f4d7217..a4eb48f03 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -1,6 +1,7 @@ --- DISABLE_LINTERS: - COPYPASTE_JSCPD + - CSS_SCSS_LINT - JAVASCRIPT_ES - MARKDOWN_MARKDOWN_TABLE_FORMATTER - SPELL_CSPELL From 2b6f3caff5cbad43b7b2ca2056048814b4a55636 Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 14:20:20 +0200 Subject: [PATCH 33/82] Disable stylelint linter trying to add conffiguration for it will not work because it needs the stylelint-scss plugin installed inside the MegaLinter environment and there doesn't seem to be any way to install extra software inside MegaLinter (it's a container) --- .mega-linter.yml | 1 + .stylelintrc.json | 4 ++++ src/styles/common/font.scss | 1 + 3 files changed, 6 insertions(+) create mode 100644 .stylelintrc.json diff --git a/.mega-linter.yml b/.mega-linter.yml index a4eb48f03..5476d6819 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -2,6 +2,7 @@ DISABLE_LINTERS: - COPYPASTE_JSCPD - CSS_SCSS_LINT + - CSS_STYLELINT - JAVASCRIPT_ES - MARKDOWN_MARKDOWN_TABLE_FORMATTER - SPELL_CSPELL diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 000000000..621f5a7f5 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "stylelint-config-standard", + "customSyntax": "scss" +} diff --git a/src/styles/common/font.scss b/src/styles/common/font.scss index 083f7337d..3714d5e9a 100644 --- a/src/styles/common/font.scss +++ b/src/styles/common/font.scss @@ -1,4 +1,5 @@ @charset "UTF-8"; + /* #### Generated By: http://www.cufonfonts.com #### */ @font-face { From e02b13cd254745585e43198ddc51161670b7a29c Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 14:42:11 +0200 Subject: [PATCH 34/82] Add HTML keywords for djlint --- index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.html b/index.html index d1e73c7d6..7b7a32e7e 100644 --- a/index.html +++ b/index.html @@ -36,6 +36,10 @@ name="description" content="Creditcoin Staking Dashboard is the easiest way to stake CTC, check validator stats, and manage your nominations. Stake on Creditcoin (CTC)." /> + From 17d690cf10919818ce5ae991617dfc7bd44dfc1d Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 14:46:11 +0200 Subject: [PATCH 35/82] Ignore CVEs agaist transitive dependencies reported by grype and trivy --- .grype.yaml | 21 +++++++++++++++++++++ .trivyignore | 8 ++++++++ 2 files changed, 29 insertions(+) create mode 100644 .grype.yaml create mode 100644 .trivyignore diff --git a/.grype.yaml b/.grype.yaml new file mode 100644 index 000000000..c9627486b --- /dev/null +++ b/.grype.yaml @@ -0,0 +1,21 @@ +ignore: + # transitive dependencies + - package: + name: axios + version: 0.21.4 + type: npm + + - package: + name: postcss + version: 8.4.21 + type: npm + + - package: + name: postcss + version: 8.4.24 + type: npm + + - package: + name: sharp + version: 0.32.5 + type: npm diff --git a/.trivyignore b/.trivyignore new file mode 100644 index 000000000..5c7d7a908 --- /dev/null +++ b/.trivyignore @@ -0,0 +1,8 @@ +# axios is a transitive dependency +CVE-2023-45857 + +# postcss is a transitive dependency +CVE-2023-44270 + +# sharp is a transitive dependency +GHSA-54xq-cgqr-rpm3 From 4a2036422406889013fb8e8fb902896755bb9adc Mon Sep 17 00:00:00 2001 From: Alex Todorov Date: Thu, 21 Dec 2023 15:15:03 +0200 Subject: [PATCH 36/82] Provide rules for htmlhint disable the rule head-script-disabled because upstream code violates it by design: ./index.html L80 | ^ The ^ The