mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
Refactored menu rendering
This commit is contained in:
parent
e226847ccc
commit
909c657454
@ -47,7 +47,7 @@ const A = styled.a`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Header = (): React$Element<string> => (
|
const Header = () => (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<LayoutWrapper>
|
<LayoutWrapper>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 163.7 41.9" width="100%" height="100%" preserveAspectRatio="xMinYMin meet">
|
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 163.7 41.9" width="100%" height="100%" preserveAspectRatio="xMinYMin meet">
|
||||||
|
@ -1,61 +1,54 @@
|
|||||||
/* @flow */
|
import React, { Component } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { NavLink } from 'react-router-dom';
|
||||||
|
import navigationConstants from '~/js/constants/navigation';
|
||||||
|
|
||||||
|
class CoinSelection extends Component {
|
||||||
import React from 'react';
|
getBaseUrl() {
|
||||||
import { Link, NavLink } from 'react-router-dom';
|
const { selectedDevice } = this.props.wallet;
|
||||||
|
let baseUrl = '';
|
||||||
import type { Props } from './index';
|
if (selectedDevice && selectedDevice.features) {
|
||||||
import type { TrezorDevice } from '~/flowtype';
|
baseUrl = `/device/${selectedDevice.features.device_id}`;
|
||||||
|
if (selectedDevice.instance) {
|
||||||
const CoinSelection = (props: Props): React$Element<string> => {
|
baseUrl += `:${selectedDevice.instance}`;
|
||||||
const { location } = props.router;
|
}
|
||||||
const { config } = props.localStorage;
|
|
||||||
const { selectedDevice } = props.wallet;
|
|
||||||
|
|
||||||
let baseUrl: string = '';
|
|
||||||
if (selectedDevice && selectedDevice.features) {
|
|
||||||
baseUrl = `/device/${selectedDevice.features.device_id}`;
|
|
||||||
if (selectedDevice.instance) {
|
|
||||||
baseUrl += `:${selectedDevice.instance}`;
|
|
||||||
}
|
}
|
||||||
|
return baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const walletCoins = config.coins.map((item) => {
|
render() {
|
||||||
const url = `${baseUrl}/network/${item.network}/account/0`;
|
const { config } = this.props.localStorage;
|
||||||
const className = `coin ${item.network}`;
|
|
||||||
return (
|
return (
|
||||||
<NavLink key={item.network} to={url} className={className}>
|
<section>
|
||||||
{ item.name }
|
{config.coins.map(item => (
|
||||||
</NavLink>
|
<NavLink
|
||||||
|
key={item.network}
|
||||||
|
to={`${this.getBaseUrl()}/network/${item.network}/account/0`}
|
||||||
|
>{ item.name }
|
||||||
|
</NavLink>
|
||||||
|
))}
|
||||||
|
<div className="coin-divider">
|
||||||
|
Other coins <span>(You will be redirected)</span>
|
||||||
|
</div>
|
||||||
|
{navigationConstants.map(item => (
|
||||||
|
<a
|
||||||
|
key={item.coinName}
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
href={item.url}
|
||||||
|
>{item.coinName}
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
</section>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
CoinSelection.propTypes = {
|
||||||
<section>
|
config: PropTypes.object,
|
||||||
{ walletCoins }
|
wallet: PropTypes.object,
|
||||||
<div className="coin-divider">
|
selectedDevice: PropTypes.object,
|
||||||
Other coins <span>(You will be redirected)</span>
|
localStorage: PropTypes.object,
|
||||||
</div>
|
|
||||||
<a href="https://wallet.trezor.io/#/coin/btc" className="coin btc external">
|
|
||||||
Bitcoin
|
|
||||||
</a>
|
|
||||||
<a href="https://wallet.trezor.io/#/coin/ltc" className="coin ltc external">
|
|
||||||
Litecoin
|
|
||||||
</a>
|
|
||||||
<a href="https://wallet.trezor.io/#/coin/bch" className="coin bch external">
|
|
||||||
Bitcoin Cash
|
|
||||||
</a>
|
|
||||||
<a href="https://wallet.trezor.io/#/coin/btg" className="coin btg external">
|
|
||||||
Bitcoin Gold
|
|
||||||
</a>
|
|
||||||
<a href="https://wallet.trezor.io/#/coin/dash" className="coin dash external">
|
|
||||||
Dash
|
|
||||||
</a>
|
|
||||||
<a href="https://wallet.trezor.io/#/coin/zec" className="coin zec external">
|
|
||||||
Zcash
|
|
||||||
</a>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CoinSelection;
|
export default CoinSelection;
|
@ -6,8 +6,7 @@ import colors from '~/js/config/colors';
|
|||||||
import ICONS from '~/js/constants/icons';
|
import ICONS from '~/js/constants/icons';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
const Section = styled.section`
|
const Section = styled.section``;
|
||||||
`;
|
|
||||||
|
|
||||||
const P = styled.p`
|
const P = styled.p`
|
||||||
padding: 12px 0px 24px 0px;
|
padding: 12px 0px 24px 0px;
|
||||||
@ -28,7 +27,7 @@ const Row = styled.div`
|
|||||||
padding-bottom: 98px;
|
padding-bottom: 98px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const DeviceSettings = () => (
|
const DeviceSettings = () => (
|
||||||
<Section>
|
<Section>
|
||||||
<Row>
|
<Row>
|
||||||
<Icon
|
<Icon
|
||||||
|
26
src/js/constants/navigation.js
Normal file
26
src/js/constants/navigation.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
export default [
|
||||||
|
{
|
||||||
|
coinName: 'Bitcoin',
|
||||||
|
url: 'https://wallet.trezor.io/#/coin/btc',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
coinName: 'Litecoin',
|
||||||
|
url: 'https://wallet.trezor.io/#/coin/ltc',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
coinName: 'Bitcoin Cash',
|
||||||
|
url: 'https://wallet.trezor.io/#/coin/bch',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
coinName: 'Bitcoin Gold',
|
||||||
|
url: 'https://wallet.trezor.io/#/coin/btg',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
coinName: 'Dash',
|
||||||
|
url: 'https://wallet.trezor.io/#/coin/dash',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
coinName: 'Zcash',
|
||||||
|
url: 'https://wallet.trezor.io/#/coin/zec',
|
||||||
|
},
|
||||||
|
];
|
@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
.history-transaction {
|
.history-transaction {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.amount, .time, .address {
|
.amount, .time, .address {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user