Skip to content

Commit

Permalink
Render wallet plate image/text parts
Browse files Browse the repository at this point in the history
  • Loading branch information
neuodev committed Mar 16, 2023
1 parent f919d1c commit 1e0d770
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 17 deletions.
Expand Up @@ -22,6 +22,7 @@ import { HARD_DERIVATION_START } from '../../../config/numbersConfig';
import { NUMBER_OF_VERIFIED_ADDRESSES } from '../../../stores/toplevel/WalletRestoreStore';
import { networks } from '../../../api/ada/lib/storage/database/prepackaged/networks';
import WalletAccountIcon from '../../topbar/WalletAccountIcon';
import WalletChecksumTipsDialog from './WalletChecksumTipsDialog';

const messages: * = defineMessages({
description: {
Expand Down Expand Up @@ -139,6 +140,15 @@ export default class AddWalletDetailsStep extends Component<Props > {
Number.parseInt(network.BaseConfig[0].ChainNetworkId, 10)
);

const plateImagePart = (
<WalletAccountIcon
iconSeed={plate.ImagePart}
saturationFactor={0}
size={6}
scalePx={4}
/>
);

return (
<Stack alignItems='center' justifyContent='center'>
<Stack direction='column' alignItems='left' justifyContent='center' maxWidth='555px'>
Expand Down Expand Up @@ -192,12 +202,7 @@ export default class AddWalletDetailsStep extends Component<Props > {
mt='-3px'
mb='90px'
>
<WalletAccountIcon
iconSeed={plate.ImagePart}
saturationFactor={0}
size={6}
scalePx={4}
/>
{plateImagePart}
<Typography variant='body1'>
{plate.TextPart}
</Typography>
Expand All @@ -220,7 +225,11 @@ export default class AddWalletDetailsStep extends Component<Props > {
open={shouldShowDialog}
onClose={hideDialog}
/>

<WalletChecksumTipsDialog
open
plateImagePart={plateImagePart}
plateTextPart={plate.TextPart}
/>
</Stack>
);
}
Expand Down
Expand Up @@ -2,7 +2,7 @@
import type { Node, ComponentType } from 'react';
import InfoDialog from '../../widgets/infoDialog';
import type { $npm$ReactIntl$IntlShape } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';
import { defineMessages, injectIntl, FormattedMessage, FormattedHTMLMessage } from 'react-intl';
import { Typography, Box } from '@mui/material';

const messages: Object = defineMessages({
Expand All @@ -11,12 +11,12 @@ const messages: Object = defineMessages({
defaultMessage: '!!!What is wallet checksum and plate number?',
},
firstTip: {
id: 'wallet.create.dialog.walletChecksum.firstTip',
defaultMessage: '!!!Wallet checksum is a generic Blockie image that is generated to visually distinguish your wallet from others.',
id: 'wallet.create.dialog.walletChecksum.firstTip', // todo: update it
defaultMessage: '!!!{plateImg} Wallet checksum is a generic Blockie image that is generated to visually distinguish your wallet from others.',
},
secondTip: {
id: 'wallet.create.dialog.walletChecksum.secondTip',
defaultMessage: '!!!Plate number {plateNumber} is a auto-generated sign of four letters and four digits.',
defaultMessage: '!!!Plate number <strong>{plateText}</strong> is a auto-generated sign of four letters and four digits.',
},
thirdTip: {
id: 'wallet.create.dialog.walletChecksum.thirdTip',
Expand All @@ -34,20 +34,40 @@ type Props = {|
|}

function walletChecksumTipsDialog(props: Props & Intl): Node {
const { open, onClose, intl } = props;
const { open, onClose, intl, plateImagePart, plateTextPart } = props;

return (
<InfoDialog open={open} onClose={onClose}>
<Typography textAlign='center' variant='body1' fontWeight='500' mb='16px'>{intl.formatMessage(messages.title)}</Typography>
<Box component='ul' sx={{ listStyle: 'outside', px: '24px' }}>
<Box component='li'>
<Typography variant='body1' color='grey.800'>{intl.formatMessage(messages.firstTip)}</Typography>
<Typography variant='body1' color='grey.800'>
<FormattedMessage
{...messages.firstTip}
values={{
plateImg: (
<Box component='span' display='inline-block' width='24px' position='relative'>
<Box sx={{ position: 'absolute', top: '-18px', left: '0px' }}>
{plateImagePart}
</Box>
</Box>
)
}}
/>
</Typography>
</Box>
<Box component='li'>
<Typography variant='body1' color='grey.800'>{intl.formatMessage(messages.secondTip)}</Typography>
<Typography variant='body1' color='grey.800'>
<FormattedHTMLMessage
{...messages.secondTip}
values={{ plateText: plateTextPart }}
/>
</Typography>
</Box>
<Box component='li'>
<Typography variant='body1' color='grey.800'>{intl.formatMessage(messages.thirdTip)}</Typography>
<Typography variant='body1' color='grey.800'>
{intl.formatMessage(messages.thirdTip)}
</Typography>
</Box>
</Box>
</InfoDialog>
Expand Down
4 changes: 2 additions & 2 deletions packages/yoroi-extension/app/i18n/locales/en-US.json
Expand Up @@ -474,8 +474,8 @@
"wallet.create.dialog.walletNameAndPassword.whatIsWalletPassword.firstTip": "Password is an additional security layer used to confirm transactions from this device",
"wallet.create.dialog.walletNameAndPassword.whatIsWalletPassword.secondTip": "Both wallet name and password are stored locally, so you are only person who can change or restore it.",
"wallet.create.dialog.walletChecksum.title": "What is wallet checksum and plate number?",
"wallet.create.dialog.walletChecksum.firstTip": "Wallet checksum is a generic Blockie image that is generated to visually distinguish your wallet from others.",
"wallet.create.dialog.walletChecksum.secondTip": "Plate number {plateNumber} is a auto-generated sign of four letters and four digits.",
"wallet.create.dialog.walletChecksum.firstTip": "{plateImg} Wallet checksum is a generic Blockie image that is generated to visually distinguish your wallet from others.",
"wallet.create.dialog.walletChecksum.secondTip": "Plate number <strong>{plateText}</strong> is a auto-generated sign of four letters and four digits.",
"wallet.create.dialog.walletChecksum.thirdTip": "Checksum and plate number are unique to your wallet and represent your public key.",
"wallet.add.page.revamp.subtitle": "Light wallet for Cardano assets",
"wallet.add.page.revamp.createWallet": "Create new wallet",
Expand Down

0 comments on commit 1e0d770

Please sign in to comment.