From 25f1d4efcbfea521046bb96391283406567e094d Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Fri, 22 Mar 2019 12:24:41 +0100 Subject: [PATCH] auto generated clickable coinlogos in dashboard --- src/views/Wallet/views/Dashboard/Container.js | 26 +++++++++ src/views/Wallet/views/Dashboard/index.js | 58 +++++++++++++------ src/views/index.js | 2 +- 3 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 src/views/Wallet/views/Dashboard/Container.js diff --git a/src/views/Wallet/views/Dashboard/Container.js b/src/views/Wallet/views/Dashboard/Container.js new file mode 100644 index 00000000..a63dd05d --- /dev/null +++ b/src/views/Wallet/views/Dashboard/Container.js @@ -0,0 +1,26 @@ +/* @flow */ +import { connect } from 'react-redux'; +import type { MapStateToProps } from 'react-redux'; +import type { State } from 'flowtype'; +import Dashboard from "./index"; + +type OwnProps = {}; + +type StateProps = { + localStorage: $ElementType, + wallet: $ElementType, +}; + +export type Props = StateProps; + +const mapStateToProps: MapStateToProps = ( + state: State +): StateProps => ({ + localStorage: state.localStorage, + wallet: state.wallet, +}); + +export default connect( + mapStateToProps, + null +)(Dashboard); diff --git a/src/views/Wallet/views/Dashboard/index.js b/src/views/Wallet/views/Dashboard/index.js index 58a9ebd9..631bcabf 100644 --- a/src/views/Wallet/views/Dashboard/index.js +++ b/src/views/Wallet/views/Dashboard/index.js @@ -1,13 +1,13 @@ /* @flow */ import React from 'react'; import styled from 'styled-components'; -import { connect } from 'react-redux'; import Content from 'views/Wallet/components/Content'; - +import { NavLink } from 'react-router-dom'; import { CoinLogo, H4, P } from 'trezor-ui-components'; import { FormattedMessage } from 'react-intl'; import l10nMessages from './index.messages'; +import { Props } from './Container'; const Wrapper = styled.div` display: flex; @@ -30,17 +30,12 @@ const StyledP = styled(P)` } `; -const Overlay = styled.div` +const Coins = styled.div` display: flex; - width: 100%; - height: 40px; - justify-content: center; - align-items: center; - opacity: 0.2; - background: white; + flex-wrap: wrap; `; -const StyledCoinLogo = styled(CoinLogo)` +const StyledNavLink = styled(NavLink)` margin-right: 10px; &:last-child { @@ -48,7 +43,27 @@ const StyledCoinLogo = styled(CoinLogo)` } `; -const Dashboard = () => ( +const StyledCoinLogo = styled(CoinLogo)` + opacity: 0.7; + transition: opacity 0.2s ease-in-out; + + &:hover { + opacity: 1; + } +`; + +const getBaseUrl = device => { + let baseUrl = ''; + if (device && device.features) { + baseUrl = `/device/${device.features.device_id}`; + if (device.instance) { + baseUrl += `:${device.instance}`; + } + } + + return baseUrl; +}; +const Dashboard = (props: Props) => ( @@ -58,16 +73,21 @@ const Dashboard = () => ( - - - - + + {props.localStorage.config.networks.map(network => ( + + + + ))} + ); -export default connect( - null, - null -)(Dashboard); +export default Dashboard \ No newline at end of file diff --git a/src/views/index.js b/src/views/index.js index fa73d779..be84722a 100644 --- a/src/views/index.js +++ b/src/views/index.js @@ -23,7 +23,7 @@ import AccountSend from 'views/Wallet/views/Account/Send'; import AccountReceive from 'views/Wallet/views/Account/Receive'; import AccountSignVerify from 'views/Wallet/views/Account/SignVerify/Container'; -import WalletDashboard from 'views/Wallet/views/Dashboard'; +import WalletDashboard from 'views/Wallet/views/Dashboard/Container'; import WalletDeviceSettings from 'views/Wallet/views/DeviceSettings'; import WalletSettings from 'views/Wallet/views/WalletSettings/Container'; import WalletBootloader from 'views/Wallet/views/Bootloader';