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}
|
{...l10nCommonMessages.TR_ACCOUNT_HASH}
|
||||||
values={{ number: account.index + 1 }}
|
values={{ number: account.index + 1 }}
|
||||||
/>
|
/>
|
||||||
{balance && (
|
{balance && !props.wallet.hideBalance && (
|
||||||
<Text>
|
<Text>
|
||||||
{balance}
|
{balance}
|
||||||
{fiatRates && (
|
{fiatRates && (
|
||||||
|
@ -17,6 +17,7 @@ type Props = {
|
|||||||
balance: string,
|
balance: string,
|
||||||
fiat: $ElementType<ReducersState, 'fiat'>,
|
fiat: $ElementType<ReducersState, 'fiat'>,
|
||||||
localCurrency: string,
|
localCurrency: string,
|
||||||
|
isHidden: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@ -105,11 +106,19 @@ class AccountBalance extends PureComponent<Props, State> {
|
|||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isHidden: false,
|
isHidden: props.isHidden,
|
||||||
canAnimateHideBalanceIcon: false,
|
canAnimateHideBalanceIcon: props.isHidden,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
if (prevProps.isHidden !== this.props.isHidden) {
|
||||||
|
this.setState({
|
||||||
|
isHidden: this.props.isHidden,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleHideBalanceIconClick() {
|
handleHideBalanceIconClick() {
|
||||||
this.setState(previousState => ({
|
this.setState(previousState => ({
|
||||||
isHidden: !previousState.isHidden,
|
isHidden: !previousState.isHidden,
|
||||||
|
@ -84,7 +84,11 @@ class AddedToken extends PureComponent {
|
|||||||
|
|
||||||
<TokenName>{this.props.token.name}</TokenName>
|
<TokenName>{this.props.token.name}</TokenName>
|
||||||
<TokenBalance>
|
<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>
|
</TokenBalance>
|
||||||
<RemoveTokenButton
|
<RemoveTokenButton
|
||||||
isTransparent
|
isTransparent
|
||||||
@ -101,6 +105,7 @@ AddedToken.propTypes = {
|
|||||||
token: PropTypes.object,
|
token: PropTypes.object,
|
||||||
pending: PropTypes.array,
|
pending: PropTypes.array,
|
||||||
removeToken: PropTypes.func,
|
removeToken: PropTypes.func,
|
||||||
|
hideBalance: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AddedToken;
|
export default AddedToken;
|
||||||
|
@ -105,6 +105,7 @@ const AccountSummary = (props: Props) => {
|
|||||||
balance={balance}
|
balance={balance}
|
||||||
fiat={props.fiat}
|
fiat={props.fiat}
|
||||||
localCurrency={props.wallet.localCurrency}
|
localCurrency={props.wallet.localCurrency}
|
||||||
|
isHidden={props.wallet.hideBalance}
|
||||||
/>
|
/>
|
||||||
<H2Wrapper>
|
<H2Wrapper>
|
||||||
<H2>
|
<H2>
|
||||||
@ -164,6 +165,7 @@ const AccountSummary = (props: Props) => {
|
|||||||
token={token}
|
token={token}
|
||||||
pending={pending}
|
pending={pending}
|
||||||
removeToken={props.removeToken}
|
removeToken={props.removeToken}
|
||||||
|
hideBalance={props.wallet.hideBalance}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</AddedTokensWrapper>
|
</AddedTokensWrapper>
|
||||||
|
@ -15,6 +15,7 @@ type Props = {
|
|||||||
reserve: string,
|
reserve: string,
|
||||||
fiat: $ElementType<ReducersState, 'fiat'>,
|
fiat: $ElementType<ReducersState, 'fiat'>,
|
||||||
localCurrency: string,
|
localCurrency: string,
|
||||||
|
isHidden: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@ -103,11 +104,20 @@ class AccountBalance extends PureComponent<Props, State> {
|
|||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isHidden: false,
|
isHidden: props.isHidden,
|
||||||
canAnimateHideBalanceIcon: false,
|
canAnimateHideBalanceIcon: props.isHidden,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
console.log(this.props.isHidden);
|
||||||
|
if (prevProps.isHidden !== this.props.isHidden) {
|
||||||
|
this.setState({
|
||||||
|
isHidden: this.props.isHidden,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleHideBalanceIconClick() {
|
handleHideBalanceIconClick() {
|
||||||
this.setState(previousState => ({
|
this.setState(previousState => ({
|
||||||
isHidden: !previousState.isHidden,
|
isHidden: !previousState.isHidden,
|
||||||
|
@ -86,6 +86,7 @@ const AccountSummary = (props: Props) => {
|
|||||||
reserve={reserve}
|
reserve={reserve}
|
||||||
fiat={props.fiat}
|
fiat={props.fiat}
|
||||||
localCurrency={props.wallet.localCurrency}
|
localCurrency={props.wallet.localCurrency}
|
||||||
|
isHidden={props.wallet.hideBalance}
|
||||||
/>
|
/>
|
||||||
{TMP_SHOW_HISTORY && (
|
{TMP_SHOW_HISTORY && (
|
||||||
<H2Wrapper>
|
<H2Wrapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user