Skip to content

Commit

Permalink
fix: remove staking routes in shared wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
greatertomi committed Sep 26, 2024
1 parent 3950345 commit 45dd20e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
42 changes: 23 additions & 19 deletions apps/browser-extension-wallet/src/routes/ExtensionRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,27 @@ import { AddressBook } from '../features/address-book';
import { Settings } from '../features/settings';
import { SignMessageDrawer } from '@views/browser/features/sign-message/SignMessageDrawer';
import { NftDetail, Nfts } from '@src/features/nfts';
import { useWalletStore } from '@stores';

export const ExtensionRoutes = (): React.ReactElement => (
<MainLayout>
<Switch>
<Route exact path={walletRoutePaths.assets} component={PopupAssets} />
<Route exact path={walletRoutePaths.receive} component={ReceiveInfoContainer} />
<Route exact path={walletRoutePaths.activity} component={Activity} />
<Route exact path={walletRoutePaths.send} component={Send} />
<Route exact path={walletRoutePaths.nftDetail} component={NftDetail} />
<Route exact path={walletRoutePaths.earn} component={DelegationContainer} />
<Route exact path={walletRoutePaths.addressBook} component={AddressBook} />
<Route exact path={walletRoutePaths.settings} component={Settings} />
<Route exact path={walletRoutePaths.signMessage} component={SignMessageDrawer} />
<Route exact path={walletRoutePaths.nfts} component={Nfts} />
<Route path="*" render={() => <Redirect to={walletRoutePaths.assets} />} />
</Switch>
{/* TODO: LW-7575 Remove old staking in post-MVP of multi delegation staking.*/}
<StakingWarningModals popupView />
</MainLayout>
);
export const ExtensionRoutes = (): React.ReactElement => {
const { isSharedWallet } = useWalletStore();
return (
<MainLayout>
<Switch>
<Route exact path={walletRoutePaths.assets} component={PopupAssets} />
<Route exact path={walletRoutePaths.receive} component={ReceiveInfoContainer} />
<Route exact path={walletRoutePaths.activity} component={Activity} />
<Route exact path={walletRoutePaths.send} component={Send} />
<Route exact path={walletRoutePaths.nftDetail} component={NftDetail} />
{!isSharedWallet && <Route exact path={walletRoutePaths.earn} component={DelegationContainer} />}
<Route exact path={walletRoutePaths.addressBook} component={AddressBook} />
<Route exact path={walletRoutePaths.settings} component={Settings} />
<Route exact path={walletRoutePaths.signMessage} component={SignMessageDrawer} />
<Route exact path={walletRoutePaths.nfts} component={Nfts} />
<Route path="*" render={() => <Redirect to={walletRoutePaths.assets} />} />
</Switch>
{/* TODO: LW-7575 Remove old staking in post-MVP of multi delegation staking.*/}
<StakingWarningModals popupView />
</MainLayout>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export const BrowserViewRoutes = ({ routesMap = defaultRoutes }: { routesMap?: R
deletingWallet,
stayOnAllDonePage,
cardanoWallet,
initialHdDiscoveryCompleted
initialHdDiscoveryCompleted,
isSharedWallet
} = useWalletStore();
const [{ chainName }] = useAppSettingsContext();
const { areExperimentsLoading } = useExperimentsContext();
Expand All @@ -112,6 +113,8 @@ export const BrowserViewRoutes = ({ routesMap = defaultRoutes }: { routesMap?: R

const location = useLocation<{ background?: Location<unknown> }>();

const currentRoutes = isSharedWallet ? routesMap.filter((route) => route.path !== routes.staking) : routesMap;

useEffect(() => {
const isCreatingWallet = [routes.newWallet.root, routes.sharedWallet.root].some((path) =>
location.pathname.startsWith(path)
Expand Down Expand Up @@ -188,7 +191,7 @@ export const BrowserViewRoutes = ({ routesMap = defaultRoutes }: { routesMap?: R
return (
<>
<Switch location={page || location}>
{routesMap.map((route) => (
{currentRoutes.map((route) => (
<Route key={route.path} path={route.path} component={route.component} />
))}
<Route path="*" render={() => <Redirect to={routes.assets} />} />
Expand Down

0 comments on commit 45dd20e

Please sign in to comment.