Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontends/web/src/components/backbutton/backbutton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ReactNode, useCallback } from 'react';
import { useEsc } from '@/hooks/keyboard';
import { Button } from '@/components/forms/button';
import { useBackButton } from '@/hooks/backbutton';
import { useMediaQuery } from '@/hooks/mediaquery';
import { useBackNavigation } from '@/contexts/BackNavigationContext';

type TBackButton = {
Expand Down Expand Up @@ -54,3 +55,11 @@ export const BackButton = ({
</Button>
);
};

export const DesktopBackButton = (props: TBackButton) => {
const isMobile = useMediaQuery('(max-width: 768px)');
if (isMobile) {
return null;
}
return <BackButton {...props} />;
};
4 changes: 3 additions & 1 deletion frontends/web/src/components/view/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ type THeaderProps = {
title?: ReactNode;
withAppLogo?: boolean;
children?: ReactNode;
className?: string;
};

/**
Expand All @@ -167,14 +168,15 @@ export const ViewHeader = ({
small,
title,
withAppLogo,
className = ''
}: THeaderProps) => {
const { isDarkMode } = useDarkmode();
const headerStyles = small ? `
${style.header || ''}
${style.smallHeader || ''}
` : style.header;
return (
<header className={headerStyles}>
<header className={`${headerStyles || ''} ${className || ''}`}>
{withAppLogo && (
isDarkMode ? <AppLogoInverted /> : <AppLogo />
)}
Expand Down
15 changes: 11 additions & 4 deletions frontends/web/src/routes/account/add/add-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import { CoinDropDown } from '@/components/dropdown/coin-dropdown';
import { SubTitle } from '@/components/title';
import { useMediaQuery } from '@/hooks/mediaquery';
import { UseBackButton } from '@/hooks/backbutton';
import { BackButton } from '@/components/backbutton/backbutton';
import { DesktopBackButton } from '@/components/backbutton/backbutton';
import { MobileHeader } from '@/routes/settings/components/mobile-header';
import { AddAccountGuide } from './add-account-guide';
import { Skeleton } from '@/components/skeleton/skeleton';
import styles from './add-account.module.css';
Expand Down Expand Up @@ -241,7 +242,13 @@ export const AddAccount = ({ accounts }: TAddAccountProps) => {
<Main>
<GuideWrapper>
<GuidedContent>
<Header title={<h2>{t('manageAccounts.title')}</h2>} />
<Header
title={
<>
<h2 className="hide-on-small">{t('manageAccounts.title')}</h2>
<MobileHeader onClick={back} withGuide title={t('manageAccounts.title')} />
</>
} />
Comment thread
thisconnect marked this conversation as resolved.
<View
fitContent
textCenter
Expand Down Expand Up @@ -309,11 +316,11 @@ export const AddAccount = ({ accounts }: TAddAccountProps) => {
{t('addAccount.success.addAnotherAccount')}
</Button>
) : (
<BackButton
<DesktopBackButton
onClick={back}
>
{t('button.back')}
</BackButton>
</DesktopBackButton>
)}
</ViewButtons>
</form>
Expand Down
15 changes: 11 additions & 4 deletions frontends/web/src/routes/account/receive/receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import { getScriptName, isEthereumBased } from '@/routes/account/utils';
import { CopyableInput } from '@/components/copy/Copy';
import { Dialog, DialogButtons, DialogScrollContent } from '@/components/dialog/dialog';
import { Button, Radio } from '@/components/forms';
import { BackButton } from '@/components/backbutton/backbutton';
import { DesktopBackButton } from '@/components/backbutton/backbutton';
import { Message } from '@/components/message/message';
import { ReceiveGuide } from './components/guide';
import { Header } from '@/components/layout';
import { QRCode } from '@/components/qrcode/qrcode';
import { ArrowCirlceLeft, ArrowCirlceLeftActive, ArrowCirlceRight, ArrowCirlceRightActive } from '@/components/icon';
import { connectKeystore } from '@/api/keystores';
import { MobileHeader } from '@/routes/settings/components/mobile-header';
import style from './receive.module.css';

type TProps = {
Expand Down Expand Up @@ -250,7 +251,13 @@ export const Receive = ({
<div className="contentWithGuide">
<div className="container">
<div className="innerContainer scrollableContainer">
<Header title={<h2>{t('receive.title', { accountName: account?.coinName })}</h2>} />
<Header
title={
<>
<h2 className="hide-on-small">{t('receive.title', { accountName: account?.coinName })}</h2>
<MobileHeader withGuide title={t('receive.title', { accountName: account?.coinName })} />
</>
} />
<div className="content narrow isVerticallyCentered">
<div className="box large text-center">
{ currentAddresses && (
Expand Down Expand Up @@ -315,9 +322,9 @@ export const Receive = ({
primary>
{t('receive.verifyBitBox02')}
</Button>
<BackButton enableEsc={!addressTypeDialog && !verifying}>
<DesktopBackButton enableEsc={!addressTypeDialog && !verifying}>
{t('button.back')}
</BackButton>
</DesktopBackButton>
</div>
{ verifying && (
<div className={style.hide}></div>
Expand Down
14 changes: 10 additions & 4 deletions frontends/web/src/routes/account/send/send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import { alertUser } from '@/components/alert/Alert';
import { Balance } from '@/components/balance/balance';
import { HideAmountsButton } from '@/components/hideamountsbutton/hideamountsbutton';
import { Button } from '@/components/forms';
import { BackButton } from '@/components/backbutton/backbutton';
import { DesktopBackButton } from '@/components/backbutton/backbutton';
import { Column, ColumnButtons, GuideWrapper, GuidedContent, Header, Main, ResponsiveGrid } from '@/components/layout';
import { AmountWithUnit } from '@/components/amount/amount-with-unit';
import { MobileHeader } from '@/routes/settings/components/mobile-header';
import { FeeTargets } from './feetargets';
import { isBitcoinBased, isBitcoinOnly } from '@/routes/account/utils';
import { ConfirmSend } from './components/confirm/confirm';
Expand Down Expand Up @@ -420,7 +421,12 @@ export const Send = ({
<GuidedContent>
<Main>
<Header
title={<h2>{t('send.title', { accountName: account.coinName })}</h2>}
title={
<>
<h2 className="hide-on-small">{t('send.title', { accountName: account.coinName })}</h2>
<MobileHeader withGuide title={t('send.title', { accountName: account.coinName })} />
</>
}
>
<HideAmountsButton />
</Header>
Expand Down Expand Up @@ -500,11 +506,11 @@ export const Send = ({
disabled={!getValidTxInputData() || !valid || isUpdatingProposal}>
{t('send.button')}
</Button>
<BackButton
<DesktopBackButton
enableEsc={!isConfirming && !utxoDialogActive}
>
{t('button.back')}
</BackButton>
</DesktopBackButton>
</ColumnButtons>
</Column>
</ResponsiveGrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { SetStateAction, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Button, Input } from '@/components/forms';
import { BackButton } from '@/components/backbutton/backbutton';
import { DesktopBackButton } from '@/components/backbutton/backbutton';
import { useMediaQuery } from '@/hooks/mediaquery';
import { ScanQRButton } from '@/routes/account/send/components/inputs/receiver-address-input';
import { ScanQRDialog } from '@/routes/account/send/components/dialogs/scan-qr-dialog';
Expand Down Expand Up @@ -76,9 +76,9 @@ export const WCConnectForm = ({
/>
)}
<div className={styles.formButtonsContainer}>
<BackButton disabled={connectLoading}>
<DesktopBackButton disabled={connectLoading}>
{t('dialog.cancel')}
</BackButton>
</DesktopBackButton>
<Button
disabled={connectLoading || !uri}
type="submit"
Expand Down
11 changes: 10 additions & 1 deletion frontends/web/src/routes/account/walletconnect/connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { TConnectStatus } from './types';
import { GuideWrapper, GuidedContent, Header, Main } from '@/components/layout';
import { alertUser } from '@/components/alert/Alert';
import { View, ViewContent, ViewHeader } from '@/components/view/view';
import { MobileHeader } from '@/routes/settings/components/mobile-header';
import { WCHeader } from './components/header/header';
import { WCConnectForm } from './components/connect-form/connect-form';
import { WCIncomingPairing } from './components/incoming-pairing/incoming-pairing';
Expand Down Expand Up @@ -92,7 +93,15 @@ export const ConnectScreenWalletConnect = ({
<GuideWrapper>
<GuidedContent>
<Main>
<Header />
<Header
title={
status === 'connect' ? (
<MobileHeader
variant={loading ? 'titleOnly' : 'back'}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "loading" state confused me quickly, it is not about loading the UI but gets set to true when doing a new connection while pairing.

tested on Android 👍

withGuide
title={t('walletConnect.walletConnect')} />
) : undefined
} />
<View
fitContent
verticallyCentered
Expand Down
45 changes: 36 additions & 9 deletions frontends/web/src/routes/device/bitbox02/bip85.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import { SimpleMarkup } from '@/utils/markup';
import { A } from '@/components/anchor/anchor';
import { Column, ResponsiveGrid } from '@/components/layout';
import { useDarkmode } from '@/hooks/darkmode';
import { useMediaQuery } from '@/hooks/mediaquery';
import { UseDisableBackButton } from '@/hooks/backbutton';
import { BackButton } from '@/components/backbutton/backbutton';
import { DesktopBackButton } from '@/components/backbutton/backbutton';
import { MobileHeader } from '@/routes/settings/components/mobile-header';
import bip85Graphic from './assets/bip85-graphic.svg';
import bip85GraphicLight from './assets/bip85-graphic-light.svg';

Expand All @@ -28,16 +30,23 @@ export const Bip85 = ({
const navigate = useNavigate();
const { t } = useTranslation();
const { isDarkMode } = useDarkmode();
const isMobile = useMediaQuery('(max-width: 768px)');
const [status, setStatus] = useState<Status>('info-what');
const [disclaimer, setDisclaimer] = useState(false);
const handleClose = () => navigate(-1);

switch (status) {
case 'info-what':
return (
<View
key="bip85-info-what"
fullscreen
onClose={isMobile ? undefined : handleClose}
verticallyCentered>
<MobileHeader
title={t('deviceSettings.expert.bip85.title')}
withViewPadding
/>
<ViewHeader small title={t('deviceSettings.expert.bip85.what.title')} />
<ViewContent minHeight="280px">
<ResponsiveGrid>
Expand Down Expand Up @@ -68,9 +77,9 @@ export const Bip85 = ({
onClick={() => setStatus('info-how')}>
{t('button.continue')}
</Button>
<BackButton>
<DesktopBackButton>
{t('button.back')}
</BackButton>
</DesktopBackButton>
</ViewButtons>
</View>
);
Expand All @@ -79,7 +88,13 @@ export const Bip85 = ({
<View
key="bip85-info-how"
fullscreen
onClose={isMobile ? undefined : handleClose}
verticallyCentered>
<MobileHeader
onClick={() => setStatus('info-what')}
title={t('deviceSettings.expert.bip85.title')}
withViewPadding
/>
<ViewHeader title={t('deviceSettings.expert.bip85.how.title')} />
<ViewContent minHeight="280px">
<SimpleMarkup
Expand All @@ -92,10 +107,10 @@ export const Bip85 = ({
onClick={() => setStatus('info-recover')}>
{t('button.continue')}
</Button>
<BackButton
<DesktopBackButton
onClick={() => setStatus('info-what')}>
{t('button.back')}
</BackButton>
</DesktopBackButton>
</ViewButtons>
</View>
);
Expand All @@ -104,7 +119,13 @@ export const Bip85 = ({
<View
key="bip85-info-recover"
fullscreen
onClose={isMobile ? undefined : handleClose}
verticallyCentered>
<MobileHeader
onClick={() => setStatus('info-how')}
title={t('deviceSettings.expert.bip85.title')}
withViewPadding
/>
<ViewHeader title={t('deviceSettings.expert.bip85.recover.title')} />
<ViewContent minHeight="280px">
<SimpleMarkup
Expand All @@ -120,10 +141,10 @@ export const Bip85 = ({
}}>
{t('button.continue')}
</Button>
<BackButton
<DesktopBackButton
onClick={() => setStatus('info-how')}>
{t('button.back')}
</BackButton>
</DesktopBackButton>
Comment thread
thisconnect marked this conversation as resolved.
</ViewButtons>
</View>
);
Expand All @@ -132,7 +153,13 @@ export const Bip85 = ({
<View
key="bip85-info-security"
fullscreen
onClose={isMobile ? undefined : handleClose}
verticallyCentered>
<MobileHeader
onClick={() => setStatus('info-recover')}
title={t('deviceSettings.expert.bip85.title')}
withViewPadding
/>
<ViewHeader title={t('deviceSettings.expert.bip85.security.title')} />
<ViewContent minHeight="280px">
<p>
Expand All @@ -156,10 +183,10 @@ export const Bip85 = ({
}}>
{t('button.proceedOnBitBox')}
</Button>
<BackButton
<DesktopBackButton
onClick={() => setStatus('info-recover')}>
{t('button.back')}
</BackButton>
</DesktopBackButton>
</ViewButtons>
</View>
);
Expand Down
Loading