2017-06-06 23:19:12 +02:00
|
|
|
import React from "react";
|
|
|
|
import { connect } from "react-redux";
|
2017-08-24 23:12:23 +02:00
|
|
|
import {
|
|
|
|
doFetchClaimsByChannel,
|
|
|
|
doFetchClaimCountByChannel,
|
|
|
|
} from "actions/content";
|
2017-05-13 00:50:51 +02:00
|
|
|
import {
|
2017-05-19 01:14:26 +02:00
|
|
|
makeSelectClaimForUri,
|
2017-07-17 08:06:04 +02:00
|
|
|
makeSelectClaimsInChannelForCurrentPage,
|
|
|
|
makeSelectFetchingChannelClaims,
|
2017-06-06 23:19:12 +02:00
|
|
|
} from "selectors/claims";
|
2017-07-17 08:06:04 +02:00
|
|
|
import { selectCurrentParams } from "selectors/app";
|
|
|
|
import { doNavigate } from "actions/app";
|
|
|
|
import { makeSelectTotalPagesForChannel } from "selectors/content";
|
2017-06-06 23:19:12 +02:00
|
|
|
import ChannelPage from "./view";
|
2017-05-19 01:14:26 +02:00
|
|
|
|
|
|
|
const makeSelect = () => {
|
|
|
|
const selectClaim = makeSelectClaimForUri(),
|
2017-07-17 08:06:04 +02:00
|
|
|
selectClaimsInChannel = makeSelectClaimsInChannelForCurrentPage(),
|
|
|
|
selectFetchingChannelClaims = makeSelectFetchingChannelClaims(),
|
|
|
|
selectTotalPagesForChannel = makeSelectTotalPagesForChannel();
|
2017-05-19 01:14:26 +02:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
claim: selectClaim(state, props),
|
2017-06-06 23:19:12 +02:00
|
|
|
claimsInChannel: selectClaimsInChannel(state, props),
|
2017-07-17 08:06:04 +02:00
|
|
|
fetching: selectFetchingChannelClaims(state, props),
|
|
|
|
totalPages: selectTotalPagesForChannel(state, props),
|
|
|
|
params: selectCurrentParams(state),
|
2017-06-06 23:19:12 +02:00
|
|
|
});
|
2017-05-19 01:14:26 +02:00
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
return select;
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2017-05-04 05:44:08 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2017-07-17 08:06:04 +02:00
|
|
|
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
|
2017-08-24 23:12:23 +02:00
|
|
|
fetchClaimCount: uri => dispatch(doFetchClaimCountByChannel(uri)),
|
2017-07-17 08:06:04 +02:00
|
|
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-05-04 05:44:08 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export default connect(makeSelect, perform)(ChannelPage);
|