remove extra sign up pages

This commit is contained in:
zeppi 2021-12-08 19:34:06 -05:00 committed by jessopb
parent 5e09de5f94
commit 6ba1fafaa0

View file

@ -6,18 +6,11 @@ import classnames from 'classnames';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import UserEmailNew from 'component/userEmailNew'; import UserEmailNew from 'component/userEmailNew';
import UserEmailVerify from 'component/userEmailVerify'; import UserEmailVerify from 'component/userEmailVerify';
import UserFirstChannel from 'component/userFirstChannel';
import UserChannelFollowIntro from 'component/userChannelFollowIntro'; import UserChannelFollowIntro from 'component/userChannelFollowIntro';
import UserTagFollowIntro from 'component/userTagFollowIntro'; import UserTagFollowIntro from 'component/userTagFollowIntro';
import YoutubeSync from 'page/youtubeSync';
import { DEFAULT_BID_FOR_FIRST_CHANNEL } from 'component/userFirstChannel/view';
import { YOUTUBE_STATUSES } from 'lbryinc';
import REWARDS from 'rewards'; import REWARDS from 'rewards';
import UserVerify from 'component/userVerify';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
import YoutubeTransferStatus from 'component/youtubeTransferStatus';
import useFetched from 'effects/use-fetched'; import useFetched from 'effects/use-fetched';
import Confetti from 'react-confetti';
import usePrevious from 'effects/use-previous'; import usePrevious from 'effects/use-previous';
import { SHOW_TAGS_INTRO } from 'config'; import { SHOW_TAGS_INTRO } from 'config';
@ -56,12 +49,10 @@ function UserSignUp(props: Props) {
user, user,
claimingReward, claimingReward,
claimedRewards, claimedRewards,
channels,
claimConfirmEmailReward, claimConfirmEmailReward,
claimNewUserReward, claimNewUserReward,
balance, balance,
fetchUser, fetchUser,
youtubeChannels,
syncEnabled, syncEnabled,
syncingWallet, syncingWallet,
hasSynced, hasSynced,
@ -85,21 +76,10 @@ function UserSignUp(props: Props) {
const shouldRedirectImmediately = urlParams.get(REDIRECT_IMMEDIATELY_PARAM); const shouldRedirectImmediately = urlParams.get(REDIRECT_IMMEDIATELY_PARAM);
const [initialSignInStep, setInitialSignInStep] = React.useState(); const [initialSignInStep, setInitialSignInStep] = React.useState();
const hasVerifiedEmail = user && user.has_verified_email; const hasVerifiedEmail = user && user.has_verified_email;
const rewardsApproved = user && user.is_reward_approved;
const isIdentityVerified = user && user.is_identity_verified;
const passwordSet = user && user.password_set; const passwordSet = user && user.password_set;
const hasFetchedReward = useFetched(claimingReward); const hasFetchedReward = useFetched(claimingReward);
const previousHasVerifiedEmail = usePrevious(hasVerifiedEmail); const previousHasVerifiedEmail = usePrevious(hasVerifiedEmail);
const channelCount = channels ? channels.length : 0;
const hasClaimedEmailAward = claimedRewards.some((reward) => reward.reward_type === REWARDS.TYPE_CONFIRM_EMAIL); const hasClaimedEmailAward = claimedRewards.some((reward) => reward.reward_type === REWARDS.TYPE_CONFIRM_EMAIL);
const hasYoutubeChannels = youtubeChannels && Boolean(youtubeChannels.length);
const isYoutubeTransferComplete =
hasYoutubeChannels &&
youtubeChannels.every(
(channel) =>
channel.transfer_state === YOUTUBE_STATUSES.COMPLETED_TRANSFER ||
channel.sync_status === YOUTUBE_STATUSES.YOUTUBE_SYNC_ABANDONDED
);
// Complexity warning // Complexity warning
// We can't just check if we are currently fetching something // We can't just check if we are currently fetching something
// We may want to keep a component rendered while something is being fetched, instead of replacing it with the large spinner // We may want to keep a component rendered while something is being fetched, instead of replacing it with the large spinner
@ -108,16 +88,6 @@ function UserSignUp(props: Props) {
// The possible screens for the sign in flow // The possible screens for the sign in flow
const showEmail = !hasVerifiedEmail; const showEmail = !hasVerifiedEmail;
const showEmailVerification = (emailToVerify && !hasVerifiedEmail) || (!hasVerifiedEmail && passwordSet); const showEmailVerification = (emailToVerify && !hasVerifiedEmail) || (!hasVerifiedEmail && passwordSet);
const showUserVerification = hasVerifiedEmail && !rewardsApproved && !isIdentityVerified && !rewardsAcknowledged;
const showChannelCreation =
hasVerifiedEmail &&
((balance !== undefined &&
balance !== null &&
balance > DEFAULT_BID_FOR_FIRST_CHANNEL &&
channelCount === 0 &&
!hasYoutubeChannels) ||
interestedInYoutubeSync);
const showYoutubeTransfer = hasVerifiedEmail && hasYoutubeChannels && !isYoutubeTransferComplete;
const showFollowIntro = step === 'channels' || (hasVerifiedEmail && !followingAcknowledged); const showFollowIntro = step === 'channels' || (hasVerifiedEmail && !followingAcknowledged);
const showTagsIntro = SHOW_TAGS_INTRO && (step === 'tags' || (hasVerifiedEmail && !tagsAcknowledged)); const showTagsIntro = SHOW_TAGS_INTRO && (step === 'tags' || (hasVerifiedEmail && !tagsAcknowledged));
const canHijackSignInFlowWithSpinner = hasVerifiedEmail && !showFollowIntro && !showTagsIntro && !rewardsAcknowledged; const canHijackSignInFlowWithSpinner = hasVerifiedEmail && !showFollowIntro && !showTagsIntro && !rewardsAcknowledged;
@ -170,19 +140,6 @@ function UserSignUp(props: Props) {
/> />
), ),
showEmailVerification && <UserEmailVerify />, showEmailVerification && <UserEmailVerify />,
showUserVerification && (
<UserVerify
onSkip={() => {
setSettingAndSync(SETTINGS.REWARDS_ACKNOWLEDGED, true);
}}
/>
),
showChannelCreation &&
(interestedInYoutubeSync ? (
<YoutubeSync inSignUpFlow doToggleInterestedInYoutubeSync={doToggleInterestedInYoutubeSync} />
) : (
<UserFirstChannel doToggleInterestedInYoutubeSync={doToggleInterestedInYoutubeSync} />
)),
showFollowIntro && ( showFollowIntro && (
<UserChannelFollowIntro <UserChannelFollowIntro
onContinue={() => { onContinue={() => {
@ -223,11 +180,6 @@ function UserSignUp(props: Props) {
}} }}
/> />
), ),
showYoutubeTransfer && (
<div>
<YoutubeTransferStatus /> <Confetti recycle={false} style={{ position: 'fixed' }} />
</div>
),
showLoadingSpinner && ( showLoadingSpinner && (
<div className="main--empty"> <div className="main--empty">
<Spinner /> <Spinner />