2017-06-06 17:19:12 -04:00
|
|
|
import React from "react";
|
|
|
|
import { connect } from "react-redux";
|
2017-08-24 17:12:23 -04:00
|
|
|
import {
|
|
|
|
doFetchClaimsByChannel,
|
|
|
|
doFetchClaimCountByChannel,
|
|
|
|
} from "actions/content";
|
2017-05-12 18:50:51 -04:00
|
|
|
import {
|
2017-05-18 19:14:26 -04:00
|
|
|
makeSelectClaimForUri,
|
2017-07-17 13:06:04 +07:00
|
|
|
makeSelectClaimsInChannelForCurrentPage,
|
|
|
|
makeSelectFetchingChannelClaims,
|
2017-06-06 17:19:12 -04:00
|
|
|
} from "selectors/claims";
|
2017-09-20 13:12:53 -04:00
|
|
|
import {
|
|
|
|
makeSelectCurrentParam,
|
|
|
|
selectCurrentParams,
|
|
|
|
} from "selectors/navigation";
|
2017-08-30 08:48:32 -04:00
|
|
|
import { doNavigate } from "actions/navigation";
|
2017-07-17 13:06:04 +07:00
|
|
|
import { makeSelectTotalPagesForChannel } from "selectors/content";
|
2017-06-06 17:19:12 -04:00
|
|
|
import ChannelPage from "./view";
|
2017-05-18 19:14:26 -04:00
|
|
|
|
2017-09-07 23:15:05 -04:00
|
|
|
const select = (state, props) => ({
|
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
2017-09-20 13:12:53 -04:00
|
|
|
claimsInChannel: makeSelectClaimsInChannelForCurrentPage(props.uri)(state),
|
2017-09-07 23:15:05 -04:00
|
|
|
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
|
2017-09-20 13:12:53 -04:00
|
|
|
page: makeSelectCurrentParam("page")(state),
|
2017-09-07 23:15:05 -04:00
|
|
|
params: selectCurrentParams(state),
|
|
|
|
totalPages: makeSelectTotalPagesForChannel(props.uri)(state),
|
|
|
|
});
|
2017-05-03 23:44:08 -04:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
const perform = dispatch => ({
|
2017-07-17 13:06:04 +07:00
|
|
|
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
|
2017-08-24 17:12:23 -04:00
|
|
|
fetchClaimCount: uri => dispatch(doFetchClaimCountByChannel(uri)),
|
2017-07-17 13:06:04 +07:00
|
|
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
2017-06-05 21:21:55 -07:00
|
|
|
});
|
2017-05-03 23:44:08 -04:00
|
|
|
|
2017-09-07 23:15:05 -04:00
|
|
|
export default connect(select, perform)(ChannelPage);
|