Skip to content

Commit

Permalink
fixing errors with networks & index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Raid5594 committed Feb 15, 2024
1 parent e174b5c commit d429787
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 112 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"license": "GPL-3.0-only",
"private": false,
"scripts": {
"build": "tsc && vite build --base '/'",
"build": "tsc && vite build --base './'",
"build:pages": "tsc && vite build --base '/polkadot-staking-dashboard/'",
"clear": "rm -rf node_modules build tsconfig.tsbuildinfo",
"deploy:pages": "yarn build:pages && gh-pages -d build",
"dev": "vite",
"dev": "vite --base './'",
"lint": "eslint . --fix && npx prettier --write . && npx prettier --write ./.scripts && node ./.scripts/localeOrderKeys.cjs",
"locale:order": "node ./.scripts/localeOrderKeys.cjs",
"locale:validate": "node ./.scripts/localeValidate.cjs",
Expand Down
95 changes: 0 additions & 95 deletions public/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions src/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ import { CereStatsProvider } from './contexts/CereStats';

// Embed providers from hook.
export const Providers = () => {
const networkAllData = useNetwork();
console.warn(networkAllData);
const {
network,
networkData: { ss58 },
Expand Down
2 changes: 1 addition & 1 deletion src/config/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PolkadotSVG from 'img/appIcons/polkadot.svg?react';

export const LedgerApps: LedgerApp[] = [
{
network: 'Cere Mainnet',
network: 'cereMainnet',
appName: 'Polkadot',
Icon: PolkadotSVG,
},
Expand Down
8 changes: 4 additions & 4 deletions src/config/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import CereLogoSvg from 'img/cere_logo.svg?react';
import type { NetworkName, Networks } from 'types';
import BigNumber from 'bignumber.js';

const CereMainnet: NetworkName = 'Cere Mainnet';
const CereTestnet: NetworkName = 'Cere Testnet';
const CereDevnet: NetworkName = 'Cere Devnet';
const CereQanet: NetworkName = 'Cere Qanet';
const CereMainnet: NetworkName = 'cereMainnet';
const CereTestnet: NetworkName = 'cereTestnet';
const CereDevnet: NetworkName = 'cereDevnet';
const CereQanet: NetworkName = 'cereQanet';

const cereMainnet = {
name: CereMainnet,
Expand Down
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Plugin } from 'types';
export const AppVersion = '1.0.8';
export const DappName = 'Cere Staking Dashboard';
export const CereUrl = 'https://cere.network';
export const DefaultNetwork = 'Cere Mainnet';
export const DefaultNetwork = 'cereMainnet';
export const ManualSigners = ['ledger', 'vault'];
/*
* Data Structure Helpers
Expand Down
11 changes: 9 additions & 2 deletions src/contexts/Network/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import type { NetworkState } from 'contexts/Api/types';
import type { NetworkContextInterface } from './types';
import { defaultNetworkContext } from './defaults';

console.log('Default network context');
console.log(defaultNetworkContext);
export const NetworkProvider = ({
children,
}: {
Expand Down Expand Up @@ -43,9 +45,12 @@ export const NetworkProvider = ({

// handle network switching
const switchNetwork = (name: NetworkName) => {
console.warn(`Switching network to name: ${name}`);
console.warn(NetworkList);

setNetwork({
name,
meta: NetworkList[name],
meta: NetworkList.cereMainnet,
});

// update url `n` if needed.
Expand All @@ -54,9 +59,11 @@ export const NetworkProvider = ({

// Store the initial active network.
const initialNetwork = getInitialNetwork();
console.warn('Initial network');
console.warn(NetworkList);
const [network, setNetwork] = useState<NetworkState>({
name: initialNetwork,
meta: NetworkList[initialNetwork],
meta: NetworkList.cereMainnet,
});

return (
Expand Down
4 changes: 2 additions & 2 deletions src/modals/Connect/Ledger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export const Ledger = (): React.ReactElement => {
</div>
<div className="row margin">
<ButtonText
text={network === 'Cere Mainnet' ? 'BETA' : 'EXPERIMENTAL'}
text={network === 'cereMainnet' ? 'BETA' : 'EXPERIMENTAL'}
disabled
marginRight
iconLeft={
network === 'Cere Mainnet' ? undefined : faExclamationTriangle
network === 'cereMainnet' ? undefined : faExclamationTriangle
}
style={{ opacity: 0.5 }}
/>
Expand Down
8 changes: 4 additions & 4 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ declare global {
}

export type NetworkName =
| 'Cere Mainnet'
| 'Cere Testnet'
| 'Cere Devnet'
| 'Cere Qanet';
| 'cereMainnet'
| 'cereTestnet'
| 'cereDevnet'
| 'cereQanet';

export type Networks = Record<string, Network>;

Expand Down

0 comments on commit d429787

Please sign in to comment.