Skip to content

Commit

Permalink
chore: refactor switch-account context
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-watters committed Aug 1, 2024
1 parent 826a074 commit ba132c4
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 34 deletions.
24 changes: 11 additions & 13 deletions src/app/components/layout/headers/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ import type { HasChildren } from '@app/common/has-children';

export function Header({ children, ...props }: HasChildren & BoxProps) {
return (
<>
<styled.header
justifyContent="center"
margin={{ base: 0, md: 'auto' }}
p="space.04"
bg="transparent"
maxWidth={{ base: '100vw', md: 'fullPageMaxWidth' }}
width="100%"
{...props}
>
{children}
</styled.header>
</>
<styled.header
justifyContent="center"
margin={{ base: 0, md: 'auto' }}
p="space.04"
bg="transparent"
maxWidth={{ base: '100vw', md: 'fullPageMaxWidth' }}
width="100%"
{...props}
>
{children}
</styled.header>
);
}
1 change: 0 additions & 1 deletion src/app/components/layout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export { Card } from './card/card';
export { CardContent } from './card/card-content';
export { AvailableBalance } from './footer/available-balance';

export { HomeLayout } from './layouts/home.layout';
export { Content } from './layouts/content.layout';
export { TwoColumnLayout } from './layouts/two-column.layout';
export { ContainerLayout } from './layouts/container.layout';
15 changes: 0 additions & 15 deletions src/app/components/layout/layouts/home.layout.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Outlet, useOutletContext } from 'react-router-dom';

import { SwitchAccountOutletContext } from '@shared/switch-account';

export function PageLayout() {
export function SwitchAccountLayout() {
const { isShowingSwitchAccount, setIsShowingSwitchAccount } =
useOutletContext<SwitchAccountOutletContext>();
return <Outlet context={{ isShowingSwitchAccount, setIsShowingSwitchAccount }} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Route } from 'react-router-dom';
import { RouteUrls } from '@shared/route-urls';

import { BroadcastErrorDialog } from '@app/components/broadcast-error-dialog/broadcast-error-dialog';
import { PageLayout } from '@app/components/layout/layouts/page.layout';
import { SwitchAccountLayout } from '@app/components/layout/layouts/switch-account.layout';

Check failure on line 7 in src/app/pages/send/send-crypto-asset-form/send-crypto-asset-form.routes.tsx

View workflow job for this annotation

GitHub Actions / typecheck

'SwitchAccountLayout' is declared but its value is never read.
import { FullPageWithHeaderLoadingSpinner } from '@app/components/loading-spinner';
import { EditNonceDialog } from '@app/features/dialogs/edit-nonce-dialog/edit-nonce-dialog';
import { ledgerBitcoinTxSigningRoutes } from '@app/features/ledger/flows/bitcoin-tx-signing/ledger-bitcoin-sign-tx-container';
Expand Down Expand Up @@ -43,7 +43,7 @@ const broadcastErrorDialogRoute = (
);

export const sendCryptoAssetFormRoutes = (
<Route element={<PageLayout />}>
<Route>
<Route
path={RouteUrls.SendCryptoAsset}
element={
Expand Down
7 changes: 5 additions & 2 deletions src/app/routes/app-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import * as Sentry from '@sentry/react';

import { RouteUrls } from '@shared/route-urls';

import { HomeLayout } from '@app/components/layout/layouts/home.layout';
import { Content } from '@app/components/layout/layouts/content.layout';
import { SwitchAccountLayout } from '@app/components/layout/layouts/switch-account.layout';
import { LoadingSpinner } from '@app/components/loading-spinner';
import { AddNetwork } from '@app/features/add-network/add-network';
import { Container } from '@app/features/container/container';
Expand Down Expand Up @@ -82,7 +83,9 @@ function useAppRoutes() {
element={
<>
<MainHeader hideBackButton />
<HomeLayout />
<Content>
<SwitchAccountLayout />
</Content>
</>
}
>
Expand Down

0 comments on commit ba132c4

Please sign in to comment.