From 60a724bae7c240ea7405673415b7c068d30cb8d2 Mon Sep 17 00:00:00 2001 From: Pete Watters <2938440+pete-watters@users.noreply.github.com> Date: Fri, 15 Mar 2024 07:36:26 +0000 Subject: [PATCH] chore: update popout headers --- src/app/components/disclaimer.tsx | 2 +- src/app/components/no-fees-warning-row.tsx | 4 +- src/app/features/container/container.tsx | 7 +--- src/app/features/container/total-balance.tsx | 2 +- .../container/utils/get-popup-header.ts | 39 +++++++++++++++---- .../container/utils/get-title-from-url.ts | 3 +- .../current-account-avatar.tsx | 6 +-- .../contract-call-details.tsx | 1 + .../stx-transfer-details.tsx | 1 + .../components/get-addresses.layout.tsx | 2 +- .../transaction-request.tsx | 8 +++- .../components/containers/headers/header.tsx | 19 ++------- 12 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/app/components/disclaimer.tsx b/src/app/components/disclaimer.tsx index fbd8a9e72d5..0ef74549f06 100644 --- a/src/app/components/disclaimer.tsx +++ b/src/app/components/disclaimer.tsx @@ -10,7 +10,7 @@ interface DisclaimerProps extends BoxProps { export function Disclaimer({ disclaimerText, learnMoreUrl, ...props }: DisclaimerProps) { return ( - + {disclaimerText} {learnMoreUrl ? ( openInNewTab(learnMoreUrl)}> diff --git a/src/app/components/no-fees-warning-row.tsx b/src/app/components/no-fees-warning-row.tsx index 3ed6cfedf31..420bf92a6d5 100644 --- a/src/app/components/no-fees-warning-row.tsx +++ b/src/app/components/no-fees-warning-row.tsx @@ -9,8 +9,8 @@ interface NoFeesWarningRowProps { export function NoFeesWarningRow({ chainId }: NoFeesWarningRowProps) { return ( - No fees are incurred - + No fees are incurred + {whenStacksChainId(chainId)({ [ChainID.Testnet]: 'Testnet', [ChainID.Mainnet]: 'Mainnet', diff --git a/src/app/features/container/container.tsx b/src/app/features/container/container.tsx index 616e227c805..a5a4d166183 100644 --- a/src/app/features/container/container.tsx +++ b/src/app/features/container/container.tsx @@ -34,6 +34,7 @@ import { getDisplayAddresssBalanceOf, isKnownPopupRoute, showAccountInfo, + showBalanceInfo, } from './utils/get-popup-header'; import { getTitleFromUrl } from './utils/get-title-from-url'; import { @@ -154,10 +155,6 @@ export function Container() { align="middle" img={ setIsShowingSwitchAccount(!isShowingSwitchAccount) } @@ -169,7 +166,7 @@ export function Container() { ) } totalBalance={ - showAccountInfo(pathname) && ( + showBalanceInfo(pathname) && ( ) } diff --git a/src/app/features/container/total-balance.tsx b/src/app/features/container/total-balance.tsx index 13095a54fd2..2ca38223807 100644 --- a/src/app/features/container/total-balance.tsx +++ b/src/app/features/container/total-balance.tsx @@ -13,7 +13,7 @@ interface TotalBalanceLayoutProps { } function TotalBalanceLayout({ children }: TotalBalanceLayoutProps) { return ( - + {children} ); diff --git a/src/app/features/container/utils/get-popup-header.ts b/src/app/features/container/utils/get-popup-header.ts index d24ea0ac2e4..d42d48e8e2a 100644 --- a/src/app/features/container/utils/get-popup-header.ts +++ b/src/app/features/container/utils/get-popup-header.ts @@ -4,21 +4,41 @@ import { RouteUrls } from '@shared/route-urls'; export function showAccountInfo(pathname: RouteUrls) { - return ( - pathname === RouteUrls.TransactionRequest || - pathname === RouteUrls.ProfileUpdateRequest || - pathname === RouteUrls.PsbtRequest - ); + switch (pathname) { + case RouteUrls.TransactionRequest: + case RouteUrls.ProfileUpdateRequest: + case RouteUrls.PsbtRequest: + case RouteUrls.RpcSendTransfer: + case RouteUrls.SignatureRequest: + case RouteUrls.RpcStacksSignature: + return true; + default: + return false; + } } + +export function showBalanceInfo(pathname: RouteUrls) { + switch (pathname) { + case RouteUrls.ProfileUpdateRequest: + case RouteUrls.PsbtRequest: + case RouteUrls.RpcSendTransfer: + case RouteUrls.RpcStacksSignature: + return true; + case RouteUrls.TransactionRequest: + default: + return false; + } +} + export function getDisplayAddresssBalanceOf(pathname: RouteUrls) { + // TODO it's unclear when to show ALL or STX balance here switch (pathname) { case RouteUrls.TransactionRequest: case RouteUrls.ProfileUpdateRequest: case RouteUrls.PsbtRequest: + case RouteUrls.RpcSendTransfer: return 'all'; - case RouteUrls.SignatureRequest: - case RouteUrls.RpcGetAddresses: - return undefined; + case RouteUrls.RpcStacksSignature: default: return 'stx'; } @@ -31,6 +51,9 @@ export function isKnownPopupRoute(pathname: RouteUrls) { case RouteUrls.PsbtRequest: case RouteUrls.SignatureRequest: case RouteUrls.RpcGetAddresses: + case RouteUrls.RpcSendTransfer: + case RouteUrls.SignatureRequest: + case RouteUrls.RpcStacksSignature: 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 index dd05c7ecea9..42ed7fe7a01 100644 --- a/src/app/features/container/utils/get-title-from-url.ts +++ b/src/app/features/container/utils/get-title-from-url.ts @@ -2,8 +2,9 @@ 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 + // 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'; } diff --git a/src/app/features/current-account/current-account-avatar.tsx b/src/app/features/current-account/current-account-avatar.tsx index 13e7f6bb145..7e5cc23bd15 100644 --- a/src/app/features/current-account/current-account-avatar.tsx +++ b/src/app/features/current-account/current-account-avatar.tsx @@ -11,8 +11,7 @@ import { AccountAvatar } from '@app/ui/components/account/account-avatar/account interface CurrentAccountAvatar extends CircleProps { toggleSwitchAccount(): void; } -export const CurrentAccountAvatar = memo((props: CurrentAccountAvatar) => { - const { toggleSwitchAccount } = props; +export const CurrentAccountAvatar = memo(({ toggleSwitchAccount }: CurrentAccountAvatar) => { const accountIndex = useCurrentAccountIndex(); const accounts = useStacksAccounts(); const currentAccount = accounts[accountIndex] as StacksAccount | undefined; @@ -23,9 +22,8 @@ export const CurrentAccountAvatar = memo((props: CurrentAccountAvatar) => { toggleSwitchAccount()} publicKey={currentAccount.stxPublicKey} - {...props} /> ); }); diff --git a/src/app/features/stacks-transaction-request/contract-call-details/contract-call-details.tsx b/src/app/features/stacks-transaction-request/contract-call-details/contract-call-details.tsx index cd36cc7e396..a2e6d6ed277 100644 --- a/src/app/features/stacks-transaction-request/contract-call-details/contract-call-details.tsx +++ b/src/app/features/stacks-transaction-request/contract-call-details/contract-call-details.tsx @@ -27,6 +27,7 @@ function ContractCallDetailsSuspense() { py="32px" gap="space.05" width="100%" + background="ink.background-primary" > Function and arguments diff --git a/src/app/features/stacks-transaction-request/stx-transfer-details/stx-transfer-details.tsx b/src/app/features/stacks-transaction-request/stx-transfer-details/stx-transfer-details.tsx index de5bd459b24..7a214f1fcd7 100644 --- a/src/app/features/stacks-transaction-request/stx-transfer-details/stx-transfer-details.tsx +++ b/src/app/features/stacks-transaction-request/stx-transfer-details/stx-transfer-details.tsx @@ -20,6 +20,7 @@ export function StxTransferDetails(): React.JSX.Element | null { px="space.04" py="space.06" gap="space.05" + backgroundColor="ink.background-secondary" > Transfer details diff --git a/src/app/pages/rpc-get-addresses/components/get-addresses.layout.tsx b/src/app/pages/rpc-get-addresses/components/get-addresses.layout.tsx index 642e425afb9..a8669b172d1 100644 --- a/src/app/pages/rpc-get-addresses/components/get-addresses.layout.tsx +++ b/src/app/pages/rpc-get-addresses/components/get-addresses.layout.tsx @@ -45,7 +45,7 @@ export function GetAddressesLayout(props: GetAddressesLayoutProps) { alignSelf="bottom" bg="ink.background-secondary" > - + By connecting you give permission to {requester} to see all addresses linked to this account diff --git a/src/app/pages/transaction-request/transaction-request.tsx b/src/app/pages/transaction-request/transaction-request.tsx index c521a116292..5e4a1d4000a 100644 --- a/src/app/pages/transaction-request/transaction-request.tsx +++ b/src/app/pages/transaction-request/transaction-request.tsx @@ -91,7 +91,13 @@ function TransactionRequestBase() { }; return ( - + + {networkBadge} - {totalBalance} + {totalBalance && totalBalance} {variant !== 'onboarding' && settingsMenu} - {onClose && ( - } - dataTestId={SharedComponentsSelectors.HeaderCloseBtn} - isWaitingOnPerformedAction={isWaitingOnPerformedAction} - onAction={onClose} - /> - )}