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';
|
2022-03-15 17:18:08 +01:00
|
|
|
import { doSetPrimaryUri } from 'redux/actions/content';
|
2021-03-15 15:32:51 +01:00
|
|
|
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';
|
2022-03-16 12:35:58 +01:00
|
|
|
import { doCommentSocketConnect } from 'redux/actions/websocket';
|
2021-12-09 10:23:23 +01:00
|
|
|
import { getChannelIdFromClaim } from 'util/claim';
|
2022-03-15 17:28:55 +01:00
|
|
|
import {
|
|
|
|
selectActiveLivestreamForChannel,
|
|
|
|
selectActiveLivestreamInitialized,
|
|
|
|
selectCommentSocketConnected,
|
|
|
|
} from 'redux/selectors/livestream';
|
2022-03-16 12:35:58 +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;
|
2022-03-16 12:57:24 +01:00
|
|
|
|
|
|
|
const claim = selectClaimForUri(state, uri);
|
|
|
|
const { canonical_url } = claim || {};
|
|
|
|
const channelClaimId = getChannelIdFromClaim(claim);
|
2022-01-14 21:24:16 +01:00
|
|
|
|
2021-12-22 17:12:44 +01:00
|
|
|
return {
|
2022-03-16 12:57:24 +01:00
|
|
|
uri: canonical_url || '',
|
2021-12-22 17:12:44 +01:00
|
|
|
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),
|
2022-03-15 17:28:55 +01:00
|
|
|
socketConnected: selectCommentSocketConnected(state),
|
2021-12-22 17:12:44 +01:00
|
|
|
};
|
|
|
|
};
|
2021-03-02 03:07:10 +01:00
|
|
|
|
2021-12-16 22:59:13 +01:00
|
|
|
const perform = {
|
2022-03-15 17:18:08 +01:00
|
|
|
doSetPrimaryUri,
|
2021-03-15 15:32:51 +01:00
|
|
|
doUserSetReferrer,
|
2021-12-16 22:59:13 +01:00
|
|
|
doCommentSocketConnect,
|
2022-01-06 18:49:49 +01:00
|
|
|
doFetchChannelLiveStatus,
|
2021-12-16 22:59:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(select, perform)(LivestreamPage);
|