update copy and only show welcome for unverified users

This commit is contained in:
Sean Yesmunt 2019-12-06 11:03:11 -05:00
parent eb3e2848de
commit ebd5ccaeb7
5 changed files with 46 additions and 9 deletions

View file

@ -1,9 +1,14 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doOpenModal } from 'redux/actions/app'; import { doOpenModal } from 'redux/actions/app';
import { selectUser } from 'lbryinc';
import YoutubeWelcome from './view'; import YoutubeWelcome from './view';
const select = state => ({
user: selectUser(state),
});
export default connect( export default connect(
null, select,
{ {
doOpenModal, doOpenModal,
} }

View file

@ -3,13 +3,13 @@ import * as MODALS from 'constants/modal_types';
import React from 'react'; import React from 'react';
import usePersistedState from 'effects/use-persisted-state'; import usePersistedState from 'effects/use-persisted-state';
type Props = { doOpenModal: string => void }; type Props = { doOpenModal: string => void, user: ?User };
const YoutubeWelcome = (props: Props) => { const YoutubeWelcome = (props: Props) => {
const { doOpenModal } = props; const { doOpenModal, user } = props;
const [hasBeenShownIntro, setHasBeenShownIntro] = usePersistedState('youtube-welcome', false); const [hasBeenShownIntro, setHasBeenShownIntro] = usePersistedState('youtube-welcome', false);
const isYouTubeReferrer = document.referrer.includes('youtube.com'); const isYouTubeReferrer = document.referrer.includes('youtube.com');
const shouldShowWelcome = !hasBeenShownIntro && isYouTubeReferrer; const shouldShowWelcome = !hasBeenShownIntro && isYouTubeReferrer && user && !user.has_verified_email;
React.useEffect(() => { React.useEffect(() => {
if (shouldShowWelcome) { if (shouldShowWelcome) {

View file

@ -1,4 +1,5 @@
// @flow // @flow
import * as PAGES from 'constants/pages';
import React from 'react'; import React from 'react';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Card from 'component/common/card'; import Card from 'component/common/card';
@ -14,11 +15,30 @@ const YoutubeWelcome = (props: Props) => {
<Modal isOpen type="card" onAborted={doHideModal}> <Modal isOpen type="card" onAborted={doHideModal}>
<Confetti recycle={false} style={{ position: 'fixed' }} numberOfPieces={100} /> <Confetti recycle={false} style={{ position: 'fixed' }} numberOfPieces={100} />
<Card <Card
title={__('Welcome To The Promised Land')} title={__("You're Free!")}
subtitle={__( subtitle={
'Looks like you are coming from YouTube, some funny pun or something that introduces them to LBRY.' <React.Fragment>
)} <p>
actions={<Button button="primary" label={__('Get To The Goods')} onClick={doHideModal} />} {__("You've escaped the land of spying, censorship, and exploitation.")}
<span className="emoji"> 💩</span>
</p>
<p>
{__('Welcome to the land of content freedom.')}
<span className="emoji"> 🌈</span>
</p>
</React.Fragment>
}
actions={
<React.Fragment>
<Button
button="primary"
label={__('Create an Account')}
navigate={`/$/${PAGES.AUTH}`}
onClick={doHideModal}
/>
<Button button="link" label={__('Not Yet')} onClick={doHideModal} />
</React.Fragment>
}
/> />
</Modal> </Modal>
); );

View file

@ -160,6 +160,10 @@
padding-bottom: 0; padding-bottom: 0;
margin-bottom: var(--spacing-large); margin-bottom: var(--spacing-large);
border-top: 1px solid var(--color-border); border-top: 1px solid var(--color-border);
.button + .button {
margin-left: var(--spacing-medium);
}
} }
.card__body--with-icon, .card__body--with-icon,

View file

@ -31,6 +31,10 @@ h6 {
p { p {
font-size: var(--font-body); font-size: var(--font-body);
& + p {
margin-top: var(--spacing-small);
}
} }
ul, ul,
@ -230,3 +234,7 @@ a {
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
} }
.emoji {
font-size: 1.3em;
}