2019-09-26 18:28:08 +02:00
|
|
|
import { connect } from 'react-redux';
|
2020-06-21 18:51:06 +02:00
|
|
|
import {
|
|
|
|
selectMyChannelClaims,
|
|
|
|
selectMyChannelUrls,
|
|
|
|
selectFetchingMyChannels,
|
2021-08-26 16:51:53 +02:00
|
|
|
makeSelectClaimIsPending,
|
2021-10-08 05:47:39 +02:00
|
|
|
} from 'redux/selectors/claims';
|
|
|
|
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,
|
|
|
|
channels: selectMyChannelClaims(state),
|
|
|
|
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);
|