2019-09-26 18:28:08 +02:00
|
|
|
import { connect } from 'react-redux';
|
2021-11-08 07:27:14 +01:00
|
|
|
import { selectMyChannelUrls, selectFetchingMyChannels, makeSelectClaimIsPending } from 'redux/selectors/claims';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { doFetchChannelListMine } from 'redux/actions/claims';
|
2021-06-18 18:02:36 +02:00
|
|
|
import { doSetActiveChannel } from 'redux/actions/app';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { selectYoutubeChannels } from 'redux/selectors/user';
|
2019-09-26 18:28:08 +02:00
|
|
|
import ChannelsPage from './view';
|
|
|
|
|
2021-08-26 16:51:53 +02:00
|
|
|
const select = (state) => {
|
|
|
|
const channelUrls = selectMyChannelUrls(state);
|
|
|
|
let pendingChannels = [];
|
|
|
|
if (channelUrls) {
|
|
|
|
channelUrls.map((channelUrl) => {
|
|
|
|
const isPendingUrl = makeSelectClaimIsPending(channelUrl)(state);
|
|
|
|
if (isPendingUrl) pendingChannels.push(channelUrl);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
channelUrls,
|
|
|
|
fetchingChannels: selectFetchingMyChannels(state),
|
|
|
|
youtubeChannels: selectYoutubeChannels(state),
|
|
|
|
pendingChannels,
|
|
|
|
};
|
|
|
|
};
|
2019-09-26 18:28:08 +02:00
|
|
|
|
2021-06-18 18:02:36 +02:00
|
|
|
const perform = (dispatch) => ({
|
2019-09-26 18:28:08 +02:00
|
|
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
2021-06-18 18:02:36 +02:00
|
|
|
doSetActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
|
2019-09-26 18:28:08 +02:00
|
|
|
});
|
|
|
|
|
2020-06-15 22:33:03 +02:00
|
|
|
export default connect(select, perform)(ChannelsPage);
|