/* @flow */ import styled from 'styled-components'; import coins from 'constants/coins'; import colors from 'config/colors'; 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 { FormattedMessage } from 'react-intl'; import Divider from '../Divider'; import RowCoin from '../RowCoin'; import l10nMessages from './index.messages'; import type { Props } from '../common'; const Wrapper = styled.div``; const ExternalWallet = styled.div` cursor: pointer; `; class CoinMenu extends PureComponent { getBaseUrl() { const { selectedDevice } = this.props.wallet; let baseUrl = ''; if (selectedDevice && selectedDevice.features) { baseUrl = `/device/${selectedDevice.features.device_id}`; if (selectedDevice.instance) { baseUrl += `:${selectedDevice.instance}`; } } return baseUrl; } getOtherCoins() { return coins .sort((a, b) => a.order - b.order) .map(coin => { const row = ( ); if (coin.external) return ( this.props.gotoExternalWallet(coin.id, coin.url)} > {row} ); return ( {row} ); }); } render() { const { config } = this.props.localStorage; return ( {config.networks .sort((a, b) => a.order - b.order) .map(item => ( ))} } hasBorder /> {this.getOtherCoins()} ); } } CoinMenu.propTypes = { localStorage: PropTypes.object.isRequired, wallet: PropTypes.object.isRequired, gotoExternalWallet: PropTypes.func.isRequired, }; export default CoinMenu;