Show exact wallet balance on mouse hover over

This commit is contained in:
miikkatu 2018-04-17 08:14:14 +03:00
parent 2ea96064c2
commit 4196e3483c
2 changed files with 16 additions and 12 deletions

View file

@ -1,22 +1,21 @@
import { connect } from 'react-redux';
import { doDownloadUpgradeRequested } from 'redux/actions/app';
import { doNavigate } from 'redux/actions/navigation';
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app';
import { formatCredits } from 'util/formatCredits';
import { selectBalance } from 'redux/selectors/wallet';
import { formatCredits } from 'util/formatCredits';
import Header from './view';
import { doDownloadUpgradeRequested } from 'redux/actions/app';
const select = state => ({
isUpgradeAvailable: selectIsUpgradeAvailable(state),
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
balance: formatCredits(selectBalance(state) || 0, 2),
balance: selectBalance(state),
isUpgradeAvailable: selectIsUpgradeAvailable(state),
roundedBalance: formatCredits(selectBalance(state) || 0, 2),
});
const perform = dispatch => ({
navigate: path => dispatch(doNavigate(path)),
back: () => dispatch(doHistoryBack()),
forward: () => dispatch(doHistoryForward()),
downloadUpgradeRequested: () => dispatch(doDownloadUpgradeRequested()),
navigate: path => dispatch(doNavigate(path)),
});
export default connect(select, perform)(Header);

View file

@ -5,20 +5,22 @@ import WunderBar from 'component/wunderbar';
import * as icons from 'constants/icons';
type Props = {
autoUpdateDownloaded: boolean,
balance: string,
navigate: any => void,
downloadUpgradeRequested: any => void,
isUpgradeAvailable: boolean,
autoUpdateDownloaded: boolean,
navigate: any => void,
roundedBalance: string,
};
const Header = (props: Props) => {
const {
autoUpdateDownloaded,
balance,
downloadUpgradeRequested,
isUpgradeAvailable,
navigate,
downloadUpgradeRequested,
autoUpdateDownloaded,
roundedBalance,
} = props;
const showUpgradeButton =
@ -37,7 +39,10 @@ const Header = (props: Props) => {
`${balance}`
) : (
<React.Fragment>
<span className="btn__label--balance">You have</span> <span>{balance} LBC</span>
<span className="btn__label--balance" title={`${balance} LBC`}>
You have
</span>{' '}
<span title={`${balance} LBC`}>{roundedBalance} LBC</span>
</React.Fragment>
)
}