lbry-desktop/ui/js/modal/modalRouter/index.js

31 lines
1 KiB
JavaScript
Raw Normal View History

import React from "react";
import { connect } from "react-redux";
2017-08-21 05:06:26 +02:00
import { selectCurrentModal, selectCurrentPage } from "selectors/app";
import { doOpenModal } from "actions/app";
2017-08-21 05:06:26 +02:00
import { makeSelectClientSetting } from "selectors/settings";
import { selectUser } from "selectors/user";
2017-08-22 23:19:33 +02:00
import { selectCostForCurrentPageUri } from "selectors/cost_info";
2017-08-21 05:06:26 +02:00
import * as settings from "constants/settings";
2017-08-26 05:21:26 +02:00
import { selectBalance } from "selectors/wallet";
import ModalRouter from "./view";
const select = (state, props) => ({
2017-08-26 05:21:26 +02:00
balance: selectBalance(state),
2017-08-22 23:19:33 +02:00
showPageCost: selectCostForCurrentPageUri(state),
modal: selectCurrentModal(state),
2017-08-21 05:06:26 +02:00
page: selectCurrentPage(state),
isWelcomeAcknowledged: makeSelectClientSetting(
settings.NEW_USER_ACKNOWLEDGED
)(state),
isCreditIntroAcknowledged: makeSelectClientSetting(
settings.CREDIT_INTRO_ACKNOWLEDGED
)(state),
user: selectUser(state),
});
const perform = dispatch => ({
2017-08-21 05:06:26 +02:00
openModal: modal => dispatch(doOpenModal(modal)),
});
export default connect(select, perform)(ModalRouter);