2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2022-01-26 20:54:58 +01:00
|
|
|
import { doClearEmailEntry, doClearPasswordEntry } from 'redux/actions/user';
|
|
|
|
import { doSignOut } from 'redux/actions/app';
|
2021-10-08 05:47:39 +02:00
|
|
|
import { formatCredits } from 'util/format-credits';
|
2022-01-26 20:54:58 +01:00
|
|
|
import { selectClientSetting } from 'redux/selectors/settings';
|
2020-10-02 17:03:25 +02:00
|
|
|
import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
|
2022-01-26 20:54:58 +01:00
|
|
|
import { selectHasNavigated } from 'redux/selectors/app';
|
|
|
|
import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet';
|
2022-07-08 20:51:53 +02:00
|
|
|
import { selectEmailToVerify, selectUser } from 'redux/selectors/user';
|
2022-01-26 20:54:58 +01:00
|
|
|
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
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
const select = (state) => ({
|
2022-01-26 20:54:58 +01:00
|
|
|
balance: selectBalance(state),
|
2020-04-13 21:16:07 +02:00
|
|
|
emailToVerify: selectEmailToVerify(state),
|
2020-07-10 23:04:36 +02:00
|
|
|
hasNavigated: selectHasNavigated(state),
|
2022-01-26 20:54:58 +01:00
|
|
|
hideBalance: selectClientSetting(state, SETTINGS.HIDE_BALANCE),
|
|
|
|
roundedBalance: formatCredits(selectTotalBalance(state), 2, true),
|
|
|
|
roundedSpendableBalance: formatCredits(selectBalance(state), 2, true),
|
|
|
|
syncError: selectGetSyncErrorMessage(state),
|
2020-09-29 22:15:35 +02:00
|
|
|
user: selectUser(state),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-22 15:17:01 +02:00
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
const perform = (dispatch) => ({
|
2020-04-13 21:16:07 +02:00
|
|
|
clearEmailEntry: () => dispatch(doClearEmailEntry()),
|
|
|
|
clearPasswordEntry: () => dispatch(doClearPasswordEntry()),
|
2022-01-26 20:54:58 +01:00
|
|
|
signOut: () => dispatch(doSignOut()),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-22 15:17:01 +02:00
|
|
|
|
2020-03-14 00:00:22 +01:00
|
|
|
export default connect(select, perform)(Header);
|