lbry-desktop/ui/page/channels/index.js
zeppi ee9f63a161 integrate all the things
bugfix

wip

flow

fix

cleaning

clean
2021-10-15 23:49:41 -04:00

37 lines
1.1 KiB
JavaScript

import { connect } from 'react-redux';
import {
selectMyChannelClaims,
selectMyChannelUrls,
selectFetchingMyChannels,
makeSelectClaimIsPending,
} from 'redux/selectors/claims';
import { doFetchChannelListMine } from 'redux/actions/claims';
import { doSetActiveChannel } from 'redux/actions/app';
import { selectYoutubeChannels } from 'redux/selectors/user';
import ChannelsPage from './view';
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,
};
};
const perform = (dispatch) => ({
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
doSetActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
});
export default connect(select, perform)(ChannelsPage);