Don't show wallet value until prefs are ready

... because preference might be "Hide wallet = true". This eliminates the gap during login or boot up that temporarily shows the wallet balance.

Ticket: 1365
This commit is contained in:
infinite-persistence 2022-05-12 14:21:17 +08:00
parent f0f1d0f695
commit 40a59c53d4
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 6 additions and 5 deletions

View file

@ -3,7 +3,7 @@ import { doClearEmailEntry, doClearPasswordEntry } from 'redux/actions/user';
import { doSignOut, doOpenModal } from 'redux/actions/app'; import { doSignOut, doOpenModal } from 'redux/actions/app';
import { doClearClaimSearch } from 'redux/actions/claims'; import { doClearClaimSearch } from 'redux/actions/claims';
import { selectClientSetting } from 'redux/selectors/settings'; import { selectClientSetting } from 'redux/selectors/settings';
import { selectGetSyncErrorMessage } from 'redux/selectors/sync'; import { selectGetSyncErrorMessage, selectPrefsReady } from 'redux/selectors/sync';
import { selectHasNavigated } from 'redux/selectors/app'; import { selectHasNavigated } from 'redux/selectors/app';
import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet'; import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet';
import { selectUserVerifiedEmail, selectEmailToVerify, selectUser } from 'redux/selectors/user'; import { selectUserVerifiedEmail, selectEmailToVerify, selectUser } from 'redux/selectors/user';
@ -20,6 +20,7 @@ const select = (state) => ({
totalBalance: selectTotalBalance(state), totalBalance: selectTotalBalance(state),
syncError: selectGetSyncErrorMessage(state), syncError: selectGetSyncErrorMessage(state),
user: selectUser(state), user: selectUser(state),
prefsReady: selectPrefsReady(state),
}); });
const perform = (dispatch) => ({ const perform = (dispatch) => ({

View file

@ -43,6 +43,7 @@ type Props = {
syncError: ?string, syncError: ?string,
totalBalance?: number, totalBalance?: number,
user: ?User, user: ?User,
prefsReady: boolean,
doClearClaimSearch: () => void, doClearClaimSearch: () => void,
clearEmailEntry: () => void, clearEmailEntry: () => void,
clearPasswordEntry: () => void, clearPasswordEntry: () => void,
@ -66,6 +67,7 @@ const Header = (props: Props) => {
syncError, syncError,
totalBalance, totalBalance,
user, user,
prefsReady,
doClearClaimSearch, doClearClaimSearch,
clearEmailEntry, clearEmailEntry,
clearPasswordEntry, clearPasswordEntry,
@ -152,10 +154,8 @@ const Header = (props: Props) => {
navigate={`/$/${PAGES.WALLET}`} navigate={`/$/${PAGES.WALLET}`}
className="button--file-action header__navigationItem--balance" className="button--file-action header__navigationItem--balance"
label={ label={
hideBalance || Number(roundedTotalBalance) === 0 hideBalance || Number(roundedTotalBalance) === 0 || !prefsReady
? isMobile ? __(isMobile ? 'Wallet' : 'Your Wallet')
? __('Wallet')
: __('Your Wallet')
: roundedTotalBalance : roundedTotalBalance
} }
icon={ICONS.LBC} icon={ICONS.LBC}