lbry-desktop/ui/js/page/channel/index.js

36 lines
1.2 KiB
JavaScript
Raw Normal View History

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 {
makeSelectClaimForUri,
2017-07-17 08:06:04 +02:00
makeSelectClaimsInChannelForCurrentPage,
makeSelectFetchingChannelClaims,
2017-06-06 23:19:12 +02:00
} from "selectors/claims";
2017-09-20 19:12:53 +02:00
import {
makeSelectCurrentParam,
selectCurrentParams,
} from "selectors/navigation";
import { doNavigate } from "actions/navigation";
2017-07-17 08:06:04 +02:00
import { makeSelectTotalPagesForChannel } from "selectors/content";
2017-06-06 23:19:12 +02:00
import ChannelPage from "./view";
2017-09-08 05:15:05 +02:00
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
2017-09-20 19:12:53 +02:00
claimsInChannel: makeSelectClaimsInChannelForCurrentPage(props.uri)(state),
2017-09-08 05:15:05 +02:00
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
2017-09-20 19:12:53 +02:00
page: makeSelectCurrentParam("page")(state),
2017-09-08 05:15:05 +02:00
params: selectCurrentParams(state),
totalPages: makeSelectTotalPagesForChannel(props.uri)(state),
});
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-09-08 05:15:05 +02:00
export default connect(select, perform)(ChannelPage);