Revert "skip rewards validation on future sign ins if user clicks 'skip' button"
This reverts commit 8a73cdbc0b
.
This commit is contained in:
parent
02a3a02947
commit
80f24edcb3
3 changed files with 11 additions and 20 deletions
|
@ -62,7 +62,6 @@ function UserSignIn(props: Props) {
|
|||
const shouldRedirectImmediately = urlParams.get('immediate');
|
||||
const [initialSignInStep, setInitialSignInStep] = React.useState();
|
||||
const [hasSeenFollowList, setHasSeenFollowList] = usePersistedState('channel-follow-intro', false);
|
||||
const [hasSkippedRewards, setHasSkippedRewards] = usePersistedState('skip-rewards-intro', false);
|
||||
const hasVerifiedEmail = user && user.has_verified_email;
|
||||
const rewardsApproved = user && user.is_reward_approved;
|
||||
const isIdentityVerified = user && user.is_identity_verified;
|
||||
|
@ -82,7 +81,7 @@ function UserSignIn(props: Props) {
|
|||
// The possible screens for the sign in flow
|
||||
const showEmail = !emailToVerify && !hasVerifiedEmail;
|
||||
const showEmailVerification = emailToVerify && !hasVerifiedEmail;
|
||||
const showUserVerification = hasVerifiedEmail && !rewardsApproved && !isIdentityVerified && !hasSkippedRewards;
|
||||
const showUserVerification = hasVerifiedEmail && !rewardsApproved && !isIdentityVerified;
|
||||
const showSyncPassword = syncEnabled && getSyncError;
|
||||
const showChannelCreation =
|
||||
hasVerifiedEmail &&
|
||||
|
@ -120,7 +119,7 @@ function UserSignIn(props: Props) {
|
|||
const SIGN_IN_FLOW = [
|
||||
showEmail && <UserEmailNew />,
|
||||
showEmailVerification && <UserEmailVerify />,
|
||||
showUserVerification && <UserVerify skipLink={redirect} onSkip={() => setHasSkippedRewards(true)} />,
|
||||
showUserVerification && <UserVerify skipLink={redirect} />,
|
||||
showChannelCreation && <UserFirstChannel />,
|
||||
showFollowIntro && (
|
||||
<UserChannelFollowIntro
|
||||
|
|
|
@ -14,7 +14,6 @@ type Props = {
|
|||
verifyPhone: () => void,
|
||||
fetchUser: () => void,
|
||||
skipLink?: string,
|
||||
onSkip: () => void,
|
||||
};
|
||||
|
||||
class UserVerify extends React.PureComponent<Props> {
|
||||
|
@ -29,12 +28,7 @@ class UserVerify extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { errorMessage, isPending, verifyPhone, fetchUser, skipLink, onSkip } = this.props;
|
||||
const skipButtonProps = {
|
||||
onClick: onSkip,
|
||||
navigate: skipLink || '/',
|
||||
};
|
||||
|
||||
const { errorMessage, isPending, verifyPhone, fetchUser, skipLink } = this.props;
|
||||
return (
|
||||
<React.Fragment>
|
||||
<section className="section__header">
|
||||
|
@ -51,7 +45,7 @@ class UserVerify extends React.PureComponent<Props> {
|
|||
to be validated.
|
||||
</I18nMessage>{' '}
|
||||
<Button onClick={() => fetchUser()} button="link" label={__('Refresh')} /> {'or'}{' '}
|
||||
<Button {...skipButtonProps} button="link" label={__('Skip')} />.
|
||||
<Button navigate={skipLink || '/'} button="link" label={__('Skip')} />.
|
||||
</p>
|
||||
<p>{__('This step is not required to use LBRY, and not all users or regions may qualify.')}</p>
|
||||
</section>
|
||||
|
@ -138,7 +132,7 @@ class UserVerify extends React.PureComponent<Props> {
|
|||
subtitle={__('Rewards validation is optional.')}
|
||||
actions={
|
||||
<Fragment>
|
||||
<Button {...skipButtonProps} button="primary" label={__('Continue Without Rewards')} />
|
||||
<Button navigate={skipLink || '/'} button="primary" label={__('Continue Without Rewards')} />
|
||||
</Fragment>
|
||||
}
|
||||
/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
export default function usePersistedState(key, firstTimeDefault) {
|
||||
// If no key is passed in, act as a normal `useState`
|
||||
|
@ -32,13 +32,11 @@ export default function usePersistedState(key, firstTimeDefault) {
|
|||
|
||||
const [value, setValue] = useState(defaultValue);
|
||||
|
||||
function setValueAndLocalStorage(newValue) {
|
||||
if (key && localStorageAvailable && value !== newValue) {
|
||||
localStorage.setItem(key, typeof newValue === 'object' ? JSON.stringify(newValue) : newValue);
|
||||
useEffect(() => {
|
||||
if (key && localStorageAvailable) {
|
||||
localStorage.setItem(key, typeof value === 'object' ? JSON.stringify(value) : value);
|
||||
}
|
||||
}, [key, value]);
|
||||
|
||||
setValue(newValue);
|
||||
}
|
||||
|
||||
return [value, setValueAndLocalStorage];
|
||||
return [value, setValue];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue