mirror of
https://github.com/trezor/trezor-wallet
synced 2025-02-11 23:52:47 +00:00
add hide balance toggler to device menu
This commit is contained in:
parent
55fa711e47
commit
846b531f64
@ -1,5 +1,5 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
import { toggleDeviceDropdown, toggleSidebar } from 'actions/WalletActions';
|
import { toggleDeviceDropdown, toggleSidebar, setHideBalance } from 'actions/WalletActions';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
@ -43,6 +43,7 @@ const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps>
|
|||||||
onSelectDevice: bindActionCreators(RouterActions.selectDevice, dispatch),
|
onSelectDevice: bindActionCreators(RouterActions.selectDevice, dispatch),
|
||||||
gotoExternalWallet: bindActionCreators(ModalActions.gotoExternalWallet, dispatch),
|
gotoExternalWallet: bindActionCreators(ModalActions.gotoExternalWallet, dispatch),
|
||||||
toggleSidebar: bindActionCreators(toggleSidebar, dispatch),
|
toggleSidebar: bindActionCreators(toggleSidebar, dispatch),
|
||||||
|
setHideBalance: bindActionCreators(setHideBalance, dispatch),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default withRouter(
|
export default withRouter(
|
||||||
|
@ -3,6 +3,7 @@ import styled from 'styled-components';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Icon from 'components/Icon';
|
import Icon from 'components/Icon';
|
||||||
import Link from 'components/Link';
|
import Link from 'components/Link';
|
||||||
|
import { Switch } from 'trezor-ui-components';
|
||||||
import DeviceIcon from 'components/images/DeviceIcon';
|
import DeviceIcon from 'components/images/DeviceIcon';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { getPattern } from 'support/routes';
|
import { getPattern } from 'support/routes';
|
||||||
@ -21,6 +22,7 @@ const Wrapper = styled.div`
|
|||||||
const Item = styled.div`
|
const Item = styled.div`
|
||||||
padding: 6px 24px;
|
padding: 6px 24px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
height: 38px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: ${FONT_SIZE.BASE};
|
font-size: ${FONT_SIZE.BASE};
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -39,6 +41,7 @@ const Divider = styled.div`
|
|||||||
|
|
||||||
const Label = styled.div`
|
const Label = styled.div`
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
|
flex: 1;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
class MenuItems extends PureComponent {
|
class MenuItems extends PureComponent {
|
||||||
@ -108,6 +111,24 @@ class MenuItems extends PureComponent {
|
|||||||
</Label>
|
</Label>
|
||||||
</Item>
|
</Item>
|
||||||
<Divider />
|
<Divider />
|
||||||
|
<Item>
|
||||||
|
<Icon icon={icons.EYE_CROSSED} size={25} color={colors.TEXT_SECONDARY} />
|
||||||
|
<Label>
|
||||||
|
<FormattedMessage {...l10nCommonMessages.TR_HIDE_BALANCE} />
|
||||||
|
</Label>
|
||||||
|
<Switch
|
||||||
|
width={36}
|
||||||
|
height={18}
|
||||||
|
handleDiameter={14}
|
||||||
|
checkedIcon={false}
|
||||||
|
uncheckedIcon={false}
|
||||||
|
onChange={checked => {
|
||||||
|
this.props.setHideBalance(checked);
|
||||||
|
}}
|
||||||
|
checked={this.props.wallet.hideBalance}
|
||||||
|
/>
|
||||||
|
</Item>
|
||||||
|
<Divider />
|
||||||
<Link to={getPattern('wallet-settings')}>
|
<Link to={getPattern('wallet-settings')}>
|
||||||
<Item>
|
<Item>
|
||||||
<Icon icon={icons.COG} size={25} color={colors.TEXT_SECONDARY} />
|
<Icon icon={icons.COG} size={25} color={colors.TEXT_SECONDARY} />
|
||||||
@ -123,9 +144,11 @@ class MenuItems extends PureComponent {
|
|||||||
|
|
||||||
MenuItems.propTypes = {
|
MenuItems.propTypes = {
|
||||||
device: PropTypes.object.isRequired,
|
device: PropTypes.object.isRequired,
|
||||||
|
wallet: PropTypes.object.isRequired,
|
||||||
acquireDevice: PropTypes.func.isRequired,
|
acquireDevice: PropTypes.func.isRequired,
|
||||||
forgetDevice: PropTypes.func.isRequired,
|
forgetDevice: PropTypes.func.isRequired,
|
||||||
duplicateDevice: PropTypes.func.isRequired,
|
duplicateDevice: PropTypes.func.isRequired,
|
||||||
|
setHideBalance: PropTypes.func.isRequired,
|
||||||
// toggleDeviceDropdown: PropTypes.func.isRequired,
|
// toggleDeviceDropdown: PropTypes.func.isRequired,
|
||||||
// gotoDeviceSettings: PropTypes.func.isRequired,
|
// gotoDeviceSettings: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
@ -401,6 +401,7 @@ LeftNavigation.propTypes = {
|
|||||||
duplicateDevice: PropTypes.func,
|
duplicateDevice: PropTypes.func,
|
||||||
gotoDeviceSettings: PropTypes.func,
|
gotoDeviceSettings: PropTypes.func,
|
||||||
onSelectDevice: PropTypes.func,
|
onSelectDevice: PropTypes.func,
|
||||||
|
setHideBalance: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LeftNavigation;
|
export default LeftNavigation;
|
||||||
|
Loading…
Reference in New Issue
Block a user