2020-03-18 18:11:37 +01:00
|
|
|
import { connect } from 'react-redux';
|
2022-03-09 19:05:37 +01:00
|
|
|
import { selectMyChannelClaims, selectClaimsByUri, selectOdyseeMembershipForUri } from 'redux/selectors/claims';
|
2021-02-09 17:05:56 +01:00
|
|
|
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
|
|
|
import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
2022-03-09 19:05:37 +01:00
|
|
|
import { doFetchUserMemberships } from 'redux/actions/user';
|
2022-04-26 15:28:37 +02:00
|
|
|
import { doSetClientSetting } from 'redux/actions/settings';
|
2022-05-05 14:23:31 +02:00
|
|
|
import { selectDefaultChannelClaim } from 'redux/selectors/settings';
|
2021-07-06 03:29:46 +02:00
|
|
|
import ChannelSelector from './view';
|
2020-03-18 18:11:37 +01:00
|
|
|
|
2022-03-09 19:05:37 +01:00
|
|
|
const select = (state, props) => {
|
2022-05-05 14:23:31 +02:00
|
|
|
const { storeSelection } = props;
|
2022-03-09 19:05:37 +01:00
|
|
|
const activeChannelClaim = selectActiveChannelClaim(state);
|
2022-05-05 14:23:31 +02:00
|
|
|
const defaultChannelClaim = selectDefaultChannelClaim(state);
|
2022-03-09 19:05:37 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
channels: selectMyChannelClaims(state),
|
2022-05-05 14:23:31 +02:00
|
|
|
activeChannelClaim: storeSelection ? defaultChannelClaim : activeChannelClaim,
|
2022-03-09 19:05:37 +01:00
|
|
|
incognito: selectIncognito(state),
|
|
|
|
odyseeMembershipByUri: (uri) => selectOdyseeMembershipForUri(state, uri),
|
|
|
|
claimsByUri: selectClaimsByUri(state),
|
|
|
|
};
|
|
|
|
};
|
2020-03-18 18:11:37 +01:00
|
|
|
|
2022-04-26 15:28:37 +02:00
|
|
|
const perform = {
|
2021-02-09 17:05:56 +01:00
|
|
|
doSetActiveChannel,
|
|
|
|
doSetIncognito,
|
2022-03-09 19:05:37 +01:00
|
|
|
doFetchUserMemberships,
|
2022-04-26 15:28:37 +02:00
|
|
|
doSetClientSetting,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(select, perform)(ChannelSelector);
|