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

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-06-06 23:19:12 +02:00
import React from "react";
import { connect } from "react-redux";
import { doFetchClaimsByChannel } 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-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";
const makeSelect = () => {
const selectClaim = makeSelectClaimForUri(),
2017-07-17 08:06:04 +02:00
selectClaimsInChannel = makeSelectClaimsInChannelForCurrentPage(),
selectFetchingChannelClaims = makeSelectFetchingChannelClaims(),
selectTotalPagesForChannel = makeSelectTotalPagesForChannel();
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-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)),
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);