From 42fdb7728a6756f3c1eea5ce58556f7e9e2d761a Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Tue, 26 Feb 2019 13:40:22 +0100 Subject: [PATCH] Added url constants for wallets --- src/actions/TrezorConnectActions.js | 3 +- .../modals/confirm/NoBackup/index.js | 83 +++++++++++++++++++ src/constants/urls.js | 5 ++ .../Wallet/views/DeviceSettings/index.js | 3 +- .../Wallet/views/FirmwareUpdate/index.js | 5 +- src/views/Wallet/views/Initialize/index.js | 3 +- 6 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 src/components/modals/confirm/NoBackup/index.js create mode 100644 src/constants/urls.js diff --git a/src/actions/TrezorConnectActions.js b/src/actions/TrezorConnectActions.js index 78eb12a4..8b05b218 100644 --- a/src/actions/TrezorConnectActions.js +++ b/src/actions/TrezorConnectActions.js @@ -3,6 +3,7 @@ import TrezorConnect, { DEVICE, DEVICE_EVENT, UI_EVENT, TRANSPORT_EVENT, BLOCKCHAIN_EVENT, } from 'trezor-connect'; import { CONTEXT_NONE } from 'actions/constants/modal'; +import urlConstants from 'constants/urls'; import * as CONNECT from 'actions/constants/TrezorConnect'; import * as NOTIFICATION from 'actions/constants/notification'; import { getDuplicateInstanceNumber } from 'reducers/utils'; @@ -133,7 +134,7 @@ export const init = (): AsyncAction => async (dispatch: Dispatch, getState: GetS pendingTransportEvent: (getState().devices.length < 1), manifest: { email: 'info@trezor.io', - appUrl: 'https://beta-wallet.trezor.io/next/', + appUrl: urlConstants.NEXT_WALLET, }, }); } catch (error) { diff --git a/src/components/modals/confirm/NoBackup/index.js b/src/components/modals/confirm/NoBackup/index.js new file mode 100644 index 00000000..61d04230 --- /dev/null +++ b/src/components/modals/confirm/NoBackup/index.js @@ -0,0 +1,83 @@ +/* @flow */ + +import React from 'react'; +import PropTypes from 'prop-types'; +import styled from 'styled-components'; + +import icons from 'config/icons'; +import urlConstants from 'constants/urls'; +import colors from 'config/colors'; + +import { H2 } from 'components/Heading'; +import P from 'components/Paragraph'; +import Icon from 'components/Icon'; +import Button from 'components/Button'; +import Link from 'components/Link'; + +import type { Props as BaseProps } from '../../Container'; + +type Props = { + onReceiveConfirmation: $ElementType<$ElementType, 'onReceiveConfirmation'>; +} + +const Wrapper = styled.div` + max-width: 370px; + padding: 30px 48px; +`; + +const StyledLink = styled(Link)` + position: absolute; + right: 15px; + top: 15px; +`; + +const BackupButton = styled(Button)` + width: 100%; + margin-bottom: 10px; +`; + +const ProceedButton = 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; + } +`; + +const StyledP = styled(P)` + padding-bottom: 20px; +`; + +const Row = styled.div` + display: flex; + flex-direction: column; +`; + +const Confirmation = (props: Props) => ( + + props.onReceiveConfirmation(false)}> + + +

Your Trezor 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. + + + props.onReceiveConfirmation(false)}>Create a backup in 3 minutes + + props.onReceiveConfirmation(true)}>Show address, I will take the risk + +
+); + +Confirmation.propTypes = { + onReceiveConfirmation: PropTypes.func.isRequired, +}; + +export default Confirmation; \ No newline at end of file diff --git a/src/constants/urls.js b/src/constants/urls.js new file mode 100644 index 00000000..3596f29e --- /dev/null +++ b/src/constants/urls.js @@ -0,0 +1,5 @@ +export default { + NEXT_WALLET: 'https://beta-wallet.trezor.io/next', + OLD_WALLET: 'https://wallet.trezor.io', + OLD_WALLET_BETA: 'https://beta-wallet.trezor.io', +}; \ No newline at end of file diff --git a/src/views/Wallet/views/DeviceSettings/index.js b/src/views/Wallet/views/DeviceSettings/index.js index 019a6fbe..223c9fa6 100644 --- a/src/views/Wallet/views/DeviceSettings/index.js +++ b/src/views/Wallet/views/DeviceSettings/index.js @@ -7,6 +7,7 @@ import Button from 'components/Button'; import P from 'components/Paragraph'; import Link from 'components/Link'; import ICONS from 'config/icons'; +import urlConstants from 'constants/urls'; import Content from 'views/Wallet/components/Content'; import { connect } from 'react-redux'; @@ -43,7 +44,7 @@ const DeviceSettings = () => ( /> Device settings is under construction Please use Bitcoin wallet interface to change your device settings - + diff --git a/src/views/Wallet/views/FirmwareUpdate/index.js b/src/views/Wallet/views/FirmwareUpdate/index.js index 31e1da69..0a5c604e 100644 --- a/src/views/Wallet/views/FirmwareUpdate/index.js +++ b/src/views/Wallet/views/FirmwareUpdate/index.js @@ -3,6 +3,7 @@ import React from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; +import urlConstants from 'constants/urls'; import styled from 'styled-components'; import { H1 } from 'components/Heading'; @@ -50,9 +51,9 @@ const StyledP = styled(P)` `; const getFirmwareReleaseLink = (device: ?TrezorDevice): string => { - if (!device || !device.firmwareRelease) return 'https://beta-wallet.trezor.io'; + if (!device || !device.firmwareRelease) return urlConstants.OLD_WALLET_BETA; const release = device.firmwareRelease; - const url = release.channel === 'beta' ? 'https://beta-wallet.trezor.io/' : 'https://wallet.trezor.io/'; + const url = release.channel === 'beta' ? urlConstants.OLD_WALLET_BETA : urlConstants.OLD_WALLET; const version = release.version.join('.'); return `${url}?fw=${version}`; }; diff --git a/src/views/Wallet/views/Initialize/index.js b/src/views/Wallet/views/Initialize/index.js index 12d1ea60..1b266678 100644 --- a/src/views/Wallet/views/Initialize/index.js +++ b/src/views/Wallet/views/Initialize/index.js @@ -1,6 +1,7 @@ import styled from 'styled-components'; import { H1 } from 'components/Heading'; import Button from 'components/Button'; +import urlConstants from 'constants/urls'; import Paragraph from 'components/Paragraph'; import React from 'react'; import { connect } from 'react-redux'; @@ -30,7 +31,7 @@ const Initialize = () => (

Your device is not initialized

Please use Bitcoin wallet interface to start initialization process - +