lbry-desktop/ui/component/channelSelector/index.js

31 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-03-18 18:11:37 +01:00
import { connect } from 'react-redux';
import { selectMyChannelClaims, selectClaimsByUri } from 'redux/selectors/claims';
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
import { doFetchUserMemberships } from 'redux/actions/user';
import { doSetDefaultChannel } from 'redux/actions/settings';
import { selectDefaultChannelClaim } from 'redux/selectors/settings';
import ChannelSelector from './view';
2020-03-18 18:11:37 +01:00
const select = (state, props) => {
const { storeSelection } = props;
const activeChannelClaim = selectActiveChannelClaim(state);
const defaultChannelClaim = selectDefaultChannelClaim(state);
return {
channels: selectMyChannelClaims(state),
activeChannelClaim: storeSelection ? defaultChannelClaim : activeChannelClaim,
incognito: selectIncognito(state),
claimsByUri: selectClaimsByUri(state),
};
};
2020-03-18 18:11:37 +01:00
const perform = {
doSetActiveChannel,
doSetIncognito,
doFetchUserMemberships,
doSetDefaultChannel,
};
export default connect(select, perform)(ChannelSelector);