update UI for the imported accounts

pull/495/head
slowbackspace 5 years ago
parent 732c767ea3
commit 6d76c20886

@ -95,10 +95,11 @@ const AccountReceive = (props: Props) => {
const isAddressVerifying = const isAddressVerifying =
props.modal.context === CONTEXT_DEVICE && props.modal.context === CONTEXT_DEVICE &&
props.modal.windowType === 'ButtonRequest_Address'; props.modal.windowType === 'ButtonRequest_Address';
const isAddressHidden = !isAddressVerifying && !addressVerified && !addressUnverified; const isAddressHidden =
!isAddressVerifying && !addressVerified && !addressUnverified && !account.imported;
let address = `${account.descriptor.substring(0, 20)}...`; let address = `${account.descriptor.substring(0, 20)}...`;
if (addressVerified || addressUnverified || isAddressVerifying) { if (addressVerified || addressUnverified || isAddressVerifying || account.imported) {
address = account.descriptor; address = account.descriptor;
} }
@ -166,7 +167,7 @@ const AccountReceive = (props: Props) => {
) )
} }
/> />
{!(addressVerified || addressUnverified) && ( {!(addressVerified || addressUnverified) && !account.imported && (
<ShowAddressButton <ShowAddressButton
icon={ICONS.EYE} icon={ICONS.EYE}
onClick={() => props.showAddress(account.accountPath)} onClick={() => props.showAddress(account.accountPath)}
@ -176,20 +177,21 @@ const AccountReceive = (props: Props) => {
</ShowAddressButton> </ShowAddressButton>
)} )}
</Row> </Row>
{(addressVerified || addressUnverified) && !isAddressVerifying && ( {((addressVerified || addressUnverified) && !isAddressVerifying) ||
<QrWrapper> (account.imported && (
<Label> <QrWrapper>
<FormattedMessage {...l10nReceiveMessages.TR_QR_CODE} /> <Label>
</Label> <FormattedMessage {...l10nReceiveMessages.TR_QR_CODE} />
<StyledQRCode </Label>
bgColor="#FFFFFF" <StyledQRCode
fgColor="#000000" bgColor="#FFFFFF"
level="Q" fgColor="#000000"
style={{ width: 150 }} level="Q"
value={account.descriptor} style={{ width: 150 }}
/> value={account.descriptor}
</QrWrapper> />
)} </QrWrapper>
))}
</AddressWrapper> </AddressWrapper>
</React.Fragment> </React.Fragment>
</Content> </Content>

@ -101,10 +101,11 @@ const AccountReceive = (props: Props) => {
const isAddressVerifying = const isAddressVerifying =
props.modal.context === CONTEXT_DEVICE && props.modal.context === CONTEXT_DEVICE &&
props.modal.windowType === 'ButtonRequest_Address'; props.modal.windowType === 'ButtonRequest_Address';
const isAddressHidden = !isAddressVerifying && !addressVerified && !addressUnverified; const isAddressHidden =
!isAddressVerifying && !addressVerified && !addressUnverified && !account.imported;
let address = `${account.descriptor.substring(0, 20)}...`; let address = `${account.descriptor.substring(0, 20)}...`;
if (addressVerified || addressUnverified || isAddressVerifying) { if (addressVerified || addressUnverified || isAddressVerifying || account.imported) {
address = account.descriptor; address = account.descriptor;
} }
@ -172,7 +173,7 @@ const AccountReceive = (props: Props) => {
) )
} }
/> />
{!(addressVerified || addressUnverified) && ( {!(addressVerified || addressUnverified) && !account.imported && (
<ShowAddressButton <ShowAddressButton
onClick={() => props.showAddress(account.accountPath)} onClick={() => props.showAddress(account.accountPath)}
isDisabled={device.connected && !discovery.completed} isDisabled={device.connected && !discovery.completed}
@ -182,20 +183,21 @@ const AccountReceive = (props: Props) => {
</ShowAddressButton> </ShowAddressButton>
)} )}
</Row> </Row>
{(addressVerified || addressUnverified) && !isAddressVerifying && ( {((addressVerified || addressUnverified) && !isAddressVerifying) ||
<QrWrapper> (account.imported && (
<Label> <QrWrapper>
<FormattedMessage {...l10nReceiveMessages.TR_QR_CODE} /> <Label>
</Label> <FormattedMessage {...l10nReceiveMessages.TR_QR_CODE} />
<StyledQRCode </Label>
bgColor="#FFFFFF" <StyledQRCode
fgColor="#000000" bgColor="#FFFFFF"
level="Q" fgColor="#000000"
style={{ width: 150 }} level="Q"
value={account.descriptor} style={{ width: 150 }}
/> value={account.descriptor}
</QrWrapper> />
)} </QrWrapper>
))}
</AddressWrapper> </AddressWrapper>
</React.Fragment> </React.Fragment>
</Content> </Content>

@ -312,7 +312,9 @@ const AccountSend = (props: Props) => {
total === '0' || total === '0' ||
amount.length === 0 || amount.length === 0 ||
address.length === 0 || address.length === 0 ||
sending; sending ||
account.imported;
let amountText = ''; let amountText = '';
if (networkSymbol !== currency && amount.length > 0 && !errors.amount) { if (networkSymbol !== currency && amount.length > 0 && !errors.amount) {
amountText = `${amount} ${currency.toUpperCase()}`; amountText = `${amount} ${currency.toUpperCase()}`;
@ -516,13 +518,14 @@ const AccountSend = (props: Props) => {
</AdvancedForm> </AdvancedForm>
)} )}
{props.selectedAccount.pending.length > 0 && ( {props.selectedAccount.pending.length > 0 ||
<PendingTransactions (account.imported && (
pending={props.selectedAccount.pending} <PendingTransactions
tokens={props.selectedAccount.tokens} pending={props.selectedAccount.pending}
network={network} tokens={props.selectedAccount.tokens}
/> network={network}
)} />
))}
</Content> </Content>
); );
}; };

