lbry-desktop/ui/component/header/index.js
infinite-persistence 40a59c53d4
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
2022-05-12 14:36:06 +08:00

34 lines
1.5 KiB
JavaScript

import { connect } from 'react-redux';
import { doClearEmailEntry, doClearPasswordEntry } from 'redux/actions/user';
import { doSignOut, doOpenModal } from 'redux/actions/app';
import { doClearClaimSearch } from 'redux/actions/claims';
import { selectClientSetting } from 'redux/selectors/settings';
import { selectGetSyncErrorMessage, selectPrefsReady } from 'redux/selectors/sync';
import { selectHasNavigated } from 'redux/selectors/app';
import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet';
import { selectUserVerifiedEmail, selectEmailToVerify, selectUser } from 'redux/selectors/user';
import * as MODALS from 'constants/modal_types';
import * as SETTINGS from 'constants/settings';
import Header from './view';
const select = (state) => ({
authenticated: selectUserVerifiedEmail(state),
balance: selectBalance(state),
emailToVerify: selectEmailToVerify(state),
hasNavigated: selectHasNavigated(state),
hideBalance: selectClientSetting(state, SETTINGS.HIDE_BALANCE),
totalBalance: selectTotalBalance(state),
syncError: selectGetSyncErrorMessage(state),
user: selectUser(state),
prefsReady: selectPrefsReady(state),
});
const perform = (dispatch) => ({
doClearClaimSearch: () => dispatch(doClearClaimSearch()),
clearEmailEntry: () => dispatch(doClearEmailEntry()),
clearPasswordEntry: () => dispatch(doClearPasswordEntry()),
signOut: () => dispatch(doSignOut()),
openChangelog: (modalProps) => dispatch(doOpenModal(MODALS.CONFIRM, modalProps)),
});
export default connect(select, perform)(Header);