lbry-desktop/ui/component/livestreamComments/index.js
infinite-persistence 12eeb06c40 LivestreamComment: pass Comment prop instead of individual values
The number of props to pass is getting out hand, so just pass the Comment object directly.

Also, moved the "is my comment" check into LivestreamComment, so we don't need to pass it as a prop from the parent.
2021-12-30 11:55:44 -05:00

29 lines
1 KiB
JavaScript

import { connect } from 'react-redux';
import { MAX_LIVESTREAM_COMMENTS } from 'constants/livestream';
import { doResolveUris } from 'redux/actions/claims';
import { selectClaimForUri } from 'redux/selectors/claims';
import { doCommentList, doSuperChatList } from 'redux/actions/comments';
import {
selectTopLevelCommentsForUri,
selectIsFetchingComments,
selectSuperChatsForUri,
selectSuperChatTotalAmountForUri,
selectPinnedCommentsForUri,
} from 'redux/selectors/comments';
import LivestreamComments from './view';
const select = (state, props) => ({
claim: selectClaimForUri(state, props.uri),
comments: selectTopLevelCommentsForUri(state, props.uri, MAX_LIVESTREAM_COMMENTS),
pinnedComments: selectPinnedCommentsForUri(state, props.uri),
fetchingComments: selectIsFetchingComments(state),
superChats: selectSuperChatsForUri(state, props.uri),
superChatsTotalAmount: selectSuperChatTotalAmountForUri(state, props.uri),
});
export default connect(select, {
doCommentList,
doSuperChatList,
doResolveUris,
})(LivestreamComments);