add backout option for youtube sync and fix scroll reset
This commit is contained in:
parent
0b0e92d250
commit
cc0b1aea65
3 changed files with 13 additions and 3 deletions
|
@ -58,7 +58,7 @@ function UserChannelFollowIntro(props: Props) {
|
|||
defaultOrderBy={CS.ORDER_BY_TOP}
|
||||
defaultFreshness={CS.FRESH_ALL}
|
||||
claimType="channel"
|
||||
defaultTags={CS.TAGS_FOLLOWED}
|
||||
defaultTags={followingCount > 3 ? CS.TAGS_FOLLOWED : undefined}
|
||||
/>
|
||||
{followingCount > 0 && (
|
||||
<Nag
|
||||
|
|
|
@ -176,7 +176,7 @@ function UserSignUp(props: Props) {
|
|||
),
|
||||
showChannelCreation &&
|
||||
(interestedInYoutubeSync ? (
|
||||
<YoutubeSync inSignUpFlow />
|
||||
<YoutubeSync inSignUpFlow doToggleInterestedInYoutubeSync={doToggleInterestedInYoutubeSync} />
|
||||
) : (
|
||||
<UserFirstChannel doToggleInterestedInYoutubeSync={doToggleInterestedInYoutubeSync} />
|
||||
)),
|
||||
|
|
|
@ -22,13 +22,15 @@ type Props = {
|
|||
youtubeChannels: ?Array<{ transfer_state: string, sync_status: string }>,
|
||||
doUserFetch: () => void,
|
||||
inSignUpFlow?: boolean,
|
||||
doToggleInterestedInYoutubeSync: () => void,
|
||||
};
|
||||
|
||||
export default function YoutubeSync(props: Props) {
|
||||
const { youtubeChannels, doUserFetch, inSignUpFlow = false } = props;
|
||||
const { youtubeChannels, doUserFetch, inSignUpFlow = false, doToggleInterestedInYoutubeSync } = props;
|
||||
const {
|
||||
location: { search, pathname },
|
||||
push,
|
||||
replace,
|
||||
} = useHistory();
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const statusToken = urlParams.get(STATUS_TOKEN_PARAM);
|
||||
|
@ -40,6 +42,10 @@ export default function YoutubeSync(props: Props) {
|
|||
const [addingNewChannel, setAddingNewChannel] = React.useState(newChannelParam);
|
||||
const hasYoutubeChannels = youtubeChannels && youtubeChannels.length > 0;
|
||||
|
||||
React.useEffect(() => {
|
||||
replace(`?reset_scroll=youtube`);
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (statusToken && !hasYoutubeChannels) {
|
||||
doUserFetch();
|
||||
|
@ -160,6 +166,10 @@ export default function YoutubeSync(props: Props) {
|
|||
label={__('Claim Now')}
|
||||
/>
|
||||
|
||||
{inSignUpFlow && !errorMessage && (
|
||||
<Button button="link" label={__('Skip')} onClick={() => doToggleInterestedInYoutubeSync()} />
|
||||
)}
|
||||
|
||||
{errorMessage && <Button button="link" label={__('Skip')} navigate={`/$/${PAGES.REWARDS}`} />}
|
||||
</div>
|
||||
<div className="help--card-actions">
|
||||
|
|
Loading…
Reference in a new issue