2018-02-20 09:30:36 +00:00
|
|
|
/* @flow */
|
2018-07-30 10:52:13 +00:00
|
|
|
|
2018-02-20 09:30:36 +00:00
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { Link, NavLink } from 'react-router-dom';
|
|
|
|
|
2018-04-16 21:19:50 +00:00
|
|
|
import type { Props } from './index';
|
2018-05-18 16:54:21 +00:00
|
|
|
import type { TrezorDevice } from '~/flowtype';
|
2018-04-16 21:19:50 +00:00
|
|
|
|
|
|
|
const CoinSelection = (props: Props): React$Element<string> => {
|
2018-02-20 09:30:36 +00:00
|
|
|
const { location } = props.router;
|
|
|
|
const { config } = props.localStorage;
|
2018-05-23 08:57:36 +00:00
|
|
|
const { selectedDevice } = props.wallet;
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-05-05 12:11:03 +00:00
|
|
|
let baseUrl: string = '';
|
2018-05-23 08:57:36 +00:00
|
|
|
if (selectedDevice && selectedDevice.features) {
|
|
|
|
baseUrl = `/device/${selectedDevice.features.device_id}`;
|
2018-05-05 12:11:03 +00:00
|
|
|
if (selectedDevice.instance) {
|
|
|
|
baseUrl += `:${selectedDevice.instance}`;
|
|
|
|
}
|
|
|
|
}
|
2018-05-05 11:52:03 +00:00
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
const walletCoins = config.coins.map((item) => {
|
|
|
|
const url = `${baseUrl}/network/${item.network}/account/0`;
|
|
|
|
const className = `coin ${item.network}`;
|
2018-02-20 09:30:36 +00:00
|
|
|
return (
|
2018-07-30 10:52:13 +00:00
|
|
|
<NavLink key={item.network} to={url} className={className}>
|
2018-02-20 09:30:36 +00:00
|
|
|
{ item.name }
|
|
|
|
</NavLink>
|
2018-07-30 10:52:13 +00:00
|
|
|
);
|
|
|
|
});
|
2018-02-20 09:30:36 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<section>
|
|
|
|
{ walletCoins }
|
|
|
|
<div className="coin-divider">
|
|
|
|
Other coins <span>(You will be redirected)</span>
|
|
|
|
</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>
|
|
|
|
);
|
2018-07-30 10:52:13 +00:00
|
|
|
};
|
2018-02-20 09:30:36 +00:00
|
|
|
|
|
|
|
export default CoinSelection;
|