ensure we properly track if users want to skip the rewards intro

This commit is contained in:
seanyesmunt 2020-03-16 13:29:15 -04:00 committed by Sean Yesmunt
parent 292f547c59
commit 691e648f6a
4 changed files with 22 additions and 13 deletions

View file

@ -1044,5 +1044,17 @@
"Total Publishes": "Total Publishes", "Total Publishes": "Total Publishes",
"Are you sure you want to delete this channel?": "Are you sure you want to delete this channel?", "Are you sure you want to delete this channel?": "Are you sure you want to delete this channel?",
"Are you sure? Type %name% to confirm that you wish to delete the channel.": "Are you sure? Type %name% to confirm that you wish to delete the channel.", "Are you sure? Type %name% to confirm that you wish to delete the channel.": "Are you sure? Type %name% to confirm that you wish to delete the channel.",
"You're about to permanently delete a channel. Content published under this channel will be orphaned and their signing channel invalid. Content sync programs using this channel will fail.": "You're about to permanently delete a channel. Content published under this channel will be orphaned and their signing channel invalid. Content sync programs using this channel will fail." "You're about to permanently delete a channel. Content published under this channel will be orphaned and their signing channel invalid. Content sync programs using this channel will fail.": "You're about to permanently delete a channel. Content published under this channel will be orphaned and their signing channel invalid. Content sync programs using this channel will fail.",
"You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.": "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.",
"LBRY works better if you find and follow at least 5 creators you like. You can also block channels you never want to see.": "LBRY works better if you find and follow at least 5 creators you like. You can also block channels you never want to see.",
"Nice! You are currently following %followingCount% creator": "Nice! You are currently following %followingCount% creator",
"You will receive notifications related to new content.": "You will receive notifications related to new content.",
"Rewards Validation": "Rewards Validation",
"Rewards Program": "Rewards Program",
"This step is not required to use LBRY, and not all users or regions may qualify.": "This step is not required to use LBRY, and not all users or regions may qualify.",
"A moderator capable of approving you is typically available in the discord server. See the #rewards-approval instructions carefully and do not message any moderators directly. This process will likely involve providing proof of a stable and established online or real-life identity.": "A moderator capable of approving you is typically available in the discord server. See the #rewards-approval instructions carefully and do not message any moderators directly. This process will likely involve providing proof of a stable and established online or real-life identity.",
"Rewards validation is optional.": "Rewards validation is optional.",
"Continue Without Rewards": "Continue Without Rewards",
"If you'd like to participate our %rewards_program% to earn credits, please complete one of the steps below to be validated.": "If you'd like to participate our %rewards_program% to earn credits, please complete one of the steps below to be validated.",
"verify your email": "verify your email"
} }

View file

@ -120,7 +120,7 @@ function UserSignIn(props: Props) {
const SIGN_IN_FLOW = [ const SIGN_IN_FLOW = [
showEmail && <UserEmailNew />, showEmail && <UserEmailNew />,
showEmailVerification && <UserEmailVerify />, showEmailVerification && <UserEmailVerify />,
showUserVerification && <UserVerify skipLink={redirect} onSkip={() => setHasSkippedRewards(true)} />, showUserVerification && <UserVerify onSkip={() => setHasSkippedRewards(true)} />,
showChannelCreation && <UserFirstChannel />, showChannelCreation && <UserFirstChannel />,
showFollowIntro && ( showFollowIntro && (
<UserChannelFollowIntro <UserChannelFollowIntro

View file

@ -29,10 +29,9 @@ class UserVerify extends React.PureComponent<Props> {
} }
render() { render() {
const { errorMessage, isPending, verifyPhone, fetchUser, skipLink, onSkip } = this.props; const { errorMessage, isPending, verifyPhone, fetchUser, onSkip } = this.props;
const skipButtonProps = { const skipButtonProps = {
onClick: onSkip, onClick: onSkip,
navigate: skipLink || '/',
}; };
return ( return (

View file

@ -1,4 +1,4 @@
import { useState } from 'react'; import { useState, useEffect } from 'react';
export default function usePersistedState(key, firstTimeDefault) { export default function usePersistedState(key, firstTimeDefault) {
// If no key is passed in, act as a normal `useState` // 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); const [value, setValue] = useState(defaultValue);
function setValueAndLocalStorage(newValue) { useEffect(() => {
if (key && localStorageAvailable && value !== newValue) { if (key && localStorageAvailable) {
localStorage.setItem(key, typeof newValue === 'object' ? JSON.stringify(newValue) : newValue); localStorage.setItem(key, typeof value === 'object' ? JSON.stringify(value) : value);
} }
}, [key, value, localStorageAvailable]);
setValue(newValue); return [value, setValue];
}
return [value, setValueAndLocalStorage];
} }