2021-03-02 03:07:10 +01:00
|
|
|
import { connect } from 'react-redux';
|
2021-12-09 10:23:23 +01:00
|
|
|
import { makeSelectTagInClaimOrChannelForUri, selectClaimForUri } from 'redux/selectors/claims';
|
2021-03-15 15:32:51 +01:00
|
|
|
import { doSetPlayingUri } from 'redux/actions/content';
|
|
|
|
import { doUserSetReferrer } from 'redux/actions/user';
|
|
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
2021-06-03 17:55:16 +02:00
|
|
|
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
2021-12-16 22:59:13 +01:00
|
|
|
import { doCommentSocketConnect, doCommentSocketDisconnect } from 'redux/actions/websocket';
|
2021-12-09 10:23:23 +01:00
|
|
|
import { getChannelIdFromClaim } from 'util/claim';
|
2021-12-22 17:12:44 +01:00
|
|
|
import { selectActiveLivestreamForChannel, selectActiveLivestreamInitialized } from 'redux/selectors/livestream';
|
2022-01-06 18:49:49 +01:00
|
|
|
import { doFetchChannelLiveStatus } from 'redux/actions/livestream';
|
2021-03-15 15:32:51 +01:00
|
|
|
import LivestreamPage from './view';
|
2021-03-02 03:07:10 +01:00
|
|
|
|
2021-12-22 17:12:44 +01:00
|
|
|
const select = (state, props) => {
|
2022-01-14 21:24:16 +01:00
|
|
|
const { uri } = props;
|
|
|
|
const channelClaimId = getChannelIdFromClaim(selectClaimForUri(state, uri));
|
|
|
|
|
2021-12-22 17:12:44 +01:00
|
|
|
return {
|
|
|
|
isAuthenticated: selectUserVerifiedEmail(state),
|
|
|
|
channelClaimId,
|
2022-01-14 21:24:16 +01:00
|
|
|
chatDisabled: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_COMMENTS_TAG)(state),
|
2021-12-22 17:12:44 +01:00
|
|
|
activeLivestreamForChannel: selectActiveLivestreamForChannel(state, channelClaimId),
|
|
|
|
activeLivestreamInitialized: selectActiveLivestreamInitialized(state),
|
|
|
|
};
|
|
|
|
};
|
2021-03-02 03:07:10 +01:00
|
|
|
|
2021-12-16 22:59:13 +01:00
|
|
|
const perform = {
|
2021-03-15 15:32:51 +01:00
|
|
|
doSetPlayingUri,
|
|
|
|
doUserSetReferrer,
|
2021-12-16 22:59:13 +01:00
|
|
|
doCommentSocketConnect,
|
|
|
|
doCommentSocketDisconnect,
|
2022-01-06 18:49:49 +01:00
|
|
|
doFetchChannelLiveStatus,
|
2021-12-16 22:59:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(select, perform)(LivestreamPage);
|