2019-05-17 14:21:07 -04:00
|
|
|
import { connect } from 'react-redux';
|
2020-10-02 17:17:12 -04:00
|
|
|
import { makeSelectClaimIsMine, selectFetchingMyChannels, selectMyChannelClaims } from 'lbry-redux';
|
2020-09-30 14:46:17 -04:00
|
|
|
import {
|
|
|
|
makeSelectTopLevelCommentsForUri,
|
|
|
|
selectIsFetchingComments,
|
|
|
|
makeSelectTotalCommentsCountForUri,
|
2020-10-06 15:35:13 -04:00
|
|
|
selectOthersReactsById,
|
2020-10-19 23:20:38 -04:00
|
|
|
selectCommentChannel,
|
2020-09-30 14:46:17 -04:00
|
|
|
} from 'redux/selectors/comments';
|
2020-09-29 10:10:23 -04:00
|
|
|
import { doCommentList, doCommentReactList } from 'redux/actions/comments';
|
2020-08-24 13:35:21 -04:00
|
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
2020-10-20 13:10:02 -04:00
|
|
|
import CommentsList from './view';
|
2019-05-17 14:21:07 -04:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
2020-01-29 20:02:21 -05:00
|
|
|
myChannels: selectMyChannelClaims(state),
|
2020-08-24 13:35:21 -04:00
|
|
|
comments: makeSelectTopLevelCommentsForUri(props.uri)(state),
|
2020-09-30 14:46:17 -04:00
|
|
|
totalComments: makeSelectTotalCommentsCountForUri(props.uri)(state),
|
2020-01-29 20:02:21 -05:00
|
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
2020-05-25 14:45:43 -04:00
|
|
|
isFetchingComments: selectIsFetchingComments(state),
|
2020-08-24 13:35:21 -04:00
|
|
|
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
2020-10-02 17:17:12 -04:00
|
|
|
fetchingChannels: selectFetchingMyChannels(state),
|
2020-10-06 15:35:13 -04:00
|
|
|
reactionsById: selectOthersReactsById(state),
|
2020-10-19 23:20:38 -04:00
|
|
|
activeChannel: selectCommentChannel(state),
|
2019-05-17 14:21:07 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
2019-06-26 19:59:27 -04:00
|
|
|
fetchComments: uri => dispatch(doCommentList(uri)),
|
2020-09-29 10:10:23 -04:00
|
|
|
fetchReacts: uri => dispatch(doCommentReactList(uri)),
|
2019-05-17 14:21:07 -04:00
|
|
|
});
|
2019-06-26 19:59:27 -04:00
|
|
|
|
2020-01-29 20:02:21 -05:00
|
|
|
export default connect(select, perform)(CommentsList);
|