import React from 'react'; import { Navigate, Outlet } from 'react-router-dom'; import Home from './token'; import NotFound from './not-found'; import NotPermitted from './not-permitted'; import Routes from './routes'; import Restricted from './restricted'; const LazyTranches = React.lazy( () => import( /* webpackChunkName: "route-tranches", webpackPrefetch: true */ './tranches' ) ); const LazyTranchesTranche = React.lazy( () => import( /* webpackChunkName: "route-tranches-tranche", webpackPrefetch: true */ './tranches/tranche' ) ); const LazyTranchesTranches = React.lazy( () => import( /* webpackChunkName: "route-tranches-tranches", webpackPrefetch: true */ './tranches/tranches' ) ); const LazyClaim = React.lazy( () => import( /* webpackChunkName: "route-claim", webpackPrefetch: true */ './claim' ) ); const LazyRedemption = React.lazy( () => import( /* webpackChunkName: "route-redemption", webpackPrefetch: true */ './redemption' ) ); const LazyRedemptionIndex = React.lazy( () => import( /* webpackChunkName: "route-redemption-index", webpackPrefetch: true */ './redemption/home/redemption-information' ) ); const LazyRedemptionTranche = React.lazy( () => import( /* webpackChunkName: "route-redemption-tranche", webpackPrefetch: true */ './redemption/tranche' ) ); const LazyStaking = React.lazy( () => import( /* webpackChunkName: "route-staking", webpackPrefetch: true */ './staking' ) ); const LazyStakingAssociate = React.lazy( () => import( /* webpackChunkName: "route-staking-associate", webpackPrefetch: true */ './staking/associate/associate-page-container' ) ); const LazyStakingDisassociate = React.lazy( () => import( /* webpackChunkName: "route-staking-disassociate", webpackPrefetch: true */ './staking/disassociate' ) ); const LazyStakingIndex = React.lazy( () => import( /* webpackChunkName: "route-staking-index", webpackPrefetch: true */ './staking/home' ) ); const LazyStakingNode = React.lazy( () => import( /* webpackChunkName: "route-staking-node", webpackPrefetch: true */ './staking/node' ) ); const LazyHome = React.lazy( () => import( /* webpackChunkName: "route-governance-home", webpackPrefetch: true */ './home' ) ); const LazyProposals = React.lazy( () => import( /* webpackChunkName: "route-governance", webpackPrefetch: true */ './proposals' ) ); const LazyProposal = React.lazy( () => import( /* webpackChunkName: "route-governance-proposal", webpackPrefetch: true */ './proposals/proposal' ) ); const LazyProtocolUpgradeProposal = React.lazy( () => import( /* webpackChunkName: "route-governance-protocol-upgrade-proposal", webpackPrefetch: true */ './proposals/protocol-upgrade' ) ); const LazyProposalsList = React.lazy( () => import( /* webpackChunkName: "route-governance-proposals", webpackPrefetch: true */ './proposals/proposals' ) ); const LazyRejectedProposalsList = React.lazy( () => import( /* webpackChunkName: "route-governance-proposals", webpackPrefetch: true */ './proposals/rejected' ) ); const LazyPropose = React.lazy( () => import( /* webpackChunkName: "route-governance-propose", webpackPrefetch: true */ './proposals/propose' ) ); const LazyProposeNetworkParameter = React.lazy( () => import( /* webpackChunkName: "route-governance-propose-network-parameter", webpackPrefetch: true */ './proposals/propose/network-parameter' ) ); const LazyProposeNewMarket = React.lazy( () => import( /* webpackChunkName: "route-governance-propose-new-market", webpackPrefetch: true */ './proposals/propose/new-market' ) ); const LazyProposeUpdateMarket = React.lazy( () => import( /* webpackChunkName: "route-governance-propose-update-market", webpackPrefetch: true */ './proposals/propose/update-market' ) ); const LazyProposeNewAsset = React.lazy( () => import( /* webpackChunkName: "route-governance-propose-new-asset", webpackPrefetch: true */ './proposals/propose/new-asset' ) ); const LazyProposeUpdateAsset = React.lazy( () => import( /* webpackChunkName: "route-governance-propose-update-asset", webpackPrefetch: true */ './proposals/propose/update-asset' ) ); const LazyProposeFreeform = React.lazy( () => import( /* webpackChunkName: "route-governance-propose-freeform", webpackPrefetch: true */ './proposals/propose/freeform' ) ); const LazyProposeRaw = React.lazy( () => import( /* webpackChunkName: "route-governance-propose-raw", webpackPrefetch: true */ './proposals/propose/raw' ) ); const LazyRewards = React.lazy( () => import( /* webpackChunkName: "route-rewards", webpackPrefetch: true */ './rewards' ) ); const LazyContracts = React.lazy( () => import( /* webpackChunkName: "route-tranches", webpackPrefetch: true */ './contracts' ) ); const LazyWithdrawals = React.lazy( () => import( /* webpackChunkName: "route-withdrawals", webpackPrefetch: true */ './withdrawals' ) ); const LazyDisclaimer = React.lazy( () => import( /* webpackChunkName: "route-disclaimer", webpackPrefetch: true */ './disclaimer' ) ); const redirects = [ { path: Routes.VALIDATORS, element: , }, { path: '/tranches', element: , }, { path: '/withdrawals', element: , }, { path: '/vesting', element: , }, { path: Routes.PROTOCOL_UPGRADES, element: , }, ]; const routerConfig = [ { path: Routes.HOME, element: , }, { path: Routes.PROPOSALS, element: , children: [ { index: true, element: }, { path: 'propose', element: , children: [ { index: true, element: }, { path: 'network-parameter', element: , }, { path: 'new-market', element: , }, { path: 'update-market', element: , }, { path: 'new-asset', element: }, { path: 'update-asset', element: , }, { path: 'freeform', element: }, { path: 'raw', element: }, ], }, { path: 'proposals', element: }, { path: ':proposalId', element: }, { path: 'rejected', element: }, ], }, { path: `${Routes.PROTOCOL_UPGRADES}/:proposalReleaseTag/:proposalBlockHeight`, element: , }, { path: Routes.VALIDATORS, element: , children: [ { path: ':node', element: }, { index: true, element: , }, ], }, { path: Routes.REWARDS, element: , }, { path: Routes.TOKEN, // Not lazy as loaded when a user first hits the site children: [ { element: , index: true, }, { path: Routes.SUPPLY, element: , children: [ { index: true, element: }, { path: ':trancheId', element: }, ], }, { path: Routes.WITHDRAWALS, element: , }, { path: Routes.REDEEM, element: , children: [ { path: ':address', children: [ { index: true, element: , }, { path: ':id', element: , }, ], }, ], }, { path: 'associate', element: }, { path: 'disassociate', element: , }, ], }, { path: Routes.CLAIM, element: , }, { path: Routes.NOT_PERMITTED, // Not lazy as loaded when a user first hits the site element: , }, { path: Routes.CONTRACTS, element: , }, { path: Routes.DISCLAIMER, element: , }, { path: Routes.RESTRICTED, // Not lazy as loaded when a user first hits the site element: , }, { path: '*', // Also not lazy as loaded when a user first hits the site element: , }, ...redirects, ]; export default routerConfig;