2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doNavigate } from 'redux/actions/navigation';
|
|
|
|
import { doSetClientSetting } from 'redux/actions/settings';
|
|
|
|
import { selectUserIsRewardApproved } from 'redux/selectors/user';
|
2018-04-19 12:51:18 -04:00
|
|
|
import { selectBalance, doHideNotification } from 'lbry-redux';
|
2017-12-29 16:23:46 -08:00
|
|
|
import { selectUnclaimedRewardValue } from 'redux/selectors/rewards';
|
2017-12-21 18:08:54 -03:00
|
|
|
import * as settings from 'constants/settings';
|
|
|
|
import ModalCreditIntro from './view';
|
2017-06-07 20:56:52 -04:00
|
|
|
|
2017-12-29 16:23:46 -08:00
|
|
|
const select = state => ({
|
|
|
|
currentBalance: selectBalance(state),
|
|
|
|
isRewardApproved: selectUserIsRewardApproved(state),
|
|
|
|
totalRewardValue: selectUnclaimedRewardValue(state),
|
|
|
|
});
|
2017-06-07 20:56:52 -04:00
|
|
|
|
2017-12-13 18:36:30 -03:00
|
|
|
const perform = dispatch => () => ({
|
|
|
|
addBalance: () => {
|
|
|
|
dispatch(doSetClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED, true));
|
2017-12-21 18:08:54 -03:00
|
|
|
dispatch(doNavigate('/getcredits'));
|
2018-04-19 12:51:18 -04:00
|
|
|
dispatch(doHideNotification());
|
2017-12-13 18:36:30 -03:00
|
|
|
},
|
|
|
|
closeModal: () => {
|
|
|
|
dispatch(doSetClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED, true));
|
2018-04-19 12:51:18 -04:00
|
|
|
dispatch(doHideNotification());
|
2017-12-13 18:36:30 -03:00
|
|
|
},
|
|
|
|
});
|
2017-06-07 20:56:52 -04:00
|
|
|
|
2017-08-18 13:09:40 -04:00
|
|
|
export default connect(select, perform)(ModalCreditIntro);
|