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

30 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-05-17 14:21:07 -04:00
import { connect } from 'react-redux';
import { makeSelectClaimIsMine, selectFetchingMyChannels, selectMyChannelClaims } from 'lbry-redux';
2020-09-30 14:46:17 -04:00
import {
makeSelectTopLevelCommentsForUri,
selectIsFetchingComments,
makeSelectTotalCommentsCountForUri,
selectOthersReactsById,
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';
2019-05-17 14:21:07 -04:00
import CommentsList from './view';
2020-08-24 13:35:21 -04:00
import { selectUserVerifiedEmail } from 'redux/selectors/user';
2019-05-17 14:21:07 -04:00
const select = (state, props) => ({
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),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
isFetchingComments: selectIsFetchingComments(state),
2020-08-24 13:35:21 -04:00
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
fetchingChannels: selectFetchingMyChannels(state),
reactionsById: selectOthersReactsById(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
export default connect(select, perform)(CommentsList);