lbry-desktop/ui/page/livestreamSetup/index.js

35 lines
1.3 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
2021-04-23 05:04:11 +02:00
import { selectMyChannelClaims, selectFetchingMyChannels, doClearPublish } from 'lbry-redux';
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';
import LivestreamSetupPage from './view';
2021-04-14 17:56:45 +02:00
import { push } from 'connected-react-router';
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);