From a01ca0fb78159914a6ae44071204c4953b6b7009 Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Mon, 25 Feb 2019 16:19:13 +0100 Subject: [PATCH] show warning when device needs backup before showing full address --- .../modals/confirm/UnverifiedAddress/index.js | 74 +++++++++++++++---- 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/src/components/modals/confirm/UnverifiedAddress/index.js b/src/components/modals/confirm/UnverifiedAddress/index.js index e6f26592..230671ac 100644 --- a/src/components/modals/confirm/UnverifiedAddress/index.js +++ b/src/components/modals/confirm/UnverifiedAddress/index.js @@ -31,11 +31,23 @@ const StyledLink = styled(Link)` const Wrapper = styled.div` max-width: 370px; - padding: 30px 48px; + padding: 30px 0px; + +`; + +const Content = styled.div` + padding: 0px 48px; `; const StyledP = styled(P)` - padding: 20px 0px; + padding-bottom: 20px; +`; + +const Divider = styled.div` + width: 100%; + height: 1px; + background: ${colors.DIVIDER}; + margin: 20px 0px; `; const Row = styled.div` @@ -47,6 +59,20 @@ const Row = styled.div` } `; +const WarnButton = styled(Button)` + background: transparent; + border-color: ${colors.WARNING_PRIMARY}; + color: ${colors.WARNING_PRIMARY}; + + &:focus, + &:hover, + &:active { + color: ${colors.WHITE}; + background: ${colors.WARNING_PRIMARY}; + box-shadow: none; + } +`; + class ConfirmUnverifiedAddress extends PureComponent { componentDidMount(): void { this.keyboardHandler = this.keyboardHandler.bind(this); @@ -86,26 +112,48 @@ class ConfirmUnverifiedAddress extends PureComponent { let claim: string; if (!device.connected) { - deviceStatus = `${device.label} is not connected`; + deviceStatus = `Device ${device.label} is not connected`; claim = 'Please connect your device'; } else { // corner-case where device is connected but it is unavailable because it was created with different "passphrase_protection" settings const enable: string = device.features && device.features.passphrase_protection ? 'enable' : 'disable'; - deviceStatus = `${device.label} is unavailable`; + deviceStatus = `Device ${device.label} is unavailable`; claim = `Please ${enable} passphrase settings`; } + const needsBackup = device.features && device.features.needs_backup; + return ( - - - -

{ deviceStatus }

- To prevent phishing attacks, you should verify the address on your Trezor first. { claim } to continue with the verification process. - - - - + + + + +

{ deviceStatus }

+ To prevent phishing attacks, you should verify the address on your Trezor first. { claim } to continue with the verification process. +
+ + + + this.showUnverifiedAddress()}>Show unverified address + + + {needsBackup && } + {needsBackup && ( + <> + +

Device {device.label} is not backed up

+ If your device is ever lost or damaged, your funds will be lost. Backup your device first, to protect your coins against such events. +
+ + + + + + + + + )}
); }