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

61 lines
2.0 KiB
JavaScript
Raw Normal View History

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';
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;
const { selectedDevice } = props.wallet;
2018-02-20 09:30:36 +00:00
2018-05-05 12:11:03 +00:00
let baseUrl: string = '';
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;