diff --git a/src/app/components/broadcast-error-dialog/broadcast-error-dialog.tsx b/src/app/components/broadcast-error-dialog/broadcast-error-dialog.tsx
index 946a40edfef..1bd742258f1 100644
--- a/src/app/components/broadcast-error-dialog/broadcast-error-dialog.tsx
+++ b/src/app/components/broadcast-error-dialog/broadcast-error-dialog.tsx
@@ -6,8 +6,8 @@ import get from 'lodash.get';
import { Button, Dialog } from '@leather.io/ui';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
+import { Footer } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
export function BroadcastErrorDialog() {
const navigate = useNavigate();
diff --git a/src/app/ui/layout/card/card-content.tsx b/src/app/components/layout/card/card-content.tsx
similarity index 100%
rename from src/app/ui/layout/card/card-content.tsx
rename to src/app/components/layout/card/card-content.tsx
diff --git a/src/app/ui/layout/card/card.stories.tsx b/src/app/components/layout/card/card.stories.tsx
similarity index 100%
rename from src/app/ui/layout/card/card.stories.tsx
rename to src/app/components/layout/card/card.stories.tsx
diff --git a/src/app/ui/layout/card/card.tsx b/src/app/components/layout/card/card.tsx
similarity index 100%
rename from src/app/ui/layout/card/card.tsx
rename to src/app/components/layout/card/card.tsx
diff --git a/src/app/ui/components/containers/headers/dialog-header.tsx b/src/app/components/layout/dialog-header.tsx
similarity index 66%
rename from src/app/ui/components/containers/headers/dialog-header.tsx
rename to src/app/components/layout/dialog-header.tsx
index 40d0f58093a..4fed3c77c90 100644
--- a/src/app/ui/components/containers/headers/dialog-header.tsx
+++ b/src/app/components/layout/dialog-header.tsx
@@ -7,9 +7,10 @@ import { CloseIcon, IconButton } from '@leather.io/ui';
interface DialogHeaderProps {
onClose?(): void;
title?: ReactNode;
+ variant?: 'default' | 'large';
}
-export function DialogHeader({ onClose, title }: DialogHeaderProps) {
+export function DialogHeader({ onClose, title, variant = 'default' }: DialogHeaderProps) {
return (
{title && (
-
+
{title}
)}
diff --git a/src/app/ui/components/containers/footers/available-balance.tsx b/src/app/components/layout/footer/available-balance.tsx
similarity index 100%
rename from src/app/ui/components/containers/footers/available-balance.tsx
rename to src/app/components/layout/footer/available-balance.tsx
diff --git a/src/app/ui/components/containers/footers/footer.stories.tsx b/src/app/components/layout/footer/footer.stories.tsx
similarity index 100%
rename from src/app/ui/components/containers/footers/footer.stories.tsx
rename to src/app/components/layout/footer/footer.stories.tsx
diff --git a/src/app/ui/components/containers/footers/footer.tsx b/src/app/components/layout/footer/footer.tsx
similarity index 100%
rename from src/app/ui/components/containers/footers/footer.tsx
rename to src/app/components/layout/footer/footer.tsx
diff --git a/src/app/ui/components/containers/headers/components/header-action-button.tsx b/src/app/components/layout/headers/header-action-button.tsx
similarity index 100%
rename from src/app/ui/components/containers/headers/components/header-action-button.tsx
rename to src/app/components/layout/headers/header-action-button.tsx
diff --git a/src/app/components/layout/headers/header-grid.tsx b/src/app/components/layout/headers/header-grid.tsx
new file mode 100644
index 00000000000..e48f7fed6df
--- /dev/null
+++ b/src/app/components/layout/headers/header-grid.tsx
@@ -0,0 +1,43 @@
+import { ChainID } from '@stacks/transactions';
+import { Flex, Grid, GridItem, type GridProps, HStack } from 'leather-styles/jsx';
+
+import { NetworkModeBadge } from '@leather.io/ui';
+
+import type { HasChildren } from '@app/common/has-children';
+import { useCurrentNetworkState } from '@app/store/networks/networks.hooks';
+
+interface HeaderGridProps extends GridProps {
+ leftCol: React.ReactNode;
+ centerCol?: React.ReactNode;
+ rightCol: React.ReactNode;
+}
+export function HeaderGrid({ leftCol, centerCol, rightCol, ...props }: HeaderGridProps) {
+ return (
+
+
+ {leftCol}
+
+ {centerCol && {centerCol}}
+ {rightCol}
+
+ );
+}
+
+export function HeaderGridRightCol({ children }: HasChildren) {
+ const { chain, name: chainName } = useCurrentNetworkState();
+ return (
+
+
+ {children}
+
+ );
+}
diff --git a/src/app/components/layout/headers/header.tsx b/src/app/components/layout/headers/header.tsx
new file mode 100644
index 00000000000..39ebd0ebb46
--- /dev/null
+++ b/src/app/components/layout/headers/header.tsx
@@ -0,0 +1,21 @@
+import { type BoxProps, styled } from 'leather-styles/jsx';
+
+import type { HasChildren } from '@app/common/has-children';
+
+export function Header({ children, ...props }: HasChildren & BoxProps) {
+ return (
+ <>
+
+ {children}
+
+ >
+ );
+}
diff --git a/src/app/components/layout/headers/logo-box.tsx b/src/app/components/layout/headers/logo-box.tsx
new file mode 100644
index 00000000000..0d64d7a16a6
--- /dev/null
+++ b/src/app/components/layout/headers/logo-box.tsx
@@ -0,0 +1,26 @@
+import { useNavigate } from 'react-router-dom';
+
+import { OnboardingSelectors } from '@tests/selectors/onboarding.selectors';
+import { Box } from 'leather-styles/jsx';
+
+import { Logo } from '@leather.io/ui';
+
+import { RouteUrls } from '@shared/route-urls';
+
+export function LogoBox({ isSessionLocked }: { isSessionLocked?: boolean | undefined }) {
+ const navigate = useNavigate();
+ return (
+
+ navigate(RouteUrls.Home)}
+ />
+
+ );
+}
diff --git a/src/app/components/layout/index.ts b/src/app/components/layout/index.ts
new file mode 100644
index 00000000000..0fd29519a0c
--- /dev/null
+++ b/src/app/components/layout/index.ts
@@ -0,0 +1,10 @@
+export { Page } from './page/page.layout';
+export { Footer } from './footer/footer';
+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';
diff --git a/src/app/components/layout/layouts/container.layout.tsx b/src/app/components/layout/layouts/container.layout.tsx
new file mode 100644
index 00000000000..78b8ca731bb
--- /dev/null
+++ b/src/app/components/layout/layouts/container.layout.tsx
@@ -0,0 +1,11 @@
+import { Flex } from 'leather-styles/jsx';
+
+import type { HasChildren } from '@app/common/has-children';
+
+export function ContainerLayout({ children }: HasChildren) {
+ return (
+
+ {children}
+
+ );
+}
diff --git a/src/app/components/layout/layouts/content.layout.tsx b/src/app/components/layout/layouts/content.layout.tsx
new file mode 100644
index 00000000000..80ce69e9175
--- /dev/null
+++ b/src/app/components/layout/layouts/content.layout.tsx
@@ -0,0 +1,11 @@
+import { Flex } from 'leather-styles/jsx';
+
+import type { HasChildren } from '@app/common/has-children';
+
+export function Content({ children }: HasChildren) {
+ return (
+
+ {children}
+
+ );
+}
diff --git a/src/app/components/layout/layouts/home.layout.tsx b/src/app/components/layout/layouts/home.layout.tsx
new file mode 100644
index 00000000000..a371b7d229f
--- /dev/null
+++ b/src/app/components/layout/layouts/home.layout.tsx
@@ -0,0 +1,15 @@
+import { Outlet, useOutletContext } from 'react-router-dom';
+
+import { SwitchAccountOutletContext } from '@shared/switch-account';
+
+import { Content } from '../layouts/content.layout';
+
+export function HomeLayout() {
+ const { isShowingSwitchAccount, setIsShowingSwitchAccount } =
+ useOutletContext();
+ return (
+
+
+
+ );
+}
diff --git a/src/app/components/layout/layouts/page.layout.tsx b/src/app/components/layout/layouts/page.layout.tsx
new file mode 100644
index 00000000000..5cab68681b4
--- /dev/null
+++ b/src/app/components/layout/layouts/page.layout.tsx
@@ -0,0 +1,9 @@
+import { Outlet, useOutletContext } from 'react-router-dom';
+
+import { SwitchAccountOutletContext } from '@shared/switch-account';
+
+export function PageLayout() {
+ const { isShowingSwitchAccount, setIsShowingSwitchAccount } =
+ useOutletContext();
+ return ;
+}
diff --git a/src/app/ui/pages/two-column.layout.stories.tsx b/src/app/components/layout/layouts/two-column.layout.stories.tsx
similarity index 100%
rename from src/app/ui/pages/two-column.layout.stories.tsx
rename to src/app/components/layout/layouts/two-column.layout.stories.tsx
diff --git a/src/app/ui/pages/two-column.layout.tsx b/src/app/components/layout/layouts/two-column.layout.tsx
similarity index 100%
rename from src/app/ui/pages/two-column.layout.tsx
rename to src/app/components/layout/layouts/two-column.layout.tsx
diff --git a/src/app/ui/layout/page/page.layout.stories.tsx b/src/app/components/layout/page/page.layout.stories.tsx
similarity index 83%
rename from src/app/ui/layout/page/page.layout.stories.tsx
rename to src/app/components/layout/page/page.layout.stories.tsx
index 8b972aa73d1..3034f56b11b 100644
--- a/src/app/ui/layout/page/page.layout.stories.tsx
+++ b/src/app/components/layout/page/page.layout.stories.tsx
@@ -1,6 +1,6 @@
import type { Meta } from '@storybook/react';
-import { Card } from '@app/ui/layout/card/card.stories';
+import { Card } from '@app/components/layout/card/card.stories';
import { Page as Component } from './page.layout';
diff --git a/src/app/ui/layout/page/page.layout.tsx b/src/app/components/layout/page/page.layout.tsx
similarity index 100%
rename from src/app/ui/layout/page/page.layout.tsx
rename to src/app/components/layout/page/page.layout.tsx
diff --git a/src/app/components/request-password.tsx b/src/app/components/request-password.tsx
index 7993607fc71..080aeefab16 100644
--- a/src/app/components/request-password.tsx
+++ b/src/app/components/request-password.tsx
@@ -10,9 +10,7 @@ import { analytics } from '@shared/utils/analytics';
import { useKeyActions } from '@app/common/hooks/use-key-actions';
import { buildEnterKeyEvent } from '@app/common/hooks/use-modifier-key';
import { WaitingMessages, useWaitingMessage } from '@app/common/hooks/use-waiting-message';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { Card } from '@app/ui/layout/card/card';
-import { Page } from '@app/ui/layout/page/page.layout';
+import { Card, Footer, Page } from '@app/components/layout';
import { ErrorLabel } from './error-label';
diff --git a/src/app/features/add-network/add-network.tsx b/src/app/features/add-network/add-network.tsx
index f3a23a4e31c..7328728f12e 100644
--- a/src/app/features/add-network/add-network.tsx
+++ b/src/app/features/add-network/add-network.tsx
@@ -5,8 +5,8 @@ import { Stack, styled } from 'leather-styles/jsx';
import { Button } from '@leather.io/ui';
import { ErrorLabel } from '@app/components/error-label';
-import { Card } from '@app/ui/layout/card/card';
-import { Page } from '@app/ui/layout/page/page.layout';
+import { Card, Content, Page } from '@app/components/layout';
+import { PageHeader } from '@app/features/container/headers/page.header';
import { AddNetworkForm } from './add-network-form';
import { useAddNetwork } from './use-add-network';
@@ -15,49 +15,58 @@ export function AddNetwork() {
const { error, initialFormValues, loading, onSubmit } = useAddNetwork();
return (
-
-
- {() => (
-
-
-
- )}
-
-
+
+ Use this form to add a new instance of the{' '}
+
+ Stacks Blockchain API
+ {' '}
+ or{' '}
+
+ Bitcoin Blockchain API
+
+ . Make sure you review and trust the host before you add it.
+
+
+ {error ? (
+ {error}
+ ) : null}
+
+
+
+
+ )}
+
+
+
+ >
);
}
diff --git a/src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx b/src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx
index 3a8933f4dfd..81a3ebcf260 100644
--- a/src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx
+++ b/src/app/features/asset-list/stacks/sip10-token-asset-list/sip10-token-asset-list.tsx
@@ -25,7 +25,7 @@ export function Sip10TokenAssetList({
{tokens.map(token => (
closeWindow());
useOnSignOut(() => closeWindow());
@@ -67,37 +34,8 @@ export function Container() {
useEffect(() => void analytics.page('view', `${pathname}`), [pathname]);
- const variant = getPageVariant(pathname);
-
- const displayHeader = !isLandingPage(pathname) && !isNoHeaderPopup(pathname);
- const isSessionLocked = getIsSessionLocked(pathname);
-
- // TODO: Refactor? This is very hard to manage with dynamic routes. Temporarily
- // added a fix to catch the swap route: '/swap/:base/:quote?'
- function getOnGoBackLocation(pathname: RouteUrls) {
- if (pathname.includes('/swap')) return navigate(RouteUrls.Home);
- switch (pathname) {
- case RouteUrls.Fund.replace(':currency', 'STX'):
- case RouteUrls.Fund.replace(':currency', 'BTC'):
- case RouteUrls.SendCryptoAssetForm.replace(':symbol', 'stx'):
- case RouteUrls.SendCryptoAssetForm.replace(':symbol', 'btc'):
- return navigate(RouteUrls.Home);
- case RouteUrls.SendStxConfirmation:
- return navigate(RouteUrls.SendCryptoAssetForm.replace(':symbol', 'stx'));
- case RouteUrls.SendBtcConfirmation:
- return navigate(RouteUrls.SendCryptoAssetForm.replace(':symbol', 'btc'));
- default:
- return navigate(-1);
- }
- }
-
if (!hasStateRehydrated) return ;
- const showLogoSm = variant === 'home' || isSessionLocked || isKnownPopupRoute(pathname);
- const hideSettings =
- isKnownPopupRoute(pathname) || isSummaryPage(pathname) || variant === 'onboarding';
-
- const isLogoClickable = variant !== 'home' && !isRpcRoute(pathname);
return (
<>
{isShowingSwitchAccount && (
@@ -106,76 +44,8 @@ export function Container() {
onClose={() => setIsShowingSwitchAccount(false)}
/>
)}
-
- getOnGoBackLocation(pathname) : undefined}
- onClose={isSummaryPage(pathname) ? () => navigate(RouteUrls.Home) : undefined}
- settingsMenu={
- hideSettings ? null : (
-
- }
- toggleSwitchAccount={() => setIsShowingSwitchAccount(!isShowingSwitchAccount)}
- />
- )
- }
- networkBadge={
-
- }
- title={getTitleFromUrl(pathname)}
- logo={
- !hideLogo(pathname) && (
-
- navigate(RouteUrls.Home) : undefined}
- />
-
- )
- }
- account={
- showAccountInfo(pathname) && (
-
- setIsShowingSwitchAccount(!isShowingSwitchAccount)
- }
- />
- }
- >
-
-
- )
- }
- totalBalance={
- showBalanceInfo(pathname) && (
-
- )
- }
- />
- ) : null
- }
- >
+
>
diff --git a/src/app/features/container/headers/main.header.tsx b/src/app/features/container/headers/main.header.tsx
new file mode 100644
index 00000000000..181f54031c7
--- /dev/null
+++ b/src/app/features/container/headers/main.header.tsx
@@ -0,0 +1,53 @@
+import { useNavigate, useOutletContext } from 'react-router-dom';
+
+import { SettingsSelectors } from '@tests/selectors/settings.selectors';
+import { SharedComponentsSelectors } from '@tests/selectors/shared-component.selectors';
+
+import { ArrowLeftIcon, HamburgerIcon } from '@leather.io/ui';
+
+import { SwitchAccountOutletContext } from '@shared/switch-account';
+
+import { Header } from '@app/components/layout/headers/header';
+import { HeaderActionButton } from '@app/components/layout/headers/header-action-button';
+import { HeaderGrid, HeaderGridRightCol } from '@app/components/layout/headers/header-grid';
+import { LogoBox } from '@app/components/layout/headers/logo-box';
+import { Settings } from '@app/features/settings/settings';
+
+interface MainHeaderProps {
+ hideBackButton?: boolean;
+ hideLogo?: boolean;
+}
+
+export function MainHeader({ hideBackButton = false, hideLogo = false }: MainHeaderProps) {
+ const { isShowingSwitchAccount, setIsShowingSwitchAccount } =
+ useOutletContext();
+ const navigate = useNavigate();
+ return (
+ <>
+
+
+ {!hideBackButton && (
+ }
+ onAction={() => navigate(-1)}
+ dataTestId={SharedComponentsSelectors.HeaderBackBtn}
+ />
+ )}
+ {!hideLogo && }
+ >
+ }
+ rightCol={
+
+ }
+ toggleSwitchAccount={() => setIsShowingSwitchAccount(!isShowingSwitchAccount)}
+ />
+
+ }
+ />
+
+ >
+ );
+}
diff --git a/src/app/features/container/headers/page.header.tsx b/src/app/features/container/headers/page.header.tsx
new file mode 100644
index 00000000000..acce74e4244
--- /dev/null
+++ b/src/app/features/container/headers/page.header.tsx
@@ -0,0 +1,83 @@
+import { useNavigate, useOutletContext } from 'react-router-dom';
+
+import { SettingsSelectors } from '@tests/selectors/settings.selectors';
+import { SharedComponentsSelectors } from '@tests/selectors/shared-component.selectors';
+import { styled } from 'leather-styles/jsx';
+
+import { ArrowLeftIcon, CloseIcon, HamburgerIcon } from '@leather.io/ui';
+
+import { RouteUrls } from '@shared/route-urls';
+import { SwitchAccountOutletContext } from '@shared/switch-account';
+
+import { Header } from '@app/components/layout/headers/header';
+import { HeaderActionButton } from '@app/components/layout/headers/header-action-button';
+import { HeaderGrid, HeaderGridRightCol } from '@app/components/layout/headers/header-grid';
+import { LogoBox } from '@app/components/layout/headers/logo-box';
+import { Settings } from '@app/features/settings/settings';
+
+interface PageHeaderProps {
+ title?: string;
+ isSummaryPage?: boolean;
+ isSessionLocked?: boolean;
+ isSettingsVisibleOnSm?: boolean;
+ onBackLocation?: RouteUrls;
+ onClose?(): void;
+}
+
+export function PageHeader({
+ title,
+ isSummaryPage,
+ isSessionLocked,
+ isSettingsVisibleOnSm,
+ onBackLocation,
+}: PageHeaderProps) {
+ const { isShowingSwitchAccount, setIsShowingSwitchAccount } =
+ useOutletContext();
+ const navigate = useNavigate();
+
+ // pages with nested dialogs specify onBackLocation to prevent navigate(-1) re-opening the dialog
+ const onGoBack = onBackLocation ? () => navigate(onBackLocation) : () => navigate(-1);
+ const canGoBack = !isSummaryPage && !isSessionLocked;
+
+ return (
+ <>
+
+
+ {canGoBack && (
+ }
+ onAction={onGoBack}
+ dataTestId={SharedComponentsSelectors.HeaderBackBtn}
+ />
+ )}
+
+ >
+ }
+ centerCol={title && {title}}
+ rightCol={
+
+ {isSummaryPage ? (
+ }
+ dataTestId={SharedComponentsSelectors.HeaderCloseBtn}
+ onAction={() => navigate(RouteUrls.Home)}
+ />
+ ) : (
+
+
+ }
+ toggleSwitchAccount={() => setIsShowingSwitchAccount(!isShowingSwitchAccount)}
+ />
+
+ )}
+
+ }
+ />
+
+ >
+ );
+}
diff --git a/src/app/features/container/headers/popup.header.tsx b/src/app/features/container/headers/popup.header.tsx
new file mode 100644
index 00000000000..c29a71c5d6f
--- /dev/null
+++ b/src/app/features/container/headers/popup.header.tsx
@@ -0,0 +1,53 @@
+import { useOutletContext } from 'react-router-dom';
+
+import { Box } from 'leather-styles/jsx';
+
+import { Flag, Logo } from '@leather.io/ui';
+
+import { SwitchAccountOutletContext } from '@shared/switch-account';
+
+import { Header } from '@app/components/layout/headers/header';
+import { HeaderGrid, HeaderGridRightCol } from '@app/components/layout/headers/header-grid';
+import { CurrentAccountAvatar } from '@app/features/current-account/current-account-avatar';
+import { CurrentAccountName } from '@app/features/current-account/current-account-name';
+import { TotalBalance } from '@app/features/total-balance/total-balance';
+
+interface PopupHeaderProps {
+ showSwitchAccount?: boolean;
+ balance?: 'all' | 'stx';
+}
+
+export function PopupHeader({ showSwitchAccount, balance }: PopupHeaderProps) {
+ const { isShowingSwitchAccount, setIsShowingSwitchAccount } =
+ useOutletContext();
+ return (
+
+
+ {showSwitchAccount ? (
+ }
+ onClick={() => setIsShowingSwitchAccount(!isShowingSwitchAccount)}
+ cursor="pointer"
+ >
+
+
+ ) : (
+
+
+
+ )}
+ >
+ }
+ rightCol={
+
+ {balance && }
+
+ }
+ />
+
+ );
+}
diff --git a/src/app/features/container/utils/get-popup-header.ts b/src/app/features/container/utils/get-popup-header.ts
deleted file mode 100644
index 52d71c014eb..00000000000
--- a/src/app/features/container/utils/get-popup-header.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-import { RouteUrls } from '@shared/route-urls';
-
-export function isRpcRoute(pathname: RouteUrls) {
- switch (pathname) {
- case RouteUrls.PsbtRequest:
- case RouteUrls.SignatureRequest:
- case RouteUrls.RpcStacksSignature:
- case RouteUrls.RpcSignBip322Message:
- case RouteUrls.RpcStacksSignature:
- case RouteUrls.RpcSignPsbt:
- case RouteUrls.RpcSignPsbtSummary:
- case RouteUrls.RpcSendTransfer:
- case RouteUrls.RpcSendTransferChooseFee:
- case RouteUrls.RpcSendTransferConfirmation:
- case RouteUrls.RpcSendTransferSummary:
- return true;
- default:
- return false;
- }
-}
-
-export function showAccountInfo(pathname: RouteUrls) {
- switch (pathname) {
- case RouteUrls.PsbtRequest:
- case RouteUrls.TransactionRequest:
- case RouteUrls.ProfileUpdateRequest:
- case RouteUrls.RpcSendTransfer:
- case RouteUrls.RpcSignPsbt:
- case RouteUrls.RpcSignBip322Message:
- case RouteUrls.SignatureRequest:
- case RouteUrls.RpcStacksSignature:
- return true;
- default:
- return false;
- }
-}
-
-export function showBalanceInfo(pathname: RouteUrls) {
- switch (pathname) {
- case RouteUrls.ProfileUpdateRequest:
- case RouteUrls.RpcSendTransfer:
- case RouteUrls.PsbtRequest:
- case RouteUrls.RpcSignBip322Message:
- case RouteUrls.RpcStacksSignature:
- case RouteUrls.TransactionRequest:
- return true;
- default:
- return false;
- }
-}
-
-export function getDisplayAddresssBalanceOf(pathname: RouteUrls) {
- switch (pathname) {
- case RouteUrls.ProfileUpdateRequest:
- case RouteUrls.RpcSendTransfer:
- case RouteUrls.PsbtRequest:
- case RouteUrls.RpcSignBip322Message:
- return 'all';
- case RouteUrls.RpcStacksSignature:
- case RouteUrls.TransactionRequest:
- default:
- return 'stx';
- }
-}
-
-export function isKnownPopupRoute(pathname: RouteUrls) {
- switch (pathname) {
- case RouteUrls.TransactionRequest:
- case RouteUrls.ProfileUpdateRequest:
- case RouteUrls.PsbtRequest:
- case RouteUrls.SignatureRequest:
- case RouteUrls.RpcGetAddresses:
- case RouteUrls.RpcSendTransfer:
- case RouteUrls.SignatureRequest:
- case RouteUrls.RpcSignBip322Message:
- case RouteUrls.RpcStacksSignature:
- case RouteUrls.RpcSignPsbt:
- case RouteUrls.RpcSignPsbtSummary:
- case RouteUrls.RpcSendTransfer:
- case RouteUrls.RpcSendTransferChooseFee:
- case RouteUrls.RpcSendTransferConfirmation:
- case RouteUrls.RpcSendTransferSummary:
- return true;
- default:
- return false;
- }
-}
diff --git a/src/app/features/container/utils/get-title-from-url.ts b/src/app/features/container/utils/get-title-from-url.ts
deleted file mode 100644
index c23fa79d6dc..00000000000
--- a/src/app/features/container/utils/get-title-from-url.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { RouteUrls } from '@shared/route-urls';
-
-export function getTitleFromUrl(pathname: RouteUrls) {
- if (pathname.match(RouteUrls.SendCryptoAsset)) {
- // don't show send on first step of send flow or popuop transfer
- if (pathname === RouteUrls.SendCryptoAsset) return undefined;
- if (pathname === RouteUrls.RpcSendTransfer) return undefined;
- return 'Send';
- }
-
- switch (pathname) {
- case RouteUrls.AddNetwork:
- return 'Add a network';
- case RouteUrls.SendBrc20ChooseFee:
- return 'Choose fee';
- case RouteUrls.SendBrc20Confirmation:
- case RouteUrls.SwapReview:
- case RouteUrls.SendBrc20Confirmation:
- case '/send/btc/confirm':
- return 'Review';
- case RouteUrls.Swap:
- return 'Swap';
- case RouteUrls.SentStxTxSummary:
- case RouteUrls.SentBtcTxSummary:
- return 'Sent';
- case RouteUrls.SentBrc20Summary:
- return 'Creating transfer inscription';
- case RouteUrls.SendBrc20Confirmation:
- default:
- return undefined;
- }
-}
diff --git a/src/app/features/container/utils/route-helpers.ts b/src/app/features/container/utils/route-helpers.ts
deleted file mode 100644
index 7e7f66f31fa..00000000000
--- a/src/app/features/container/utils/route-helpers.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import { RouteUrls } from '@shared/route-urls';
-
-import { isKnownPopupRoute } from './get-popup-header';
-
-function isHomePage(pathname: RouteUrls) {
- return (
- pathname === RouteUrls.Home ||
- pathname.match(RouteUrls.Activity) ||
- pathname.match(RouteUrls.Receive) ||
- pathname.match(RouteUrls.SendOrdinalInscription)
- );
-}
-
-export function isLandingPage(pathname: RouteUrls) {
- return pathname.match(RouteUrls.Onboarding); // need to match get-started/ledger
-}
-
-function isOnboardingPage(pathname: RouteUrls) {
- return (
- pathname === RouteUrls.BackUpSecretKey ||
- pathname === RouteUrls.SetPassword ||
- pathname === RouteUrls.SignIn ||
- pathname === RouteUrls.ViewSecretKey
- );
-}
-
-function isFundPage(pathname: RouteUrls) {
- return (
- pathname === RouteUrls.Fund.replace(':currency', 'STX') ||
- pathname === RouteUrls.Fund.replace(':currency', 'BTC')
- );
-}
-
-export function getPageVariant(pathname: RouteUrls) {
- if (isFundPage(pathname)) return 'fund';
- if (isHomePage(pathname)) return 'home';
- if (isOnboardingPage(pathname)) return 'onboarding';
- return 'page';
-}
-
-export function getIsSessionLocked(pathname: RouteUrls) {
- return pathname === RouteUrls.Unlock;
-}
-
-export function isSummaryPage(pathname: RouteUrls) {
- /* TODO refactor the summary routes to make this cleaner
- we need to block going back from summary pages catching the dynamic routes:
- SentBtcTxSummary = '/sent/btc/:txId',
- SentStxTxSummary = '/sent/stx/:txId',
- SentBrc20Summary = '/send/brc20/:ticker/summary',
- RpcSignPsbtSummary = '/sign-psbt/summary',
- RpcSendTransferSummary = '/send-transfer/summary',
- */
- return pathname.match('/sent/stx/') || pathname.match('/sent/btc/' || pathname.match('summary'));
-}
-
-export function canGoBack(pathname: RouteUrls) {
- if (getIsSessionLocked(pathname) || isKnownPopupRoute(pathname) || isSummaryPage(pathname)) {
- return false;
- }
- return true;
-}
-
-export function hideLogo(pathname: RouteUrls) {
- return pathname === RouteUrls.RpcGetAddresses || pathname === RouteUrls.ViewSecretKey;
-}
-
-export function isNoHeaderPopup(pathname: RouteUrls) {
- return pathname === RouteUrls.RpcGetAddresses || pathname === RouteUrls.ChooseAccount;
-}
-
-export function hideSettingsOnSm(pathname: RouteUrls) {
- switch (pathname) {
- case RouteUrls.SendCryptoAsset:
- case RouteUrls.FundChooseCurrency:
- return true;
- default:
- return false;
- }
-}
diff --git a/src/app/features/current-account/current-account-avatar.tsx b/src/app/features/current-account/current-account-avatar.tsx
index 0187c47fd33..11c4149113e 100644
--- a/src/app/features/current-account/current-account-avatar.tsx
+++ b/src/app/features/current-account/current-account-avatar.tsx
@@ -1,5 +1,3 @@
-import { memo } from 'react';
-
import { CircleProps } from 'leather-styles/jsx';
import { useCurrentAccountDisplayName } from '@app/common/hooks/account/use-account-names';
@@ -9,17 +7,12 @@ import { AccountAvatar } from '@app/ui/components/account/account-avatar/account
interface CurrentAccountAvatar extends CircleProps {
toggleSwitchAccount(): void;
}
-export const CurrentAccountAvatar = memo(({ toggleSwitchAccount }: CurrentAccountAvatar) => {
+export function CurrentAccountAvatar() {
const stacksAccount = useCurrentStacksAccount();
const { data: name = 'Account' } = useCurrentAccountDisplayName();
if (!stacksAccount) return null;
return (
- toggleSwitchAccount()}
- publicKey={stacksAccount.stxPublicKey}
- />
+
);
-});
+}
diff --git a/src/app/features/dialogs/edit-nonce-dialog/edit-nonce-dialog.tsx b/src/app/features/dialogs/edit-nonce-dialog/edit-nonce-dialog.tsx
index 35389fa1f3d..b4e85091017 100644
--- a/src/app/features/dialogs/edit-nonce-dialog/edit-nonce-dialog.tsx
+++ b/src/app/features/dialogs/edit-nonce-dialog/edit-nonce-dialog.tsx
@@ -10,7 +10,7 @@ import { StacksSendFormValues, StacksTransactionFormValues } from '@shared/model
import { useOnMount } from '@app/common/hooks/use-on-mount';
import { openInNewTab } from '@app/common/utils/open-in-new-tab';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { EditNonceForm } from './components/edit-nonce-form';
diff --git a/src/app/features/dialogs/increase-fee-dialog/increase-btc-fee-dialog.tsx b/src/app/features/dialogs/increase-fee-dialog/increase-btc-fee-dialog.tsx
index 8a382bca309..4b1176eaa3b 100644
--- a/src/app/features/dialogs/increase-fee-dialog/increase-btc-fee-dialog.tsx
+++ b/src/app/features/dialogs/increase-fee-dialog/increase-btc-fee-dialog.tsx
@@ -14,10 +14,10 @@ import { useLocationStateWithCache } from '@app/common/hooks/use-location-state'
import { getBitcoinTxValue } from '@app/common/transactions/bitcoin/utils';
import { BitcoinCustomFeeInput } from '@app/components/bitcoin-custom-fee/bitcoin-custom-fee-input';
import { BitcoinTransactionItem } from '@app/components/bitcoin-transaction-item/bitcoin-transaction-item';
+import { Footer } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { useBtcCryptoAssetBalanceNativeSegwit } from '@app/query/bitcoin/balance/btc-balance-native-segwit.hooks';
import { useCurrentAccountNativeSegwitIndexZeroSigner } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
import { IncreaseFeeActions } from './components/increase-fee-actions';
import { useBtcIncreaseFee } from './hooks/use-btc-increase-fee';
diff --git a/src/app/features/dialogs/increase-fee-dialog/increase-stx-fee-dialog.tsx b/src/app/features/dialogs/increase-fee-dialog/increase-stx-fee-dialog.tsx
index 00730e1e7c4..2f87abdfb4a 100644
--- a/src/app/features/dialogs/increase-fee-dialog/increase-stx-fee-dialog.tsx
+++ b/src/app/features/dialogs/increase-fee-dialog/increase-stx-fee-dialog.tsx
@@ -21,14 +21,14 @@ import { useRefreshAllAccountData } from '@app/common/hooks/account/use-refresh-
import { stacksValue } from '@app/common/stacks-utils';
import { safelyFormatHexTxid } from '@app/common/utils/safe-handle-txid';
import { stxFeeValidator } from '@app/common/validation/forms/fee-validators';
+import { Footer } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { LoadingSpinner } from '@app/components/loading-spinner';
import { StacksTransactionItem } from '@app/components/stacks-transaction-item/stacks-transaction-item';
import { useStacksBroadcastTransaction } from '@app/features/stacks-transaction-request/hooks/use-stacks-broadcast-transaction';
import { useToast } from '@app/features/toasts/use-toast';
import { useCurrentStacksAccountAddress } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
import { useSubmittedTransactionsActions } from '@app/store/submitted-transactions/submitted-transactions.hooks';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
import { IncreaseFeeActions } from './components/increase-fee-actions';
import { IncreaseFeeField } from './components/increase-fee-field';
diff --git a/src/app/features/dialogs/switch-account-dialog/switch-account-dialog.tsx b/src/app/features/dialogs/switch-account-dialog/switch-account-dialog.tsx
index 79067374066..617e6b2aa98 100644
--- a/src/app/features/dialogs/switch-account-dialog/switch-account-dialog.tsx
+++ b/src/app/features/dialogs/switch-account-dialog/switch-account-dialog.tsx
@@ -7,27 +7,23 @@ import { Button, Dialog } from '@leather.io/ui';
import { useCreateAccount } from '@app/common/hooks/account/use-create-account';
import { useWalletType } from '@app/common/use-wallet-type';
+import { Footer } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { useCurrentAccountIndex } from '@app/store/accounts/account';
import { useFilteredBitcoinAccounts } from '@app/store/accounts/blockchain/bitcoin/bitcoin.ledger';
import { useStacksAccounts } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
import { VirtuosoWrapper } from '@app/ui/components/virtuoso';
import { AccountListUnavailable } from './components/account-list-unavailable';
import { SwitchAccountListItem } from './components/switch-account-list-item';
-export interface SwitchAccountOutletContext {
- isShowingSwitchAccount: boolean;
- setIsShowingSwitchAccount(isShowing: boolean): void;
-}
-
interface SwitchAccountDialogProps {
isShowing: boolean;
onClose(): void;
}
export const SwitchAccountDialog = memo(({ isShowing, onClose }: SwitchAccountDialogProps) => {
+ console.info('SwitchAccountDialog render', isShowing);
const currentAccountIndex = useCurrentAccountIndex();
const createAccount = useCreateAccount();
const { whenWallet } = useWalletType();
diff --git a/src/app/features/ledger/flows/jwt-signing/ledger-sign-jwt-container.tsx b/src/app/features/ledger/flows/jwt-signing/ledger-sign-jwt-container.tsx
index 975596b33a7..d6622cd8b9f 100644
--- a/src/app/features/ledger/flows/jwt-signing/ledger-sign-jwt-container.tsx
+++ b/src/app/features/ledger/flows/jwt-signing/ledger-sign-jwt-container.tsx
@@ -17,6 +17,7 @@ import { useDefaultRequestParams } from '@app/common/hooks/use-default-request-s
import { useKeyActions } from '@app/common/hooks/use-key-actions';
import { useScrollLock } from '@app/common/hooks/use-scroll-lock';
import { makeLedgerCompatibleUnsignedAuthResponsePayload } from '@app/common/unsafe-auth-response';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { useCancelLedgerAction } from '@app/features/ledger/utils/generic-ledger-utils';
import {
getStacksAppVersion,
@@ -26,7 +27,6 @@ import {
useCurrentStacksAccount,
useStacksAccounts,
} from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
import { useLedgerNavigate } from '../../hooks/use-ledger-navigate';
import { checkLockedDeviceError, useLedgerResponseState } from '../../utils/generic-ledger-utils';
diff --git a/src/app/features/ledger/flows/stacks-message-signing/ledger-stacks-sign-msg-container.tsx b/src/app/features/ledger/flows/stacks-message-signing/ledger-stacks-sign-msg-container.tsx
index c0436f993c7..fe0a7462c6e 100644
--- a/src/app/features/ledger/flows/stacks-message-signing/ledger-stacks-sign-msg-container.tsx
+++ b/src/app/features/ledger/flows/stacks-message-signing/ledger-stacks-sign-msg-container.tsx
@@ -12,6 +12,7 @@ import { UnsignedMessage, whenSignableMessageOfType } from '@shared/signature/si
import { useScrollLock } from '@app/common/hooks/use-scroll-lock';
import { appEvents } from '@app/common/publish-subscribe';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { useCancelLedgerAction } from '@app/features/ledger/utils/generic-ledger-utils';
import {
getStacksAppVersion,
@@ -21,7 +22,6 @@ import {
} from '@app/features/ledger/utils/stacks-ledger-utils';
import { useCurrentStacksAccount } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
import { StacksAccount } from '@app/store/accounts/blockchain/stacks/stacks-account.models';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
import { useLedgerAnalytics } from '../../hooks/use-ledger-analytics.hook';
import { useLedgerNavigate } from '../../hooks/use-ledger-navigate';
diff --git a/src/app/features/ledger/generic-flows/request-keys/request-keys-flow.tsx b/src/app/features/ledger/generic-flows/request-keys/request-keys-flow.tsx
index 5be63817bbc..29727e22fe0 100644
--- a/src/app/features/ledger/generic-flows/request-keys/request-keys-flow.tsx
+++ b/src/app/features/ledger/generic-flows/request-keys/request-keys-flow.tsx
@@ -3,7 +3,7 @@ import { Outlet } from 'react-router-dom';
import { Dialog } from '@leather.io/ui';
import { useScrollLock } from '@app/common/hooks/use-scroll-lock';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { useLedgerNavigate } from '../../hooks/use-ledger-navigate';
import { LedgerRequestKeysContext, LedgerRequestKeysProvider } from './ledger-request-keys.context';
diff --git a/src/app/features/ledger/generic-flows/tx-signing/tx-signing-flow.tsx b/src/app/features/ledger/generic-flows/tx-signing/tx-signing-flow.tsx
index b08d07d70a7..c1c05c1b55a 100644
--- a/src/app/features/ledger/generic-flows/tx-signing/tx-signing-flow.tsx
+++ b/src/app/features/ledger/generic-flows/tx-signing/tx-signing-flow.tsx
@@ -3,7 +3,7 @@ import { Outlet } from 'react-router-dom';
import { Dialog } from '@leather.io/ui';
import { useScrollLock } from '@app/common/hooks/use-scroll-lock';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { LedgerTxSigningContext, LedgerTxSigningProvider } from './ledger-sign-tx.context';
diff --git a/src/app/features/ledger/generic-steps/connect-device/connect-ledger-start.tsx b/src/app/features/ledger/generic-steps/connect-device/connect-ledger-start.tsx
index 9db6583a8aa..a749aca2443 100644
--- a/src/app/features/ledger/generic-steps/connect-device/connect-ledger-start.tsx
+++ b/src/app/features/ledger/generic-steps/connect-device/connect-ledger-start.tsx
@@ -7,7 +7,7 @@ import { closeWindow } from '@shared/utils';
import { doesBrowserSupportWebUsbApi, whenPageMode } from '@app/common/utils';
import { openIndexPageInNewTab } from '@app/common/utils/open-in-new-tab';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { immediatelyAttemptLedgerConnection } from '../../hooks/use-when-reattempt-ledger-connection';
import { ConnectLedger } from './connect-ledger';
diff --git a/src/app/features/ledger/generic-steps/unsupported-browser/unsupported-browser.layout.tsx b/src/app/features/ledger/generic-steps/unsupported-browser/unsupported-browser.layout.tsx
index 4486d86e91e..7d795b5605c 100644
--- a/src/app/features/ledger/generic-steps/unsupported-browser/unsupported-browser.layout.tsx
+++ b/src/app/features/ledger/generic-steps/unsupported-browser/unsupported-browser.layout.tsx
@@ -4,8 +4,8 @@ import { styled } from 'leather-styles/jsx';
import { Dialog, Link } from '@leather.io/ui';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { UnsupportedBrowserImg } from '@app/features/ledger/illustrations/ledger-illu-unsupported-browser';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
import { LedgerTitle } from '../../components/ledger-title';
import { LedgerWrapper } from '../../components/ledger-wrapper';
diff --git a/src/app/features/psbt-signer/components/psbt-request-actions.tsx b/src/app/features/psbt-signer/components/psbt-request-actions.tsx
index 6b8746b8b7f..d940cc6d347 100644
--- a/src/app/features/psbt-signer/components/psbt-request-actions.tsx
+++ b/src/app/features/psbt-signer/components/psbt-request-actions.tsx
@@ -1,6 +1,6 @@
import { Button } from '@leather.io/ui';
-import { Footer } from '@app/ui/components/containers/footers/footer';
+import { Footer } from '@app/components/layout';
interface PsbtRequestActionsProps {
isLoading?: boolean;
diff --git a/src/app/features/psbt-signer/psbt-signer.tsx b/src/app/features/psbt-signer/psbt-signer.tsx
index 50073036c2d..6a426654206 100644
--- a/src/app/features/psbt-signer/psbt-signer.tsx
+++ b/src/app/features/psbt-signer/psbt-signer.tsx
@@ -11,13 +11,14 @@ import { RouteUrls } from '@shared/route-urls';
import { closeWindow } from '@shared/utils';
import { SignPsbtArgs } from '@app/common/psbt/requests';
+import { Footer } from '@app/components/layout';
+import { CardContent } from '@app/components/layout';
+import { Card } from '@app/components/layout';
+import { PopupHeader } from '@app/features/container/headers/popup.header';
import { useBreakOnNonCompliantEntity } from '@app/query/common/compliance-checker/compliance-checker.query';
import { useOnOriginTabClose } from '@app/routes/hooks/use-on-tab-closed';
import { useCurrentAccountNativeSegwitIndexZeroSigner } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
import { useCurrentAccountTaprootIndexZeroSigner } from '@app/store/accounts/blockchain/bitcoin/taproot-account.hooks';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { Card } from '@app/ui/layout/card/card';
-import { CardContent } from '@app/ui/layout/card/card-content';
import * as Psbt from './components';
import { usePsbtDetails } from './hooks/use-psbt-details';
@@ -93,6 +94,7 @@ export function PsbtSigner(props: PsbtSignerProps) {
return (
+
diff --git a/src/app/features/retrieve-taproot-to-native-segwit/components/retrieve-taproot-to-native-segwit.layout.tsx b/src/app/features/retrieve-taproot-to-native-segwit/components/retrieve-taproot-to-native-segwit.layout.tsx
index d72d6a97620..7e1b60b1422 100644
--- a/src/app/features/retrieve-taproot-to-native-segwit/components/retrieve-taproot-to-native-segwit.layout.tsx
+++ b/src/app/features/retrieve-taproot-to-native-segwit/components/retrieve-taproot-to-native-segwit.layout.tsx
@@ -2,9 +2,9 @@ import { Flex, styled } from 'leather-styles/jsx';
import { BtcAvatarIcon, Button, Callout, Dialog } from '@leather.io/ui';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
-import { Card } from '@app/ui/layout/card/card';
+import { Footer } from '@app/components/layout';
+import { Card } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
interface RetrieveTaprootToNativeSegwitLayoutProps {
isBroadcasting: boolean;
diff --git a/src/app/features/settings/network/network.tsx b/src/app/features/settings/network/network.tsx
index a79ef308ab0..c35adafa658 100644
--- a/src/app/features/settings/network/network.tsx
+++ b/src/app/features/settings/network/network.tsx
@@ -8,11 +8,11 @@ import { Button, Dialog } from '@leather.io/ui';
import { RouteUrls } from '@shared/route-urls';
import { analytics } from '@shared/utils/analytics';
+import { Footer } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { NetworkListItem } from '@app/features/settings/network/network-list-item';
import { useCurrentNetworkState, useNetworksActions } from '@app/store/networks/networks.hooks';
import { useNetworks } from '@app/store/networks/networks.selectors';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
const defaultNetworkIds = Object.values(WalletDefaultNetworkConfigurationIds) as string[];
diff --git a/src/app/features/settings/sign-out/sign-out.tsx b/src/app/features/settings/sign-out/sign-out.tsx
index 04e83ee6e6b..1ced3982d6a 100644
--- a/src/app/features/settings/sign-out/sign-out.tsx
+++ b/src/app/features/settings/sign-out/sign-out.tsx
@@ -5,8 +5,8 @@ import { Flex, HStack, styled } from 'leather-styles/jsx';
import { Button, Callout, Dialog } from '@leather.io/ui';
import { useWalletType } from '@app/common/use-wallet-type';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
+import { Footer } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
interface SignOutDialogProps {
isShowing: boolean;
diff --git a/src/app/features/settings/theme/theme-dialog.tsx b/src/app/features/settings/theme/theme-dialog.tsx
index 96cd5117739..ac7e0ef14a9 100644
--- a/src/app/features/settings/theme/theme-dialog.tsx
+++ b/src/app/features/settings/theme/theme-dialog.tsx
@@ -5,7 +5,7 @@ import { Dialog } from '@leather.io/ui';
import { analytics } from '@shared/utils/analytics';
import { UserSelectedTheme, themeLabelMap, useThemeSwitcher } from '@app/common/theme-provider';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { ThemeListItem } from './theme-list-item';
diff --git a/src/app/features/stacks-high-fee-warning/stacks-high-fee-dialog.tsx b/src/app/features/stacks-high-fee-warning/stacks-high-fee-dialog.tsx
index 9ebcd5850e7..d93d699812d 100644
--- a/src/app/features/stacks-high-fee-warning/stacks-high-fee-dialog.tsx
+++ b/src/app/features/stacks-high-fee-warning/stacks-high-fee-dialog.tsx
@@ -7,8 +7,8 @@ import { Button, Caption, Dialog, ErrorIcon, Link, Title } from '@leather.io/ui'
import { StacksSendFormValues } from '@shared/models/form.model';
import { openInNewTab } from '@app/common/utils/open-in-new-tab';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { DialogHeader } from '@app/ui/components/containers/headers/dialog-header';
+import { Footer } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { useStacksHighFeeWarningContext } from './stacks-high-fee-warning-container';
diff --git a/src/app/features/container/total-balance.tsx b/src/app/features/total-balance/total-balance.tsx
similarity index 100%
rename from src/app/features/container/total-balance.tsx
rename to src/app/features/total-balance/total-balance.tsx
diff --git a/src/app/pages/choose-account/choose-account.tsx b/src/app/pages/choose-account/choose-account.tsx
index c8994846588..697e6780e4e 100644
--- a/src/app/pages/choose-account/choose-account.tsx
+++ b/src/app/pages/choose-account/choose-account.tsx
@@ -10,6 +10,7 @@ import { closeWindow } from '@shared/utils';
import { useCancelAuthRequest } from '@app/common/authentication/use-cancel-auth-request';
import { useAppDetails } from '@app/common/hooks/auth/use-app-details';
import { RequesterFlag } from '@app/components/requester-flag';
+// import { Content } from '@app/components/layout';
import { ChooseAccountsList } from '@app/pages/choose-account/components/accounts';
import { useOnOriginTabClose } from '@app/routes/hooks/use-on-tab-closed';
import { useStacksAccounts } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
diff --git a/src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx b/src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx
index d67188eab31..8dbbf6e9e45 100644
--- a/src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx
+++ b/src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx
@@ -5,18 +5,17 @@ import { Stack, styled } from 'leather-styles/jsx';
import { RouteUrls } from '@shared/route-urls';
+import { Card, Content, Page } from '@app/components/layout';
import { BitcoinNativeSegwitAccountLoader } from '@app/components/loaders/bitcoin-account-loader';
import { BtcAssetItemBalanceLoader } from '@app/components/loaders/btc-balance-loader';
import { CurrentStacksAccountLoader } from '@app/components/loaders/stacks-account-loader';
import { StxAssetItemBalanceLoader } from '@app/components/loaders/stx-balance-loader';
import { BtcCryptoAssetItem } from '@app/features/asset-list/bitcoin/btc-crypto-asset-item/btc-crypto-asset-item';
import { StxCryptoAssetItem } from '@app/features/asset-list/stacks/stx-crypo-asset-item/stx-crypto-asset-item';
-import { Card } from '@app/ui/layout/card/card';
-import { Page } from '@app/ui/layout/page/page.layout';
+import { PageHeader } from '@app/features/container/headers/page.header';
export function ChooseCryptoAssetToFund() {
const navigate = useNavigate();
-
const navigateToFund = useCallback(
(symbol: string) => navigate(RouteUrls.Fund.replace(':currency', symbol)),
[navigate]
@@ -24,46 +23,49 @@ export function ChooseCryptoAssetToFund() {
return (
<>
-
-
- choose asset to fund
-
- }
- >
-
-
- {signer => (
-
- {(balance, isLoading) => (
- navigateToFund('BTC')}
- />
- )}
-
- )}
-
+
+
+
+
+ choose asset to fund
+
+ }
+ >
+
+
+ {signer => (
+
+ {(balance, isLoading) => (
+ navigateToFund('BTC')}
+ />
+ )}
+
+ )}
+
-
- {account => (
-
- {(balance, isLoading) => (
- navigateToFund('STX')}
- />
- )}
-
- )}
-
-
-
-
-
+
+ {account => (
+
+ {(balance, isLoading) => (
+ navigateToFund('STX')}
+ />
+ )}
+
+ )}
+
+
+
+
+
+
>
);
}
diff --git a/src/app/pages/fund/fund.tsx b/src/app/pages/fund/fund.tsx
index 506bf98b4e4..9a895a7bcff 100644
--- a/src/app/pages/fund/fund.tsx
+++ b/src/app/pages/fund/fund.tsx
@@ -9,7 +9,9 @@ import type {
import { RouteUrls } from '@shared/route-urls';
+import { Content } from '@app/components/layout';
import { FullPageLoadingSpinner } from '@app/components/loading-spinner';
+import { PageHeader } from '@app/features/container/headers/page.header';
import { useCurrentAccountNativeSegwitIndexZeroSignerNullable } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
import { useCurrentStacksAccount } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
@@ -51,10 +53,13 @@ export function FundPage() {
return (
<>
-
-
-
-
+
+
+
+
+
+
+
>
);
}
diff --git a/src/app/pages/home/home.tsx b/src/app/pages/home/home.tsx
index 0e323f01bd3..9ac3c77b0c2 100644
--- a/src/app/pages/home/home.tsx
+++ b/src/app/pages/home/home.tsx
@@ -1,13 +1,16 @@
import { Route, useNavigate, useOutletContext } from 'react-router-dom';
+import { HomePageSelectors } from '@tests/selectors/home.selectors';
+import { Box, Stack } from 'leather-styles/jsx';
+
import { RouteUrls } from '@shared/route-urls';
+import { SwitchAccountOutletContext } from '@shared/switch-account';
import { useAccountDisplayName } from '@app/common/hooks/account/use-account-names';
import { useOnboardingState } from '@app/common/hooks/auth/use-onboarding-state';
import { useTotalBalance } from '@app/common/hooks/balance/use-total-balance';
import { useOnMount } from '@app/common/hooks/use-on-mount';
import { ActivityList } from '@app/features/activity-list/activity-list';
-import { SwitchAccountOutletContext } from '@app/features/dialogs/switch-account-dialog/switch-account-dialog';
import { FeedbackButton } from '@app/features/feedback-button/feedback-button';
import { Assets } from '@app/pages/home/components/assets';
import { homePageModalRoutes } from '@app/routes/app-routes';
@@ -16,15 +19,14 @@ import { useCurrentAccountIndex } from '@app/store/accounts/account';
import { useCurrentAccountNativeSegwitAddressIndexZero } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
import { useCurrentStacksAccount } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
import { AccountCard } from '@app/ui/components/account/account.card';
-import { HomeLayout } from '@app/ui/pages/home.layout';
import { AccountActions } from './components/account-actions';
import { HomeTabs } from './components/home-tabs';
export function Home() {
- const { decodedAuthRequest } = useOnboardingState();
const { isShowingSwitchAccount, setIsShowingSwitchAccount } =
useOutletContext();
+ const { decodedAuthRequest } = useOnboardingState();
const navigate = useNavigate();
const account = useCurrentStacksAccount();
const currentAccountIndex = useCurrentAccountIndex();
@@ -45,8 +47,19 @@ export function Home() {
});
return (
-
+
- }
- >
+
@@ -68,6 +80,6 @@ export function Home() {
{homePageModalRoutes}
-
+
);
}
diff --git a/src/app/pages/onboarding/back-up-secret-key/back-up-secret-key.tsx b/src/app/pages/onboarding/back-up-secret-key/back-up-secret-key.tsx
index 7ee4ff0de05..c18fedb833a 100644
--- a/src/app/pages/onboarding/back-up-secret-key/back-up-secret-key.tsx
+++ b/src/app/pages/onboarding/back-up-secret-key/back-up-secret-key.tsx
@@ -7,9 +7,10 @@ import { EyeSlashIcon, KeyIcon, LockIcon } from '@leather.io/ui';
import { RouteUrls } from '@shared/route-urls';
+import { Content, TwoColumnLayout } from '@app/components/layout';
+import { MainHeader } from '@app/features/container/headers/main.header';
import { SecretKey } from '@app/features/secret-key-displayer/secret-key-displayer';
import { useDefaultWalletSecretKey } from '@app/store/in-memory-key/in-memory-key.selectors';
-import { TwoColumnLayout } from '@app/ui/pages/two-column.layout';
export const BackUpSecretKeyPage = memo(() => {
const secretKey = useDefaultWalletSecretKey();
@@ -22,38 +23,43 @@ export const BackUpSecretKeyPage = memo(() => {
if (!secretKey) return null;
return (
- Back up your Secret Key>}
- content={
- <>
- You'll need it to access your wallet on a new device, or this one if you lose your
- password — so back it up somewhere safe!
- >
- }
- action={
-
-
-
-
- Your Secret Key gives access to your wallet
-
-
-
-
-
- Never share your Secret Key with anyone
-
-
-
-
-
- Store it somewhere 100% private and secure
-
-
-
- }
- >
-
-
+ <>
+
+
+ Back up your Secret Key>}
+ content={
+ <>
+ You'll need it to access your wallet on a new device, or this one if you lose your
+ password — so back it up somewhere safe!
+ >
+ }
+ action={
+
+
+
+
+ Your Secret Key gives access to your wallet
+
+
+
+
+
+ Never share your Secret Key with anyone
+
+
+
+
+
+ Store it somewhere 100% private and secure
+
+
+
+ }
+ >
+
+
+
+ >
);
});
diff --git a/src/app/pages/onboarding/set-password/set-password.tsx b/src/app/pages/onboarding/set-password/set-password.tsx
index b2b8fa4dffe..d3804961b10 100644
--- a/src/app/pages/onboarding/set-password/set-password.tsx
+++ b/src/app/pages/onboarding/set-password/set-password.tsx
@@ -19,9 +19,10 @@ import {
blankPasswordValidation,
validatePassword,
} from '@app/common/validation/validate-password';
+import { Content, TwoColumnLayout } from '@app/components/layout';
+import { MainHeader } from '@app/features/container/headers/main.header';
import { OnboardingGate } from '@app/routes/onboarding-gate';
import { useStacksAccounts } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
-import { TwoColumnLayout } from '@app/ui/pages/two-column.layout';
import { PasswordField } from './components/password-field';
@@ -49,7 +50,7 @@ function SetPasswordPage() {
const finishSignIn = useFinishAuthRequest();
const navigate = useNavigate();
const { decodedAuthRequest } = useOnboardingState();
-
+ debugger;
useEffect(() => {
void analytics.page('view', '/set-password');
}, []);
@@ -109,46 +110,51 @@ function SetPasswordPage() {
}),
});
return (
-
- {({ dirty, isSubmitting, isValid }) => (
-
-
- Set a
- password
- >
- }
- content={
- <>
- Your password protects your Secret Key on this device only. To access your wallet on
- another device, you'll need just your Secret Key.
- >
- }
- >
- <>
-
-
- >
-
-
- )}
-
+ <>
+
+
+ >
+
+
+ )}
+
+
+ >
);
}
diff --git a/src/app/pages/onboarding/sign-in/sign-in.tsx b/src/app/pages/onboarding/sign-in/sign-in.tsx
index 6f20c5a85ec..17c00d096a0 100644
--- a/src/app/pages/onboarding/sign-in/sign-in.tsx
+++ b/src/app/pages/onboarding/sign-in/sign-in.tsx
@@ -3,8 +3,9 @@ import { useEffect, useState } from 'react';
import { Link } from '@leather.io/ui';
import { createNullArrayOfLength } from '@leather.io/utils';
+import { Content, TwoColumnLayout } from '@app/components/layout';
+import { MainHeader } from '@app/features/container/headers/main.header';
import { MnemonicForm } from '@app/pages/onboarding/sign-in/mnemonic-form';
-import { TwoColumnLayout } from '@app/ui/pages/two-column.layout';
export function SignIn() {
const [twentyFourWordMode, setTwentyFourWordMode] = useState(true);
@@ -18,29 +19,34 @@ export function SignIn() {
}, [twentyFourWordMode]);
return (
-
- Sign in with your Secret Key
- >
- }
- content={<>Speed things up by pasting your entire Secret Key in one go.>}
- action={
- setTwentyFourWordMode(!twentyFourWordMode)}
- textStyle="label.03"
- width="fit-content"
- variant="text"
+ <>
+
+
+
+ Sign in with your Secret Key
+ >
+ }
+ content={<>Speed things up by pasting your entire Secret Key in one go.>}
+ action={
+ setTwentyFourWordMode(!twentyFourWordMode)}
+ textStyle="label.03"
+ width="fit-content"
+ variant="text"
+ >
+ {twentyFourWordMode ? 'Have a 12-word Secret Key?' : 'Use 24 word Secret Key'}
+
+ }
>
- {twentyFourWordMode ? 'Have a 12-word Secret Key?' : 'Use 24 word Secret Key'}
-
- }
- >
-
-
+
+
+
+ >
);
}
diff --git a/src/app/ui/pages/welcome.layout.tsx b/src/app/pages/onboarding/welcome/welcome.layout.tsx
similarity index 100%
rename from src/app/ui/pages/welcome.layout.tsx
rename to src/app/pages/onboarding/welcome/welcome.layout.tsx
diff --git a/src/app/pages/onboarding/welcome/welcome.tsx b/src/app/pages/onboarding/welcome/welcome.tsx
index 5b1b4c98de5..bdeca0af3bf 100644
--- a/src/app/pages/onboarding/welcome/welcome.tsx
+++ b/src/app/pages/onboarding/welcome/welcome.tsx
@@ -9,7 +9,8 @@ import { useOnboardingState } from '@app/common/hooks/auth/use-onboarding-state'
import { useKeyActions } from '@app/common/hooks/use-key-actions';
import { doesBrowserSupportWebUsbApi, isPopupMode, whenPageMode } from '@app/common/utils';
import { openIndexPageInNewTab } from '@app/common/utils/open-in-new-tab';
-import { WelcomeLayout } from '@app/ui/pages/welcome.layout';
+
+import { WelcomeLayout } from './welcome.layout';
export function WelcomePage() {
const navigate = useNavigate();
diff --git a/src/app/pages/receive/components/receive-tokens.layout.tsx b/src/app/pages/receive/components/receive-tokens.layout.tsx
index d476f84da4a..69c95e6d455 100644
--- a/src/app/pages/receive/components/receive-tokens.layout.tsx
+++ b/src/app/pages/receive/components/receive-tokens.layout.tsx
@@ -8,9 +8,9 @@ import { token } from 'leather-styles/tokens';
import { AddressDisplayer, Button, Dialog } from '@leather.io/ui';
import { useLocationState } from '@app/common/hooks/use-location-state';
+import { Footer } from '@app/components/layout';
+import { DialogHeader } from '@app/components/layout/dialog-header';
import { useBackgroundLocationRedirect } from '@app/routes/hooks/use-background-location-redirect';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { Header } from '@app/ui/components/containers/headers/header';
interface ReceiveTokensLayoutProps {
address: string;
@@ -29,14 +29,14 @@ export function ReceiveTokensLayout(props: ReceiveTokensLayoutProps) {
return (
-
-
- );
- }}
-
-
+
+
+ );
+ }}
+
+
+
+
+ >
);
}
diff --git a/src/app/pages/send/send-crypto-asset-form/form/btc/btc-choose-fee.tsx b/src/app/pages/send/send-crypto-asset-form/form/btc/btc-choose-fee.tsx
index 7a08c2c58ed..768f93630cc 100644
--- a/src/app/pages/send/send-crypto-asset-form/form/btc/btc-choose-fee.tsx
+++ b/src/app/pages/send/send-crypto-asset-form/form/btc/btc-choose-fee.tsx
@@ -8,8 +8,10 @@ import { BitcoinSendFormValues } from '@shared/models/form.model';
import { useLocationStateWithCache } from '@app/common/hooks/use-location-state';
import { BitcoinFeesList } from '@app/components/bitcoin-fees-list/bitcoin-fees-list';
import { useBitcoinFeesList } from '@app/components/bitcoin-fees-list/use-bitcoin-fees-list';
+import { Content, Page } from '@app/components/layout';
import { BitcoinChooseFee } from '@app/features/bitcoin-choose-fee/bitcoin-choose-fee';
import { useValidateBitcoinSpend } from '@app/features/bitcoin-choose-fee/hooks/use-validate-bitcoin-spend';
+import { PageHeader } from '@app/features/container/headers/page.header';
import { useSendBitcoinAssetContextState } from '../../family/bitcoin/components/send-bitcoin-asset-container';
import { useBtcChooseFee } from './use-btc-choose-fee';
@@ -49,30 +51,35 @@ export function BtcChooseFee() {
return (
<>
-
+
+
+ setSelectedFeeType(value)}
+ onValidateBitcoinSpend={onValidateBitcoinAmountSpend}
+ selectedFeeType={selectedFeeType}
+ />
+ }
isLoading={isLoading}
+ isSendingMax={isSendingMax}
onChooseFee={previewTransaction}
- onSetSelectedFeeType={(value: BtcFeeType | null) => setSelectedFeeType(value)}
onValidateBitcoinSpend={onValidateBitcoinAmountSpend}
- selectedFeeType={selectedFeeType}
+ onSetSelectedFeeType={(value: BtcFeeType | null) => setSelectedFeeType(value)}
+ recipients={recipients}
+ recommendedFeeRate={recommendedFeeRate}
+ showError={showInsufficientBalanceError}
+ maxRecommendedFeeRate={feesList[0]?.feeRate}
/>
- }
- isLoading={isLoading}
- isSendingMax={isSendingMax}
- onChooseFee={previewTransaction}
- onValidateBitcoinSpend={onValidateBitcoinAmountSpend}
- onSetSelectedFeeType={(value: BtcFeeType | null) => setSelectedFeeType(value)}
- recipients={recipients}
- recommendedFeeRate={recommendedFeeRate}
- showError={showInsufficientBalanceError}
- maxRecommendedFeeRate={feesList[0]?.feeRate}
- />
-
+
+
+
>
);
}
diff --git a/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form-confirmation.tsx b/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form-confirmation.tsx
index b54a4b4b730..5ee31ef7d0f 100644
--- a/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form-confirmation.tsx
+++ b/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form-confirmation.tsx
@@ -34,10 +34,9 @@ import {
InfoCardRow,
InfoCardSeparator,
} from '@app/components/info-card/info-card';
+import { Card, CardContent, Content, Footer, Page } from '@app/components/layout';
+import { PageHeader } from '@app/features/container/headers/page.header';
import { useCurrentNativeSegwitUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { Card } from '@app/ui/layout/card/card';
-import { CardContent } from '@app/ui/layout/card/card-content';
import { useSendFormNavigate } from '../../hooks/use-send-form-navigate';
@@ -134,50 +133,57 @@ export function BtcSendFormConfirmation() {
}
return (
-
-
+
+
+
+
+
+ Confirm and send transaction
+
+
+ }
>
- Confirm and send transaction
-
-
- }
- >
-
-
-
-
- }
- data-testid={SendCryptoAssetSelectors.ConfirmationDetailsRecipient}
- />
-
-
-
-
- {arrivesIn && }
-
-
-
+
+
+
+
+ }
+ data-testid={SendCryptoAssetSelectors.ConfirmationDetailsRecipient}
+ />
+
+
+
+
+ {arrivesIn && }
+
+
+
+
+
+ >
);
}
diff --git a/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form.tsx b/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form.tsx
index d5559567d73..02fcffb548a 100644
--- a/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form.tsx
+++ b/src/app/pages/send/send-crypto-asset-form/form/btc/btc-send-form.tsx
@@ -9,10 +9,8 @@ import { useCryptoCurrencyMarketDataMeanAverage } from '@leather.io/query';
import { BtcAvatarIcon, Button, Callout, Link } from '@leather.io/ui';
import { formatMoney } from '@leather.io/utils';
-import { AvailableBalance } from '@app/ui/components/containers/footers/available-balance';
-import { Footer } from '@app/ui/components/containers/footers/footer';
-import { Card } from '@app/ui/layout/card/card';
-import { CardContent } from '@app/ui/layout/card/card-content';
+import { AvailableBalance, Card, CardContent, Content, Footer, Page } from '@app/components/layout';
+import { PageHeader } from '@app/features/container/headers/page.header';
import { AmountField } from '../../components/amount-field';
import { SelectedAssetField } from '../../components/selected-asset-field';
@@ -28,7 +26,6 @@ const symbol: CryptoCurrencies = 'BTC';
export function BtcSendForm() {
const routeState = useSendFormRouteState();
const marketData = useCryptoCurrencyMarketDataMeanAverage('BTC');
-
const {
balance,
calcMaxSpend,
@@ -43,84 +40,95 @@ export function BtcSendForm() {
} = useBtcSendForm();
return (
-
-
- {props => {
- onFormStateChange(props.values);
- const sendMaxCalculation = calcMaxSpend(props.values.recipient, utxos);
+ <>
+
+
+
+
+
+ {props => {
+ onFormStateChange(props.values);
+ const sendMaxCalculation = calcMaxSpend(props.values.recipient, utxos);
- return (
-