2021-10-01 14:10:27 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doCommentListOwn, doCommentReset } from 'redux/actions/comments';
|
|
|
|
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
|
|
|
import {
|
|
|
|
selectIsFetchingComments,
|
2021-10-11 08:02:17 +02:00
|
|
|
selectCommentsForUri,
|
2022-03-11 05:11:01 +01:00
|
|
|
selectTotalCommentsCountForUri,
|
2021-10-01 14:10:27 +02:00
|
|
|
makeSelectTopLevelTotalPagesForUri,
|
|
|
|
} from 'redux/selectors/comments';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { selectClaimsById } from 'redux/selectors/claims';
|
2021-10-01 14:10:27 +02:00
|
|
|
|
|
|
|
import OwnComments from './view';
|
|
|
|
|
|
|
|
const select = (state) => {
|
|
|
|
const activeChannelClaim = selectActiveChannelClaim(state);
|
|
|
|
const uri = activeChannelClaim && activeChannelClaim.canonical_url;
|
|
|
|
|
|
|
|
return {
|
|
|
|
activeChannelClaim,
|
2021-10-11 08:02:17 +02:00
|
|
|
allComments: selectCommentsForUri(state, uri),
|
2022-03-11 05:11:01 +01:00
|
|
|
totalComments: selectTotalCommentsCountForUri(state, uri),
|
2021-10-01 14:10:27 +02:00
|
|
|
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(uri)(state),
|
|
|
|
isFetchingComments: selectIsFetchingComments(state),
|
|
|
|
claimsById: selectClaimsById(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const perform = (dispatch) => ({
|
|
|
|
doCommentReset: (a) => dispatch(doCommentReset(a)),
|
|
|
|
doCommentListOwn: (a, b, c) => dispatch(doCommentListOwn(a, b, c)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(OwnComments);
|