Skip to content

Commit

Permalink
feat(suite): add promo banner for wallet remember into receive form
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-sanderson authored and jvaclavik committed May 16, 2024
1 parent 73a4e38 commit cfa8f10
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 29 deletions.
1 change: 0 additions & 1 deletion packages/components/src/components/Warning/Warning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ const Wrapper = styled.div<WrapperParams>`
display: flex;
${typography.hint}
gap: ${spacingsPx.sm};
justify-content: ${({ $withIcon }) => !$withIcon && 'center'};
padding: ${spacingsPx.sm} ${spacingsPx.lg};
width: 100%;
Expand Down
4 changes: 2 additions & 2 deletions packages/suite-desktop-ui/src/support/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import routes from 'src/constants/suite/routes';
import { Dashboard } from 'src/views/dashboard';
import Notification from 'src/views/suite/notifications';
import { Transactions } from 'src/views/wallet/transactions/Transactions';
import WalletReceive from 'src/views/wallet/receive';
import { Receive } from 'src/views/wallet/receive/Receive';
import WalletDetails from 'src/views/wallet/details';
import WalletTokens from 'src/views/wallet/tokens';
import WalletSend from 'src/views/wallet/send';
Expand Down Expand Up @@ -42,7 +42,7 @@ const components: { [key: string]: ComponentType<any> } = {
'notifications-index': Notification,

'wallet-index': Transactions,
'wallet-receive': WalletReceive,
'wallet-receive': Receive,
'wallet-details': WalletDetails,
'wallet-tokens': WalletTokens,
'wallet-send': WalletSend,
Expand Down
6 changes: 4 additions & 2 deletions packages/suite-web/src/support/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ const components: Record<PageName, LazyExoticComponent<ComponentType<any>>> = {
({ Transactions }) => ({ default: Transactions }),
),
),
'wallet-receive': lazy(
() => import(/* webpackChunkName: "wallet" */ 'src/views/wallet/receive'),
'wallet-receive': lazy(() =>
import(/* webpackChunkName: "wallet" */ 'src/views/wallet/receive/Receive').then(
({ Receive }) => ({ default: Receive }),
),
),
'wallet-details': lazy(
() => import(/* webpackChunkName: "wallet" */ 'src/views/wallet/details'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { FreshAddress } from './components/FreshAddress';
import { UsedAddresses } from './components/UsedAddresses';
import { CoinjoinReceiveWarning } from './components/CoinjoinReceiveWarning';
import { ConfirmEvmExplanationModal } from 'src/components/suite/modals';
import { ConnectDevicePromo } from './components/ConnectDevicePromo';
import { Flex } from '@trezor/components';
import { spacings } from '@trezor/theme';

const Receive = () => {
export const Receive = () => {
const isCoinjoinReceiveWarningHidden = useSelector(
state => state.suite.settings.isCoinjoinReceiveWarningHidden,
);
Expand All @@ -33,30 +36,34 @@ const Receive = () => {
const disabled = !!device.authConfirm;
const showCexWarning = account?.accountType === 'coinjoin' && !isCoinjoinReceiveWarningHidden;

console.log('isDeviceLocked', isDeviceLocked);

return (
<WalletLayout title="TR_NAV_RECEIVE" isSubpage account={selectedAccount}>
<WalletSubpageHeading title="TR_NAV_RECEIVE" />

{showCexWarning && <CoinjoinReceiveWarning />}

<FreshAddress
account={account}
addresses={receive}
disabled={disabled}
locked={isDeviceLocked}
pendingAddresses={pendingAddresses}
/>

<UsedAddresses
account={account}
addresses={receive}
locked={isDeviceLocked}
pendingAddresses={pendingAddresses}
/>

<ConfirmEvmExplanationModal account={account} route="wallet-receive" />
<Flex gap={spacings.sm} direction="column" alignItems="start">
{true && <ConnectDevicePromo />}

<WalletSubpageHeading title="TR_NAV_RECEIVE" />

{showCexWarning && <CoinjoinReceiveWarning />}

<FreshAddress
account={account}
addresses={receive}
disabled={disabled}
locked={isDeviceLocked}
pendingAddresses={pendingAddresses}
/>

<UsedAddresses
account={account}
addresses={receive}
locked={isDeviceLocked}
pendingAddresses={pendingAddresses}
/>

<ConfirmEvmExplanationModal account={account} route="wallet-receive" />
</Flex>
</WalletLayout>
);
};

export default Receive;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Columns, Image, Rows, Text, Warning } from '@trezor/components';
import { useSelector } from '../../../../hooks/suite';
import { selectDevice } from '@suite-common/wallet-core';
import { DEFAULT_FLAGSHIP_MODEL } from '@suite-common/suite-constants';

export const ConnectDevicePromo = () => {
const selectedDevice = useSelector(selectDevice);
const selectedDeviceModelInternal =
selectedDevice?.features?.internal_model || DEFAULT_FLAGSHIP_MODEL;

return (
<Warning variant="warning" withIcon={false}>
<Columns alignItems="center" justifyContent="space-between" gap={12} flex={1}>
<Rows alignItems="start">
<Text typographyStyle="highlight" variant="warning">
Receive address can’t be verified
</Text>
<Text typographyStyle="titleSmall">
Verify on Trezor to confirm receive address. Continuing without confirming
isn’t recommended.
</Text>
</Rows>

<Image alt="Trezor" image={`TREZOR_${selectedDeviceModelInternal}`} />
</Columns>
</Warning>
);
};
2 changes: 1 addition & 1 deletion suite-common/suite-constants/src/device.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { DeviceModelInternal } from '@trezor/connect';

export const DEFAULT_FLAGSHIP_MODEL = DeviceModelInternal.T2T1;
export const DEFAULT_FLAGSHIP_MODEL = DeviceModelInternal.T3T1;

0 comments on commit cfa8f10

Please sign in to comment.