2021-03-15 15:32:51 +01:00
|
|
|
import { connect } from 'react-redux';
|
2021-10-08 05:47:39 +02:00
|
|
|
import { selectMyChannelClaims, selectFetchingMyChannels } from 'redux/selectors/claims';
|
|
|
|
import { doClearPublish } from 'redux/actions/publish';
|
2021-03-15 15:32:51 +01:00
|
|
|
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
2021-04-23 05:04:11 +02:00
|
|
|
import { doFetchNoSourceClaims } from 'redux/actions/livestream';
|
|
|
|
import {
|
|
|
|
makeSelectPendingLivestreamsForChannelId,
|
|
|
|
makeSelectLivestreamsForChannelId,
|
|
|
|
makeSelectIsFetchingLivestreams,
|
|
|
|
} from 'redux/selectors/livestream';
|
2021-03-15 15:32:51 +01:00
|
|
|
import LivestreamSetupPage from './view';
|
2021-04-14 17:56:45 +02:00
|
|
|
import { push } from 'connected-react-router';
|
2021-03-15 15:32:51 +01:00
|
|
|
|
2021-04-23 05:04:11 +02:00
|
|
|
const select = (state) => {
|
|
|
|
const activeChannelClaim = selectActiveChannelClaim(state);
|
|
|
|
const { claim_id: channelId, name: channelName } = activeChannelClaim || {};
|
|
|
|
return {
|
|
|
|
channelName,
|
|
|
|
channelId,
|
|
|
|
channels: selectMyChannelClaims(state),
|
|
|
|
fetchingChannels: selectFetchingMyChannels(state),
|
|
|
|
activeChannelClaim,
|
|
|
|
myLivestreamClaims: makeSelectLivestreamsForChannelId(channelId)(state),
|
|
|
|
pendingClaims: makeSelectPendingLivestreamsForChannelId(channelId)(state),
|
|
|
|
fetchingLivestreams: makeSelectIsFetchingLivestreams(channelId)(state),
|
|
|
|
};
|
|
|
|
};
|
2021-04-14 17:56:45 +02:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
doNewLivestream: (path) => {
|
|
|
|
dispatch(doClearPublish());
|
|
|
|
dispatch(push(path));
|
|
|
|
},
|
2021-04-23 05:04:11 +02:00
|
|
|
fetchNoSourceClaims: (id) => dispatch(doFetchNoSourceClaims(id)),
|
2021-04-14 17:56:45 +02:00
|
|
|
});
|
|
|
|
export default connect(select, perform)(LivestreamSetupPage);
|