lbry-desktop/ui/component/header/index.js

35 lines
1.5 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { doClearEmailEntry, doClearPasswordEntry } from 'redux/actions/user';
2019-12-18 06:27:08 +01:00
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';
2019-06-17 22:32:38 +02:00
import Header from './view';
2017-04-22 15:17:01 +02:00
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),
2020-09-29 22:15:35 +02:00
user: selectUser(state),
prefsReady: selectPrefsReady(state),
2017-06-06 06:21:55 +02:00
});
2017-04-22 15:17:01 +02:00
const perform = (dispatch) => ({
doClearClaimSearch: () => dispatch(doClearClaimSearch()),
clearEmailEntry: () => dispatch(doClearEmailEntry()),
clearPasswordEntry: () => dispatch(doClearPasswordEntry()),
signOut: () => dispatch(doSignOut()),
openChangelog: (modalProps) => dispatch(doOpenModal(MODALS.CONFIRM, modalProps)),
2017-06-06 06:21:55 +02:00
});
2017-04-22 15:17:01 +02:00
export default connect(select, perform)(Header);