2022-01-14 21:24:16 +01:00
|
|
|
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,
|
|
|
|
selectSuperChatsForUri,
|
|
|
|
selectPinnedCommentsForUri,
|
|
|
|
} from 'redux/selectors/comments';
|
2022-02-02 13:48:24 +01:00
|
|
|
import { selectThemePath } from 'redux/selectors/settings';
|
2022-01-14 21:24:16 +01:00
|
|
|
import LivestreamChatLayout from './view';
|
|
|
|
|
|
|
|
const select = (state, props) => {
|
|
|
|
const { uri } = props;
|
2022-02-14 20:28:25 +01:00
|
|
|
const claim = selectClaimForUri(state, uri);
|
2022-01-14 21:24:16 +01:00
|
|
|
|
|
|
|
return {
|
2022-02-14 20:28:25 +01:00
|
|
|
claimId: claim && claim.claim_id,
|
2022-01-14 21:24:16 +01:00
|
|
|
comments: selectTopLevelCommentsForUri(state, uri, MAX_LIVESTREAM_COMMENTS),
|
|
|
|
pinnedComments: selectPinnedCommentsForUri(state, uri),
|
|
|
|
superChats: selectSuperChatsForUri(state, uri),
|
2022-02-02 13:48:24 +01:00
|
|
|
theme: selectThemePath(state),
|
2022-01-14 21:24:16 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-02-14 20:28:25 +01:00
|
|
|
const perform = {
|
2022-01-14 21:24:16 +01:00
|
|
|
doCommentList,
|
|
|
|
doSuperChatList,
|
|
|
|
doResolveUris,
|
2022-02-14 20:28:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(select, perform)(LivestreamChatLayout);
|