2019-05-07 04:35:04 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
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,
|
2019-11-22 02:37:25 +01:00
|
|
|
makeSelectTotalPagesInChannelSearch,
|
2019-12-13 23:32:20 +01:00
|
|
|
makeSelectClaimForUri,
|
2020-07-10 23:04:36 +02:00
|
|
|
SETTINGS,
|
2019-05-07 04:35:04 +02:00
|
|
|
} from 'lbry-redux';
|
2020-07-15 15:50:08 +02:00
|
|
|
import { selectChannelIsBlocked } from 'redux/selectors/blocked';
|
2019-07-22 02:13:42 +02:00
|
|
|
import { withRouter } from 'react-router';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
2020-06-18 17:10:46 +02:00
|
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
|
|
|
|
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 {
|
2019-11-22 02:37:25 +01:00
|
|
|
pageOfClaimsInChannel: makeSelectClaimsInChannelForPage(props.uri, page)(state),
|
2019-07-22 02:13:42 +02:00
|
|
|
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
|
2019-11-22 02:37:25 +01:00
|
|
|
totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state),
|
2019-07-22 02:13:42 +02:00
|
|
|
channelIsMine: makeSelectClaimIsMine(props.uri)(state),
|
2019-07-08 22:54:58 +02:00
|
|
|
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
2019-12-13 23:32:20 +01:00
|
|
|
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
2020-03-26 22:47:07 +01:00
|
|
|
isAuthenticated: selectUserVerifiedEmail(state),
|
2020-06-18 17:10:46 +02:00
|
|
|
showMature: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
|
2019-07-22 02:13:42 +02:00
|
|
|
};
|
|
|
|
};
|
2019-05-07 04:35:04 +02:00
|
|
|
|
2020-04-22 00:09:02 +02:00
|
|
|
export default withRouter(connect(select)(ChannelPage));
|