2019-09-26 18:28:08 +02:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2019-08-27 16:43:42 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
|
|
|
selectEmailToVerify,
|
|
|
|
selectUser,
|
|
|
|
selectAccessToken,
|
2019-09-26 18:07:11 +02:00
|
|
|
makeSelectIsRewardClaimPending,
|
|
|
|
selectClaimedRewards,
|
|
|
|
rewards as REWARD_TYPES,
|
|
|
|
doClaimRewardType,
|
2019-09-26 18:28:08 +02:00
|
|
|
doUserFetch,
|
|
|
|
selectUserIsPending,
|
|
|
|
selectYoutubeChannels,
|
|
|
|
selectGetSyncIsPending,
|
|
|
|
selectGetSyncErrorMessage,
|
|
|
|
selectSyncHash,
|
2019-08-27 16:43:42 +02:00
|
|
|
} from 'lbryinc';
|
2019-09-26 18:07:11 +02:00
|
|
|
import { selectMyChannelClaims, selectBalance, selectFetchingMyChannels } from 'lbry-redux';
|
2019-09-26 18:28:08 +02:00
|
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
2019-09-26 18:07:11 +02:00
|
|
|
import UserSignIn from './view';
|
2019-08-27 16:43:42 +02:00
|
|
|
|
|
|
|
const select = state => ({
|
2019-09-26 18:28:08 +02:00
|
|
|
emailToVerify: selectEmailToVerify(state),
|
2019-08-27 16:43:42 +02:00
|
|
|
user: selectUser(state),
|
|
|
|
accessToken: selectAccessToken(state),
|
2019-09-26 18:07:11 +02:00
|
|
|
channels: selectMyChannelClaims(state),
|
|
|
|
claimedRewards: selectClaimedRewards(state),
|
|
|
|
claimingReward: makeSelectIsRewardClaimPending()(state, {
|
|
|
|
reward_type: REWARD_TYPES.TYPE_CONFIRM_EMAIL,
|
|
|
|
}),
|
|
|
|
balance: selectBalance(state),
|
|
|
|
fetchingChannels: selectFetchingMyChannels(state),
|
2019-09-26 18:28:08 +02:00
|
|
|
youtubeChannels: selectYoutubeChannels(state),
|
|
|
|
userFetchPending: selectUserIsPending(state),
|
|
|
|
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
2019-09-27 20:56:15 +02:00
|
|
|
syncingWallet: selectGetSyncIsPending(state),
|
2019-09-26 18:28:08 +02:00
|
|
|
getSyncError: selectGetSyncErrorMessage(state),
|
2019-09-27 20:56:15 +02:00
|
|
|
hasSynced: Boolean(selectSyncHash(state)),
|
2019-08-27 16:43:42 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
2019-09-26 18:28:08 +02:00
|
|
|
fetchUser: () => dispatch(doUserFetch()),
|
2019-09-26 18:07:11 +02:00
|
|
|
claimReward: () =>
|
|
|
|
dispatch(
|
|
|
|
doClaimRewardType(REWARD_TYPES.TYPE_CONFIRM_EMAIL, {
|
|
|
|
notifyError: false,
|
|
|
|
})
|
|
|
|
),
|
2019-08-27 16:43:42 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
2019-09-26 18:07:11 +02:00
|
|
|
)(UserSignIn);
|