fix(client): sign up for email list directly (#45508)
* fix(client): sign up for email list directly * fix: remove extraneous code
This commit is contained in:
committed by
GitHub
parent
3375a94677
commit
b2a96e0a09
@ -26,6 +26,7 @@
|
||||
"off": "關閉",
|
||||
"on": "打開",
|
||||
"sign-in": "登錄",
|
||||
"sign-up-email-list": "Sign up for Quincy's weekly emails",
|
||||
"sign-out": "退出",
|
||||
"curriculum": "課程",
|
||||
"forum": "論壇",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"off": "关闭",
|
||||
"on": "打开",
|
||||
"sign-in": "登录",
|
||||
"sign-up-email-list": "Sign up for Quincy's weekly emails",
|
||||
"sign-out": "退出",
|
||||
"curriculum": "课程",
|
||||
"forum": "论坛",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"off": "Off",
|
||||
"on": "On",
|
||||
"sign-in": "Sign in",
|
||||
"sign-up-email-list": "Sign up for Quincy's weekly emails",
|
||||
"sign-out": "Sign out",
|
||||
"curriculum": "Curriculum",
|
||||
"forum": "Forum",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"off": "Apagado",
|
||||
"on": "Encendido",
|
||||
"sign-in": "Iniciar sesión",
|
||||
"sign-up-email-list": "Sign up for Quincy's weekly emails",
|
||||
"sign-out": "Cerrar sesión",
|
||||
"curriculum": "Currículo",
|
||||
"forum": "Foro",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"off": "Off",
|
||||
"on": "On",
|
||||
"sign-in": "Accedi",
|
||||
"sign-up-email-list": "Sign up for Quincy's weekly emails",
|
||||
"sign-out": "Esci",
|
||||
"curriculum": "Curriculum",
|
||||
"forum": "Forum",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"off": "オフ",
|
||||
"on": "オン",
|
||||
"sign-in": "サインイン",
|
||||
"sign-up-email-list": "Sign up for Quincy's weekly emails",
|
||||
"sign-out": "サインアウト",
|
||||
"curriculum": "カリキュラム",
|
||||
"forum": "フォーラム",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"off": "Desligado",
|
||||
"on": "Ligado",
|
||||
"sign-in": "Iniciar sessão",
|
||||
"sign-up-email-list": "Sign up for Quincy's weekly emails",
|
||||
"sign-out": "Encerrar sessão",
|
||||
"curriculum": "Currículo",
|
||||
"forum": "Fórum",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"off": "Вимкнути",
|
||||
"on": "Увімкнути",
|
||||
"sign-in": "Увійти",
|
||||
"sign-up-email-list": "Sign up for Quincy's weekly emails",
|
||||
"sign-out": "Вийти",
|
||||
"curriculum": "Навчальна програма",
|
||||
"forum": "Форум",
|
||||
|
@ -119,16 +119,8 @@ exports[`<EmailSignUp /> Non-Authenticated user "not accepted terms and conditio
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="col-md-4 col-md-offset-2 col-sm-5 col-sm-offset-1 col-xs-12"
|
||||
className="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 col-xs-12"
|
||||
>
|
||||
<button
|
||||
className="big-cta-btn btn btn-lg btn-primary btn-block"
|
||||
disabled={false}
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
buttons.yes-please
|
||||
</button>
|
||||
<div
|
||||
className="button-spacer"
|
||||
style={
|
||||
@ -137,18 +129,14 @@ exports[`<EmailSignUp /> Non-Authenticated user "not accepted terms and conditio
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="col-md-4 col-sm-5 col-xs-12"
|
||||
>
|
||||
<button
|
||||
<a
|
||||
className="big-cta-btn btn btn-lg btn-primary btn-block"
|
||||
disabled={false}
|
||||
href="http://localhost:3000/signin"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
onKeyDown={[Function]}
|
||||
>
|
||||
buttons.no-thanks
|
||||
</button>
|
||||
buttons.sign-up-email-list
|
||||
</a>
|
||||
<div
|
||||
className="button-spacer"
|
||||
style={
|
||||
|
@ -9,21 +9,27 @@ import { createSelector } from 'reselect';
|
||||
import IntroDescription from '../components/Intro/components/IntroDescription';
|
||||
import createRedirect from '../components/create-redirect';
|
||||
import { ButtonSpacer, Spacer } from '../components/helpers';
|
||||
import { apiLocation } from '../../../config/env.json';
|
||||
|
||||
import { acceptTerms, userSelector } from '../redux';
|
||||
import { acceptTerms, userSelector, isSignedInSelector } from '../redux';
|
||||
|
||||
import './email-sign-up.css';
|
||||
|
||||
interface AcceptPrivacyTermsProps {
|
||||
acceptTerms: (accept: boolean | null) => void;
|
||||
acceptedPrivacyTerms: boolean;
|
||||
isSignedIn: boolean;
|
||||
t: TFunction;
|
||||
}
|
||||
|
||||
const mapStateToProps = createSelector(
|
||||
userSelector,
|
||||
({ acceptedPrivacyTerms }: { acceptedPrivacyTerms: boolean }) => ({
|
||||
acceptedPrivacyTerms
|
||||
isSignedInSelector,
|
||||
(
|
||||
{ acceptedPrivacyTerms }: { acceptedPrivacyTerms: boolean },
|
||||
isSignedIn: boolean
|
||||
) => ({
|
||||
acceptedPrivacyTerms,
|
||||
isSignedIn
|
||||
})
|
||||
);
|
||||
const mapDispatchToProps = (dispatch: Dispatch) =>
|
||||
@ -33,10 +39,12 @@ const RedirectToLearn = createRedirect('/learn');
|
||||
function AcceptPrivacyTerms({
|
||||
acceptTerms,
|
||||
acceptedPrivacyTerms,
|
||||
isSignedIn,
|
||||
t
|
||||
}: AcceptPrivacyTermsProps) {
|
||||
const acceptedPrivacyRef = useRef(acceptedPrivacyTerms);
|
||||
const acceptTermsRef = useRef(acceptTerms);
|
||||
|
||||
useEffect(() => {
|
||||
acceptedPrivacyRef.current = acceptedPrivacyTerms;
|
||||
acceptTermsRef.current = acceptTerms;
|
||||
@ -59,28 +67,10 @@ function AcceptPrivacyTerms({
|
||||
acceptTerms(isWeeklyEmailAccepted);
|
||||
}
|
||||
|
||||
return acceptedPrivacyTerms ? (
|
||||
<RedirectToLearn />
|
||||
) : (
|
||||
<>
|
||||
<Helmet>
|
||||
<title>{t('misc.email-signup')} | freeCodeCamp.org</title>
|
||||
</Helmet>
|
||||
<Grid>
|
||||
function renderEmailListOptin(isSignedIn: boolean) {
|
||||
if (isSignedIn) {
|
||||
return (
|
||||
<Row>
|
||||
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
|
||||
<Spacer />
|
||||
<IntroDescription />
|
||||
<hr />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className='email-sign-up' data-cy='email-sign-up'>
|
||||
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
|
||||
<strong>{t('misc.quincy')}</strong>
|
||||
<Spacer />
|
||||
<p>{t('misc.email-blast')}</p>
|
||||
<Spacer />
|
||||
</Col>
|
||||
<Col md={4} mdOffset={2} sm={5} smOffset={1} xs={12}>
|
||||
<Button
|
||||
block={true}
|
||||
@ -105,6 +95,50 @@ function AcceptPrivacyTerms({
|
||||
</Button>
|
||||
<ButtonSpacer />
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
|
||||
<ButtonSpacer />
|
||||
<Button
|
||||
block={true}
|
||||
bsSize='lg'
|
||||
bsStyle='primary'
|
||||
className='big-cta-btn'
|
||||
href={`${apiLocation}/signin`}
|
||||
>
|
||||
{t('buttons.sign-up-email-list')}
|
||||
</Button>
|
||||
<ButtonSpacer />
|
||||
</Col>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return acceptedPrivacyTerms ? (
|
||||
<RedirectToLearn />
|
||||
) : (
|
||||
<>
|
||||
<Helmet>
|
||||
<title>{t('misc.email-signup')} | freeCodeCamp.org</title>
|
||||
</Helmet>
|
||||
<Grid>
|
||||
<Row>
|
||||
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
|
||||
<Spacer />
|
||||
<IntroDescription />
|
||||
<hr />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className='email-sign-up' data-cy='email-sign-up'>
|
||||
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
|
||||
<strong>{t('misc.quincy')}</strong>
|
||||
<Spacer />
|
||||
<p>{t('misc.email-blast')}</p>
|
||||
<Spacer />
|
||||
</Col>
|
||||
{renderEmailListOptin(isSignedIn)}
|
||||
<Col xs={12}>
|
||||
<Spacer />
|
||||
</Col>
|
||||
|
Reference in New Issue
Block a user