mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-30 12:18:09 +00:00
hide balances when hide balance setting is active
This commit is contained in:
parent
846b531f64
commit
49bea382a9
@ -141,7 +141,7 @@ const AccountMenu = (props: Props) => {
|
||||
{...l10nCommonMessages.TR_ACCOUNT_HASH}
|
||||
values={{ number: account.index + 1 }}
|
||||
/>
|
||||
{balance && (
|
||||
{balance && !props.wallet.hideBalance && (
|
||||
<Text>
|
||||
{balance}
|
||||
{fiatRates && (
|
||||
|
@ -17,6 +17,7 @@ type Props = {
|
||||
balance: string,
|
||||
fiat: $ElementType<ReducersState, 'fiat'>,
|
||||
localCurrency: string,
|
||||
isHidden: boolean,
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -105,11 +106,19 @@ class AccountBalance extends PureComponent<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isHidden: false,
|
||||
canAnimateHideBalanceIcon: false,
|
||||
isHidden: props.isHidden,
|
||||
canAnimateHideBalanceIcon: props.isHidden,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (prevProps.isHidden !== this.props.isHidden) {
|
||||
this.setState({
|
||||
isHidden: this.props.isHidden,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
handleHideBalanceIconClick() {
|
||||
this.setState(previousState => ({
|
||||
isHidden: !previousState.isHidden,
|
||||
|
@ -84,7 +84,11 @@ class AddedToken extends PureComponent {
|
||||
|
||||
<TokenName>{this.props.token.name}</TokenName>
|
||||
<TokenBalance>
|
||||
{this.getTokenBalance(this.props.token)} {this.props.token.symbol}
|
||||
{this.props.hideBalance ? (
|
||||
<Icon icon={ICONS.EYE_CROSSED} size={25} color={colors.TEXT_SECONDARY} />
|
||||
) : (
|
||||
`${this.getTokenBalance(this.props.token)} ${this.props.token.symbol}`
|
||||
)}
|
||||
</TokenBalance>
|
||||
<RemoveTokenButton
|
||||
isTransparent
|
||||
@ -101,6 +105,7 @@ AddedToken.propTypes = {
|
||||
token: PropTypes.object,
|
||||
pending: PropTypes.array,
|
||||
removeToken: PropTypes.func,
|
||||
hideBalance: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default AddedToken;
|
||||
|
@ -105,6 +105,7 @@ const AccountSummary = (props: Props) => {
|
||||
balance={balance}
|
||||
fiat={props.fiat}
|
||||
localCurrency={props.wallet.localCurrency}
|
||||
isHidden={props.wallet.hideBalance}
|
||||
/>
|
||||
<H2Wrapper>
|
||||
<H2>
|
||||
@ -164,6 +165,7 @@ const AccountSummary = (props: Props) => {
|
||||
token={token}
|
||||
pending={pending}
|
||||
removeToken={props.removeToken}
|
||||
hideBalance={props.wallet.hideBalance}
|
||||
/>
|
||||
))}
|
||||
</AddedTokensWrapper>
|
||||
|
@ -15,6 +15,7 @@ type Props = {
|
||||
reserve: string,
|
||||
fiat: $ElementType<ReducersState, 'fiat'>,
|
||||
localCurrency: string,
|
||||
isHidden: boolean,
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -103,11 +104,20 @@ class AccountBalance extends PureComponent<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isHidden: false,
|
||||
canAnimateHideBalanceIcon: false,
|
||||
isHidden: props.isHidden,
|
||||
canAnimateHideBalanceIcon: props.isHidden,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
console.log(this.props.isHidden);
|
||||
if (prevProps.isHidden !== this.props.isHidden) {
|
||||
this.setState({
|
||||
isHidden: this.props.isHidden,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
handleHideBalanceIconClick() {
|
||||
this.setState(previousState => ({
|
||||
isHidden: !previousState.isHidden,
|
||||
|
@ -86,6 +86,7 @@ const AccountSummary = (props: Props) => {
|
||||
reserve={reserve}
|
||||
fiat={props.fiat}
|
||||
localCurrency={props.wallet.localCurrency}
|
||||
isHidden={props.wallet.hideBalance}
|
||||
/>
|
||||
{TMP_SHOW_HISTORY && (
|
||||
<H2Wrapper>
|
||||
|
Loading…
Reference in New Issue
Block a user