From 691e648f6a9bb14287ba0f00100641f8fa3920e7 Mon Sep 17 00:00:00 2001 From: seanyesmunt Date: Mon, 16 Mar 2020 13:29:15 -0400 Subject: [PATCH] ensure we properly track if users want to skip the rewards intro --- static/app-strings.json | 16 ++++++++++++++-- ui/component/userSignIn/view.jsx | 2 +- ui/component/userVerify/view.jsx | 3 +-- ui/effects/use-persisted-state.js | 14 ++++++-------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 0acddda56..910146ebb 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1044,5 +1044,17 @@ "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? 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" +} \ No newline at end of file diff --git a/ui/component/userSignIn/view.jsx b/ui/component/userSignIn/view.jsx index 65d830a67..09fc331d3 100644 --- a/ui/component/userSignIn/view.jsx +++ b/ui/component/userSignIn/view.jsx @@ -120,7 +120,7 @@ function UserSignIn(props: Props) { const SIGN_IN_FLOW = [ showEmail && , showEmailVerification && , - showUserVerification && setHasSkippedRewards(true)} />, + showUserVerification && setHasSkippedRewards(true)} />, showChannelCreation && , showFollowIntro && ( { } render() { - const { errorMessage, isPending, verifyPhone, fetchUser, skipLink, onSkip } = this.props; + const { errorMessage, isPending, verifyPhone, fetchUser, onSkip } = this.props; const skipButtonProps = { onClick: onSkip, - navigate: skipLink || '/', }; return ( diff --git a/ui/effects/use-persisted-state.js b/ui/effects/use-persisted-state.js index ad58c1de5..378e843bc 100644 --- a/ui/effects/use-persisted-state.js +++ b/ui/effects/use-persisted-state.js @@ -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, localStorageAvailable]); - setValue(newValue); - } - - return [value, setValueAndLocalStorage]; + return [value, setValue]; }