2021-03-15 15:32:51 +01:00
|
|
|
import { connect } from 'react-redux';
|
2021-11-08 07:27:14 +01:00
|
|
|
import { selectHasChannels, selectFetchingMyChannels } from 'redux/selectors/claims';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { doClearPublish } from 'redux/actions/publish';
|
2022-03-31 07:06:30 +02:00
|
|
|
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
2021-04-23 05:04:11 +02:00
|
|
|
import { doFetchNoSourceClaims } from 'redux/actions/livestream';
|
2022-03-31 07:06:30 +02:00
|
|
|
import { selectUser } from 'redux/selectors/user';
|
2021-04-23 05:04:11 +02:00
|
|
|
import {
|
|
|
|
makeSelectPendingLivestreamsForChannelId,
|
|
|
|
makeSelectLivestreamsForChannelId,
|
|
|
|
makeSelectIsFetchingLivestreams,
|
|
|
|
} from 'redux/selectors/livestream';
|
2022-07-11 16:12:37 +02:00
|
|
|
import { selectBalance } from 'redux/selectors/wallet';
|
|
|
|
import { selectPublishFormValues } from 'redux/selectors/publish';
|
2021-03-15 15:32:51 +01:00
|
|
|
import LivestreamSetupPage from './view';
|
|
|
|
|
2021-04-23 05:04:11 +02:00
|
|
|
const select = (state) => {
|
|
|
|
const activeChannelClaim = selectActiveChannelClaim(state);
|
|
|
|
const { claim_id: channelId, name: channelName } = activeChannelClaim || {};
|
|
|
|
return {
|
2022-07-11 16:12:37 +02:00
|
|
|
...selectPublishFormValues(state),
|
2021-04-23 05:04:11 +02:00
|
|
|
channelName,
|
|
|
|
channelId,
|
2021-11-08 07:27:14 +01:00
|
|
|
hasChannels: selectHasChannels(state),
|
2021-04-23 05:04:11 +02:00
|
|
|
fetchingChannels: selectFetchingMyChannels(state),
|
|
|
|
activeChannelClaim,
|
|
|
|
myLivestreamClaims: makeSelectLivestreamsForChannelId(channelId)(state),
|
|
|
|
pendingClaims: makeSelectPendingLivestreamsForChannelId(channelId)(state),
|
|
|
|
fetchingLivestreams: makeSelectIsFetchingLivestreams(channelId)(state),
|
2022-03-09 19:05:37 +01:00
|
|
|
user: selectUser(state),
|
2022-07-11 16:12:37 +02:00
|
|
|
balance: selectBalance(state),
|
2021-04-23 05:04:11 +02:00
|
|
|
};
|
|
|
|
};
|
2021-04-14 17:56:45 +02:00
|
|
|
const perform = (dispatch) => ({
|
2022-07-11 16:12:37 +02:00
|
|
|
clearPublish: () => dispatch(doClearPublish()),
|
2021-04-14 17:56:45 +02:00
|
|
|
doNewLivestream: (path) => {
|
|
|
|
dispatch(doClearPublish());
|
|
|
|
},
|
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);
|