lbry-desktop/ui/component/channelContent/index.js

36 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-05-06 22:35:04 -04:00
import { connect } from 'react-redux';
import { PAGE_SIZE } from 'constants/claim';
import {
2019-07-21 20:13:42 -04:00
makeSelectClaimsInChannelForPage,
2019-05-06 22:35:04 -04:00
makeSelectFetchingChannelClaims,
makeSelectClaimIsMine,
makeSelectTotalPagesInChannelSearch,
makeSelectClaimForUri,
SETTINGS,
2019-05-06 22:35:04 -04:00
} from 'lbry-redux';
import { selectChannelIsBlocked } from 'redux/selectors/blocked';
2019-07-21 20:13:42 -04:00
import { withRouter } from 'react-router';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { makeSelectClientSetting } from 'redux/selectors/settings';
2019-05-06 22:35:04 -04:00
import ChannelPage from './view';
2019-07-21 20:13:42 -04:00
const select = (state, props) => {
const { search } = props.location;
const urlParams = new URLSearchParams(search);
const page = urlParams.get('page') || 0;
return {
pageOfClaimsInChannel: makeSelectClaimsInChannelForPage(props.uri, page)(state),
2019-07-21 20:13:42 -04:00
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state),
2019-07-21 20:13:42 -04:00
channelIsMine: makeSelectClaimIsMine(props.uri)(state),
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
2020-03-26 17:47:07 -04:00
isAuthenticated: selectUserVerifiedEmail(state),
showMature: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state),
2019-07-21 20:13:42 -04:00
};
};
2019-05-06 22:35:04 -04:00
2020-04-21 15:09:02 -07:00
export default withRouter(connect(select)(ChannelPage));