1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-05 15:49:00 +00:00

Added url constants for wallets

This commit is contained in:
Vladimir Volek 2019-02-26 13:40:22 +01:00
parent b45a3d3eee
commit 42fdb7728a
6 changed files with 97 additions and 5 deletions

View File

@ -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) {

View File

@ -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<BaseProps, 'modalActions'>, '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) => (
<Wrapper>
<StyledLink onClick={() => props.onReceiveConfirmation(false)}>
<Icon size={24} color={colors.TEXT_SECONDARY} icon={icons.CLOSE} />
</StyledLink>
<H2>Your Trezor is not backed up</H2>
<Icon size={48} color={colors.WARNING_PRIMARY} icon={icons.WARNING} />
<StyledP isSmaller>If your device is ever lost or damaged, your funds will be lost. Backup your device first, to protect your coins against such events.</StyledP>
<Row>
<Link href={`${urlConstants.OLD_WALLET}/?backup`}>
<BackupButton onClick={() => props.onReceiveConfirmation(false)}>Create a backup in 3 minutes</BackupButton>
</Link>
<ProceedButton isWhite onClick={() => props.onReceiveConfirmation(true)}>Show address, I will take the risk</ProceedButton>
</Row>
</Wrapper>
);
Confirmation.propTypes = {
onReceiveConfirmation: PropTypes.func.isRequired,
};
export default Confirmation;

5
src/constants/urls.js Normal file
View File

@ -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',
};

View File

@ -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 = () => (
/>
<StyledH1>Device settings is under construction</StyledH1>
<StyledP>Please use Bitcoin wallet interface to change your device settings</StyledP>
<Link href="https://beta-wallet.trezor.io/">
<Link href={urlConstants.OLD_WALLET_BETA}>
<Button>Take me to the Bitcoin wallet</Button>
</Link>
</Row>

View File

@ -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}`;
};

View File

@ -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 = () => (
<Row>
<H1>Your device is not initialized</H1>
<StyledParagraph>Please use Bitcoin wallet interface to start initialization process</StyledParagraph>
<A href="https://beta-wallet.trezor.io/">
<A href={urlConstants.OLD_WALLET_BETA}>
<Button>Take me to the Bitcoin wallet</Button>
</A>
</Row>