|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
|
|
import styled from 'styled-components';
|
|
|
|
|
import coins from 'constants/coins';
|
|
|
|
|
import colors from 'config/colors';
|
|
|
|
@ -5,12 +7,19 @@ import ICONS from 'config/icons';
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
|
import { NavLink } from 'react-router-dom';
|
|
|
|
|
import Link from 'components/Link';
|
|
|
|
|
import Divider from '../Divider';
|
|
|
|
|
import RowCoin from '../RowCoin';
|
|
|
|
|
|
|
|
|
|
import type { Props } from '../common';
|
|
|
|
|
|
|
|
|
|
const Wrapper = styled.div``;
|
|
|
|
|
|
|
|
|
|
class CoinMenu extends PureComponent {
|
|
|
|
|
const ExternalWallet = styled.div`
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
class CoinMenu extends PureComponent<Props> {
|
|
|
|
|
getBaseUrl() {
|
|
|
|
|
const { selectedDevice } = this.props.wallet;
|
|
|
|
|
let baseUrl = '';
|
|
|
|
@ -24,6 +33,27 @@ class CoinMenu extends PureComponent {
|
|
|
|
|
return baseUrl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getOtherCoins() {
|
|
|
|
|
return coins.map((coin) => {
|
|
|
|
|
const row = (
|
|
|
|
|
<RowCoin
|
|
|
|
|
coin={{
|
|
|
|
|
name: coin.coinName,
|
|
|
|
|
id: coin.id,
|
|
|
|
|
}}
|
|
|
|
|
iconRight={{
|
|
|
|
|
type: ICONS.SKIP,
|
|
|
|
|
color: colors.TEXT_SECONDARY,
|
|
|
|
|
size: 27,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (coin.external) return <ExternalWallet key={coin.id} onClick={() => this.props.gotoExternalWallet(coin.id, coin.url)}>{row}</ExternalWallet>;
|
|
|
|
|
return <Link key={coin.id} href={coin.url} target="_top">{row}</Link>;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { config } = this.props.localStorage;
|
|
|
|
|
return (
|
|
|
|
@ -46,31 +76,16 @@ class CoinMenu extends PureComponent {
|
|
|
|
|
textRight="(You will be redirected)"
|
|
|
|
|
hasBorder
|
|
|
|
|
/>
|
|
|
|
|
{coins.map(coin => (
|
|
|
|
|
<a key={coin.id} href={coin.url}>
|
|
|
|
|
<RowCoin
|
|
|
|
|
coin={{
|
|
|
|
|
name: coin.coinName,
|
|
|
|
|
id: coin.id,
|
|
|
|
|
}}
|
|
|
|
|
iconRight={{
|
|
|
|
|
type: ICONS.SKIP,
|
|
|
|
|
color: colors.TEXT_SECONDARY,
|
|
|
|
|
size: 27,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
))}
|
|
|
|
|
{this.getOtherCoins()}
|
|
|
|
|
</Wrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CoinMenu.propTypes = {
|
|
|
|
|
config: PropTypes.object,
|
|
|
|
|
wallet: PropTypes.object,
|
|
|
|
|
selectedDevice: PropTypes.object,
|
|
|
|
|
localStorage: PropTypes.object,
|
|
|
|
|
localStorage: PropTypes.object.isRequired,
|
|
|
|
|
wallet: PropTypes.object.isRequired,
|
|
|
|
|
gotoExternalWallet: PropTypes.func.isRequired,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default CoinMenu;
|
|
|
|
|