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

36 lines
1.2 KiB
JavaScript
Raw Normal View History

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 {
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";
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-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);