2019-05-07 04:35:04 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doFetchClaimsByChannel } from 'redux/actions/content';
|
|
|
|
import { PAGE_SIZE } from 'constants/claim';
|
|
|
|
import {
|
2019-07-22 02:13:42 +02:00
|
|
|
makeSelectClaimsInChannelForPage,
|
2019-05-07 04:35:04 +02:00
|
|
|
makeSelectFetchingChannelClaims,
|
|
|
|
makeSelectClaimIsMine,
|
|
|
|
makeSelectTotalPagesForChannel,
|
2019-07-08 22:54:58 +02:00
|
|
|
selectChannelIsBlocked,
|
2019-05-07 04:35:04 +02:00
|
|
|
} from 'lbry-redux';
|
2019-07-22 02:13:42 +02:00
|
|
|
import { withRouter } from 'react-router';
|
2019-05-07 04:35:04 +02:00
|
|
|
import ChannelPage from './view';
|
|
|
|
|
2019-07-22 02:13:42 +02:00
|
|
|
const select = (state, props) => {
|
|
|
|
const { search } = props.location;
|
|
|
|
const urlParams = new URLSearchParams(search);
|
|
|
|
const page = urlParams.get('page') || 0;
|
|
|
|
return {
|
|
|
|
claimsInChannel: makeSelectClaimsInChannelForPage(props.uri, page)(state),
|
|
|
|
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
|
|
|
|
totalPages: makeSelectTotalPagesForChannel(props.uri, PAGE_SIZE)(state),
|
|
|
|
channelIsMine: makeSelectClaimIsMine(props.uri)(state),
|
2019-07-08 22:54:58 +02:00
|
|
|
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
2019-07-22 02:13:42 +02:00
|
|
|
};
|
|
|
|
};
|
2019-05-07 04:35:04 +02:00
|
|
|
|
|
|
|
const perform = dispatch => ({
|
|
|
|
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
|
|
|
|
});
|
|
|
|
|
2019-07-22 02:13:42 +02:00
|
|
|
export default withRouter(
|
|
|
|
connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(ChannelPage)
|
|
|
|
);
|