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