mirror of https://github.com/trezor/trezor-wallet
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.4 KiB
78 lines
2.4 KiB
6 years ago
|
import styled from 'styled-components';
|
||
6 years ago
|
import coins from 'constants/coins';
|
||
6 years ago
|
import colors from 'config/colors';
|
||
|
import ICONS from 'config/icons';
|
||
6 years ago
|
import PropTypes from 'prop-types';
|
||
|
import React, { Component } from 'react';
|
||
6 years ago
|
import { NavLink } from 'react-router-dom';
|
||
6 years ago
|
import Divider from '../Divider';
|
||
6 years ago
|
import RowCoin from '../RowCoin';
|
||
6 years ago
|
|
||
6 years ago
|
const Wrapper = styled.div``;
|
||
|
|
||
6 years ago
|
class CoinMenu extends Component {
|
||
6 years ago
|
getBaseUrl() {
|
||
|
const { selectedDevice } = this.props.wallet;
|
||
|
let baseUrl = '';
|
||
|
if (selectedDevice && selectedDevice.features) {
|
||
|
baseUrl = `/device/${selectedDevice.features.device_id}`;
|
||
|
if (selectedDevice.instance) {
|
||
|
baseUrl += `:${selectedDevice.instance}`;
|
||
|
}
|
||
6 years ago
|
}
|
||
6 years ago
|
|
||
6 years ago
|
return baseUrl;
|
||
|
}
|
||
6 years ago
|
|
||
6 years ago
|
render() {
|
||
|
const { config } = this.props.localStorage;
|
||
6 years ago
|
return (
|
||
6 years ago
|
<Wrapper>
|
||
6 years ago
|
{config.coins.map(item => (
|
||
|
<NavLink
|
||
|
key={item.network}
|
||
|
to={`${this.getBaseUrl()}/network/${item.network}/account/0`}
|
||
|
>
|
||
|
<RowCoin
|
||
|
coin={{
|
||
|
name: item.name,
|
||
6 years ago
|
network: item.network,
|
||
6 years ago
|
}}
|
||
|
/>
|
||
|
</NavLink>
|
||
|
))}
|
||
6 years ago
|
<Divider
|
||
6 years ago
|
textLeft="Other coins"
|
||
|
textRight="(You will be redirected)"
|
||
6 years ago
|
borderTop
|
||
|
borderBottom
|
||
6 years ago
|
/>
|
||
6 years ago
|
{coins.map(coin => (
|
||
6 years ago
|
<a key={coin.url} href={coin.url}>
|
||
6 years ago
|
<RowCoin
|
||
6 years ago
|
coin={{
|
||
|
name: coin.coinName,
|
||
6 years ago
|
img: coin.image,
|
||
6 years ago
|
}}
|
||
6 years ago
|
iconRight={{
|
||
6 years ago
|
type: ICONS.SKIP,
|
||
6 years ago
|
color: colors.TEXT_SECONDARY,
|
||
6 years ago
|
size: 27,
|
||
6 years ago
|
}}
|
||
|
/>
|
||
|
</a>
|
||
|
))}
|
||
6 years ago
|
</Wrapper>
|
||
6 years ago
|
);
|
||
6 years ago
|
}
|
||
|
}
|
||
6 years ago
|
|
||
6 years ago
|
CoinMenu.propTypes = {
|
||
6 years ago
|
config: PropTypes.object,
|
||
|
wallet: PropTypes.object,
|
||
|
selectedDevice: PropTypes.object,
|
||
|
localStorage: PropTypes.object,
|
||
6 years ago
|
};
|
||
6 years ago
|
|
||
6 years ago
|
export default CoinMenu;
|