lbry-desktop/src/renderer/modal/modalRouter/index.js

36 lines
1.2 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import * as settings from 'constants/settings';
2018-04-19 18:51:18 +02:00
import {
doNotify,
selectCostForCurrentPageUri,
selectBalance,
selectCurrentPage,
selectNotification,
selectNotificationProps,
} from 'lbry-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { selectUser, selectUserIsVerificationCandidate } from 'redux/selectors/user';
import ModalRouter from './view';
2018-04-18 06:22:42 +02:00
const select = state => ({
2017-08-26 05:21:26 +02:00
balance: selectBalance(state),
2017-08-22 23:19:33 +02:00
showPageCost: selectCostForCurrentPageUri(state),
2017-08-21 05:06:26 +02:00
page: selectCurrentPage(state),
isVerificationCandidate: selectUserIsVerificationCandidate(state),
isCreditIntroAcknowledged: makeSelectClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED)(state),
isEmailCollectionAcknowledged: makeSelectClientSetting(settings.EMAIL_COLLECTION_ACKNOWLEDGED)(
state
),
isWelcomeAcknowledged: makeSelectClientSetting(settings.NEW_USER_ACKNOWLEDGED)(state),
user: selectUser(state),
2018-04-19 18:51:18 +02:00
notification: selectNotification(state),
notificationProps: selectNotificationProps(state),
});
const perform = dispatch => ({
2018-04-19 18:51:18 +02:00
openModal: notification => dispatch(doNotify(notification)),
});
export default connect(select, perform)(ModalRouter);