@ -279,7 +279,9 @@ const AccountSend = (props: Props) => {
total === '0' || total === '0' ||
amount.length === 0 || amount.length === 0 ||
address.length === 0 || address.length === 0 ||
sending; sending ||
account.imported;
let sendButtonText = <FormattedMessage {...l10nSendMessages.TR_SEND} values={{ amount: '' }} />; let sendButtonText = <FormattedMessage {...l10nSendMessages.TR_SEND} values={{ amount: '' }} />;
if (total !== '0') { if (total !== '0') {
sendButtonText = ( sendButtonText = (
@ -481,13 +483,14 @@ const AccountSend = (props: Props) => {
</AdvancedForm> </AdvancedForm>
)} )}
{props.selectedAccount.pending.length > 0 && ( {props.selectedAccount.pending.length > 0 ||
<PendingTransactions (account.imported && (
pending={props.selectedAccount.pending} <PendingTransactions
tokens={props.selectedAccount.tokens} pending={props.selectedAccount.pending}
network={network} tokens={props.selectedAccount.tokens}
/> network={network}
)} />
))}
</Content> </Content>
); );
}; };

@ -44,6 +44,10 @@ const StyledCoinLogo = styled(CoinLogo)`
margin-right: 10px; margin-right: 10px;
`; `;
const StyledLink = styled(Link)`
font-size: ${FONT_SIZE.SMALL};
`;
const AccountSummary = (props: Props) => { const AccountSummary = (props: Props) => {
const device = props.wallet.selectedDevice; const device = props.wallet.selectedDevice;
const { account, network, pending, shouldRender } = props.selectedAccount; const { account, network, pending, shouldRender } = props.selectedAccount;
@ -69,17 +73,19 @@ const AccountSummary = (props: Props) => {
<StyledCoinLogo height={23} network={account.network} /> <StyledCoinLogo height={23} network={account.network} />
<AccountTitle> <AccountTitle>
<FormattedMessage <FormattedMessage
{...l10nCommonMessages.TR_ACCOUNT_HASH} {...(account.imported
? l10nCommonMessages.TR_IMPORTED_ACCOUNT_HASH
: l10nCommonMessages.TR_ACCOUNT_HASH)}
values={{ number: parseInt(account.index, 10) + 1 }} values={{ number: parseInt(account.index, 10) + 1 }}
/> />
</AccountTitle> </AccountTitle>
</AccountName> </AccountName>
{!account.empty && ( {!account.empty && (
<Link href={explorerLink} isGray> <StyledLink href={explorerLink} isGray>
<FormattedMessage <FormattedMessage
{...l10nSummaryMessages.TR_SEE_FULL_TRANSACTION_HISTORY} {...l10nSummaryMessages.TR_SEE_FULL_TRANSACTION_HISTORY}
/> />
</Link> </StyledLink>
)} )}
</AccountHeading> </AccountHeading>
<AccountBalance <AccountBalance

Loading…
Cancel
Save