2021-03-10 19:34:21 +01:00
|
|
|
import { connect } from 'react-redux';
|
2022-01-14 21:24:16 +01:00
|
|
|
import { selectClaimForUri, makeSelectTagInClaimOrChannelForUri, selectThumbnailForUri } from 'redux/selectors/claims';
|
2022-02-02 13:45:16 +01:00
|
|
|
import { selectSuperChatsForUri } from 'redux/selectors/comments';
|
2021-03-10 19:34:21 +01:00
|
|
|
import LivestreamLayout from './view';
|
2021-06-03 17:55:16 +02:00
|
|
|
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
2022-02-07 14:04:25 +01:00
|
|
|
import { selectViewersForId } from 'redux/selectors/livestream';
|
2021-03-10 19:34:21 +01:00
|
|
|
|
2022-01-14 21:24:16 +01:00
|
|
|
const select = (state, props) => {
|
|
|
|
const { uri } = props;
|
|
|
|
|
2022-02-07 14:04:25 +01:00
|
|
|
const claim = selectClaimForUri(state, uri);
|
|
|
|
const claimId = claim && claim.claim_id;
|
|
|
|
|
2022-01-14 21:24:16 +01:00
|
|
|
return {
|
2022-02-07 14:04:25 +01:00
|
|
|
claim,
|
2022-01-14 21:24:16 +01:00
|
|
|
thumbnail: selectThumbnailForUri(state, uri),
|
|
|
|
chatDisabled: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_COMMENTS_TAG)(state),
|
2022-02-02 13:45:16 +01:00
|
|
|
superChats: selectSuperChatsForUri(state, uri),
|
2022-02-07 14:04:25 +01:00
|
|
|
activeViewers: claimId && selectViewersForId(state, claimId),
|
2022-01-14 21:24:16 +01:00
|
|
|
};
|
|
|
|
};
|
2021-03-10 19:34:21 +01:00
|
|
|
|
|
|
|
export default connect(select)(LivestreamLayout);
|