Merge remote-tracking branch 'origin/develop' into onboarding-integration

This commit is contained in:
MiroslavDionisiev 2024-11-08 16:09:21 +02:00
commit a4f6a70080
24 changed files with 5738 additions and 5131 deletions

9813
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -58,23 +58,23 @@
"react-twitter-embed": "3.0.3", "react-twitter-embed": "3.0.3",
"react-use": "17.5.1", "react-use": "17.5.1",
"scratch-parser": "5.2.1", "scratch-parser": "5.2.1",
"scratch-storage": "2.3.280" "scratch-storage": "2.3.284"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "7.25.7", "@babel/cli": "7.25.9",
"@babel/core": "7.25.8", "@babel/core": "7.26.0",
"@babel/eslint-parser": "7.25.8", "@babel/eslint-parser": "7.25.9",
"@babel/plugin-syntax-dynamic-import": "7.8.3", "@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-async-to-generator": "7.25.7", "@babel/plugin-transform-async-to-generator": "7.25.9",
"@babel/plugin-transform-object-rest-spread": "7.25.8", "@babel/plugin-transform-object-rest-spread": "7.25.9",
"@babel/preset-env": "7.25.8", "@babel/preset-env": "7.26.0",
"@babel/preset-react": "7.25.7", "@babel/preset-react": "7.25.9",
"@formatjs/intl-datetimeformat": "6.14.0", "@formatjs/intl-datetimeformat": "6.16.4",
"@formatjs/intl-locale": "3.4.6", "@formatjs/intl-locale": "3.4.6",
"@formatjs/intl-numberformat": "8.12.0", "@formatjs/intl-numberformat": "8.14.4",
"@formatjs/intl-pluralrules": "5.2.16", "@formatjs/intl-pluralrules": "5.3.4",
"@formatjs/intl-relativetimeformat": "11.2.16", "@formatjs/intl-relativetimeformat": "11.4.4",
"@types/jest": "29.5.13", "@types/jest": "29.5.14",
"async": "3.2.6", "async": "3.2.6",
"autoprefixer": "10.4.20", "autoprefixer": "10.4.20",
"babel-loader": "8.4.1", "babel-loader": "8.4.1",
@ -95,7 +95,7 @@
"eslint-config-scratch": "9.0.9", "eslint-config-scratch": "9.0.9",
"eslint-plugin-jest": "27.9.0", "eslint-plugin-jest": "27.9.0",
"eslint-plugin-json": "2.1.2", "eslint-plugin-json": "2.1.2",
"eslint-plugin-react": "7.37.1", "eslint-plugin-react": "7.37.2",
"eslint-plugin-react-hooks": "4.6.2", "eslint-plugin-react-hooks": "4.6.2",
"fastly": "1.2.1", "fastly": "1.2.1",
"file-loader": "6.2.0", "file-loader": "6.2.0",
@ -141,21 +141,21 @@
"react-telephone-input": "4.75.5", "react-telephone-input": "4.75.5",
"react-test-renderer": "16.14.0", "react-test-renderer": "16.14.0",
"redux": "3.7.2", "redux": "3.7.2",
"redux-mock-store": "1.5.4", "redux-mock-store": "1.5.5",
"redux-thunk": "2.4.2", "redux-thunk": "2.4.2",
"regenerator-runtime": "0.13.9", "regenerator-runtime": "0.13.9",
"sass": "1.79.5", "sass": "1.80.6",
"sass-loader": "10.5.2", "sass-loader": "10.5.2",
"scratch-gui": "4.0.38", "scratch-gui": "4.0.45",
"scratch-l10n": "3.18.341", "scratch-l10n": "4.0.14",
"selenium-webdriver": "4.25.0", "selenium-webdriver": "4.26.0",
"slick-carousel": "1.8.1", "slick-carousel": "1.8.1",
"stream-browserify": "3.0.0", "stream-browserify": "3.0.0",
"style-loader": "4.0.0", "style-loader": "4.0.0",
"tap": "14.11.0", "tap": "14.11.0",
"url-loader": "3.0.0", "url-loader": "3.0.0",
"use-onclickoutside": "0.4.1", "use-onclickoutside": "0.4.1",
"webpack": "5.95.0", "webpack": "5.96.1",
"webpack-bundle-analyzer": "4.10.2", "webpack-bundle-analyzer": "4.10.2",
"webpack-cli": "5.1.4", "webpack-cli": "5.1.4",
"webpack-dev-middleware": "5.3.4", "webpack-dev-middleware": "5.3.4",

View file

@ -0,0 +1,52 @@
import React, {useCallback, useState, useEffect} from 'react';
import {CommunityGuidelines, communityGuidelines} from './community-guidelines.jsx';
import PropTypes from 'prop-types';
import {FormattedMessage, useIntl} from 'react-intl';
const ReactModal = require('react-modal');
export const CommunityGuidelinesModal = props => {
useIntl();
const [currentPage, setCurrentPage] = useState(0);
const onNextPage = useCallback(() => setCurrentPage(currentPage + 1), [currentPage]);
const onBackPage = useCallback(() => setCurrentPage(currentPage - 1), [currentPage]);
const onComplete = props.onComplete ?? (() => true);
useEffect(() => {
const body = document.querySelector('body');
body.style.overflow = props.isOpen ? 'hidden' : 'auto';
}, [props.isOpen]);
return (
<ReactModal
isOpen={props.isOpen}
style={{
content: {
inset: 0,
width: '100%',
height: '100%',
margin: 0,
padding: 0
},
overlay: {
zIndex: 1000
}
}}
>
<CommunityGuidelines
userId={props.userId}
currentPage={currentPage}
onNextPage={currentPage < communityGuidelines.length - 1 ? onNextPage : onComplete}
nextButtonText={currentPage === communityGuidelines.length - 1 ?
<FormattedMessage id={'communityGuidelines.buttons.finish'} /> :
null}
onBackPage={currentPage > 0 ? onBackPage : null}
/>
</ReactModal>);
};
CommunityGuidelinesModal.propTypes = {
userId: PropTypes.string,
onComplete: PropTypes.func,
isOpen: PropTypes.bool
};

View file

@ -0,0 +1,129 @@
import React, {useEffect} from 'react';
import {FormattedMessage} from 'react-intl';
import thumbnailUrl from '../../lib/user-thumbnail.js';
import OnboardingNavigation from '../onboarding-navigation/onboarding-navigation.jsx';
import './community-guidelines.scss';
import PropTypes from 'prop-types';
export const communityGuidelines = [
{
section: 'communityGuidelines.guidelines.respectSection',
header: 'communityGuidelines.guidelines.respectHeader',
body: 'communityGuidelines.guidelines.respectBody',
image: 'respect-illustration.svg',
imageLeft: true
},
{
section: 'communityGuidelines.guidelines.safeSection',
header: 'communityGuidelines.guidelines.safeHeader',
body: 'communityGuidelines.guidelines.safeBody',
image: 'safe-illustration.svg'
},
{
section: 'communityGuidelines.guidelines.feedbackSection',
header: 'communityGuidelines.guidelines.feedbackHeader',
body: 'communityGuidelines.guidelines.feedbackBody',
image: 'feedback-illustration.svg',
imageLeft: true
},
{
section: 'communityGuidelines.guidelines.remix1Section',
header: 'communityGuidelines.guidelines.remix1Header',
body: 'communityGuidelines.guidelines.remix1Body',
image: 'remix-illustration-1.svg'
},
{
section: 'communityGuidelines.guidelines.remix2Section',
header: 'communityGuidelines.guidelines.remix2Header',
body: 'communityGuidelines.guidelines.remix2Body',
image: 'remix-illustration-2.svg'
},
{
section: 'communityGuidelines.guidelines.remix3Section',
header: 'communityGuidelines.guidelines.remix3Header',
body: 'communityGuidelines.guidelines.remix3Body',
image: 'remix-illustration-3.svg'
},
{
section: 'communityGuidelines.guidelines.honestSection',
header: 'communityGuidelines.guidelines.honestHeader',
body: 'communityGuidelines.guidelines.honestBody',
image: 'honest-illustration.svg',
imageLeft: true
},
{
section: 'communityGuidelines.guidelines.friendlySection',
header: 'communityGuidelines.guidelines.friendlyHeader',
body: 'communityGuidelines.guidelines.friendlyBody',
image: 'friendly-illustration.svg'
}
];
export const CommunityGuidelines = ({
constructHeader = () => null,
userId,
currentPage,
nextButtonText,
onNextPage,
onBackPage
}) => {
useEffect(() => {
communityGuidelines.forEach(guideline => {
new Image().src = `/images/onboarding/${guideline.image}`;
});
}, []);
const guideline = communityGuidelines[currentPage];
return (
<div className="onboarding col">
{constructHeader(guideline)}
<div className="content">
{guideline.imageLeft && (
<div className="image-content">
<img
alt=""
src={`/images/onboarding/${guideline.image}`}
/>
</div>
)}
<div className="text-content">
<h1><FormattedMessage id={guideline.header} /></h1>
<div>
<FormattedMessage id={guideline.body} />
</div>
</div>
{!guideline.imageLeft && (
<div className="image-content">
<div className="image-inner-content">
<img
alt=""
src={`/images/onboarding/${guideline.image}`}
/>
{currentPage === 1 && <img
className="security-avatar"
src={thumbnailUrl(userId, 100, 100)}
/>}
</div>
</div>
)}
</div>
<OnboardingNavigation
currentPage={currentPage}
totalDots={communityGuidelines.length}
nextButtonText={nextButtonText}
onNextPage={onNextPage}
onBackPage={onBackPage}
/>
</div>
);
};
CommunityGuidelines.propTypes = {
currentPage: PropTypes.number,
userId: PropTypes.string,
constructHeader: PropTypes.func,
nextButtonText: PropTypes.string,
onNextPage: PropTypes.func,
onBackPage: PropTypes.func
};

View file

@ -0,0 +1,91 @@
@import "../../colors";
@import "../../frameless";
.col{
display: flex;
flex-direction: column !important;
}
.onboarding {
display: flex;
flex-direction: row;
min-height: 100vh;
line-height: 1.8rem;
font-size: 1.1rem;
h1{
line-height: 3rem;
font-size: 2rem;
margin-bottom: 20px;
}
button{
padding: .3em .9em;
}
.content{
flex: 1;
display: flex;
max-width: 1000px;
padding: auto;
margin: auto;
@media #{$medium-and-smaller} {
flex-direction: column;
}
}
.image-content{
display: flex;
position: relative;
flex: 4;
justify-content: center;
align-items: center;
@media #{$medium-and-smaller} {
flex: 12;
order: 1;
align-items: flex-end;
}
img{
@media #{$medium-and-smaller} {
width: 300px;
height: 300px;
}
}
}
.image-inner-content{
position: relative;
}
.text-content{
flex: 8;
display: flex;
justify-content: center;
align-items: flex-start;
flex-direction: column;
padding: 40px;
@media #{$medium-and-smaller} {
flex: 12;
order: 2;
padding-top: 0px;
justify-content: flex-start;
}
}
}
.security-avatar{
position: absolute;
border-radius: 100%;
width: 65px;
height: 65px;
top: 172px;
left: 149px;
@media #{$medium-and-smaller} {
width: 60px !important;
height: 60px !important;
top: 140.5px;
left: 121.5px;
}
}

View file

@ -7,13 +7,18 @@ const FormattedMessage = require('react-intl').FormattedMessage;
const EmailConfirmationModal = require('../../../components/modal/email-confirmation/modal.jsx'); const EmailConfirmationModal = require('../../../components/modal/email-confirmation/modal.jsx');
const EmailConfirmationBanner = ({onRequestDismiss}) => { const EmailConfirmationBanner = ({onRequestDismiss, userUsesParentEmail}) => {
const [showEmailConfirmationModal, setShowEmailConfirmationModal] = useState(false); const [showEmailConfirmationModal, setShowEmailConfirmationModal] = useState(false);
const i18nPrefix =
userUsesParentEmail ?
'emailConfirmationBanner.parentEmail' :
'emailConfirmationBanner';
return ( return (
<React.Fragment> <React.Fragment>
{(showEmailConfirmationModal && <EmailConfirmationModal {(showEmailConfirmationModal && <EmailConfirmationModal
isOpen isOpen
userUsesParentEmail={userUsesParentEmail}
onRequestClose={() => { onRequestClose={() => {
setShowEmailConfirmationModal(false); setShowEmailConfirmationModal(false);
}} }}
@ -24,7 +29,7 @@ const EmailConfirmationBanner = ({onRequestDismiss}) => {
onRequestDismiss={onRequestDismiss} onRequestDismiss={onRequestDismiss}
> >
<FormattedMessage <FormattedMessage
id="emailConfirmationBanner.confirm" id={`${i18nPrefix}.confirm`}
values={{ values={{
confirmLink: ( confirmLink: (
<a <a
@ -34,7 +39,7 @@ const EmailConfirmationBanner = ({onRequestDismiss}) => {
setShowEmailConfirmationModal(true); setShowEmailConfirmationModal(true);
}} }}
> >
<FormattedMessage id="emailConfirmationBanner.confirmLinkText" /> <FormattedMessage id={`${i18nPrefix}.confirmLinkText`} />
</a> </a>
), ),
faqLink: ( faqLink: (
@ -49,7 +54,8 @@ const EmailConfirmationBanner = ({onRequestDismiss}) => {
}; };
EmailConfirmationBanner.propTypes = { EmailConfirmationBanner.propTypes = {
onRequestDismiss: PropTypes.func onRequestDismiss: PropTypes.func,
userUsesParentEmail: PropTypes.bool
}; };
module.exports = EmailConfirmationBanner; module.exports = EmailConfirmationBanner;

View file

@ -39,7 +39,7 @@ class EmailStep extends React.Component {
if (this.props.sendAnalytics) { if (this.props.sendAnalytics) {
this.props.sendAnalytics('join-email'); this.props.sendAnalytics('join-email');
} }
// automatically start with focus on username field // automatically start with focus on email field
if (this.emailInput) this.emailInput.focus(); if (this.emailInput) this.emailInput.focus();
} }
handleSetEmailRef (emailInputRef) { handleSetEmailRef (emailInputRef) {
@ -48,7 +48,7 @@ class EmailStep extends React.Component {
handleCaptchaLoad () { handleCaptchaLoad () {
this.setState({captchaIsLoading: false}); this.setState({captchaIsLoading: false});
} }
// simple function to memoize remote requests for usernames // simple function to memoize remote requests for emails
validateEmailRemotelyWithCache (email) { validateEmailRemotelyWithCache (email) {
if (Object.prototype.hasOwnProperty.call(this.emailRemoteCache, email)) { if (Object.prototype.hasOwnProperty.call(this.emailRemoteCache, email)) {
return Promise.resolve(this.emailRemoteCache[email]); return Promise.resolve(this.emailRemoteCache[email]);
@ -89,7 +89,7 @@ class EmailStep extends React.Component {
this.captchaRef.executeCaptcha(); this.captchaRef.executeCaptcha();
} }
handleCaptchaSolved (token) { handleCaptchaSolved (token) {
// Now thatcaptcha is done, we can tell Formik we're submitting. // Now that captcha is done, we can tell Formik we're submitting.
this.formikBag.setSubmitting(true); this.formikBag.setSubmitting(true);
this.formData['g-recaptcha-response'] = token; this.formData['g-recaptcha-response'] = token;
this.props.onNextStep(this.formData); this.props.onNextStep(this.formData);
@ -98,6 +98,14 @@ class EmailStep extends React.Component {
this.captchaRef = ref; this.captchaRef = ref;
} }
render () { render () {
const title = this.props.under16 ?
this.props.intl.formatMessage({id: 'registration.under16.emailStepTitle'}) :
this.props.intl.formatMessage({id: 'registration.emailStepTitle'});
const description = this.props.under16 ?
this.props.intl.formatMessage({id: 'registration.under16.emailStepDescription'}) :
null;
return ( return (
<Formik <Formik
initialValues={{ initialValues={{
@ -149,8 +157,9 @@ class EmailStep extends React.Component {
headerImgSrc="/images/join-flow/email-header.png" headerImgSrc="/images/join-flow/email-header.png"
innerClassName="join-flow-inner-email-step" innerClassName="join-flow-inner-email-step"
nextButton={this.props.intl.formatMessage({id: 'registration.createAccount'})} nextButton={this.props.intl.formatMessage({id: 'registration.createAccount'})}
title={this.props.intl.formatMessage({id: 'registration.emailStepTitle'})} title={title}
titleClassName="join-flow-email-title" titleClassName="join-flow-email-title"
description={description}
waiting={this.props.waiting || isSubmitting || this.state.captchaIsLoading} waiting={this.props.waiting || isSubmitting || this.state.captchaIsLoading}
onSubmit={handleSubmit} onSubmit={handleSubmit}
> >
@ -205,7 +214,8 @@ EmailStep.propTypes = {
onCaptchaError: PropTypes.func, onCaptchaError: PropTypes.func,
onNextStep: PropTypes.func, onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func.isRequired, sendAnalytics: PropTypes.func.isRequired,
waiting: PropTypes.bool waiting: PropTypes.bool,
under16: PropTypes.bool
}; };

View file

@ -61,7 +61,7 @@ class JoinFlow extends React.Component {
formData: defaults({}, newFormData, this.state.formData) formData: defaults({}, newFormData, this.state.formData)
}; };
this.setState(newState, () => { this.setState(newState, () => {
this.handleSubmitRegistration(this.state.formData); this.handleSubmitRegistration(this.state.formData, this.isUnder16());
}); });
} }
getErrorsFromResponse (err, body, res) { getErrorsFromResponse (err, body, res) {
@ -175,7 +175,7 @@ class JoinFlow extends React.Component {
}); });
}); });
} }
handleSubmitRegistration (formData) { handleSubmitRegistration (formData, isUnder16) {
this.setState({ this.setState({
registrationError: null, // clear any existing error registrationError: null, // clear any existing error
waiting: true waiting: true
@ -191,6 +191,7 @@ class JoinFlow extends React.Component {
'password': formData.password, 'password': formData.password,
'birth_month': formData.birth_month, 'birth_month': formData.birth_month,
'birth_year': formData.birth_year, 'birth_year': formData.birth_year,
'under_16': isUnder16,
'g-recaptcha-response': formData['g-recaptcha-response'], 'g-recaptcha-response': formData['g-recaptcha-response'],
'gender': formData.gender, 'gender': formData.gender,
'country': formData.country, 'country': formData.country,
@ -213,7 +214,7 @@ class JoinFlow extends React.Component {
} }
handleErrorNext () { handleErrorNext () {
if (this.canTryAgain()) { if (this.canTryAgain()) {
this.handleSubmitRegistration(this.state.formData); this.handleSubmitRegistration(this.state.formData, this.isUnder16());
} else { } else {
this.resetState(); this.resetState();
} }
@ -229,6 +230,39 @@ class JoinFlow extends React.Component {
}); });
} }
parseDateComponent (fieldValue) {
// The dates are set to either `'null'` (before the BirthDateStep) or a string representation of a number.
if (fieldValue && fieldValue !== 'null') {
return Number(fieldValue);
}
}
isUnder16 () {
const birthYear = this.parseDateComponent(this.state.formData.birth_year);
const birthMonth = this.parseDateComponent(this.state.formData.birth_month);
if (!birthYear || !birthMonth) {
// We're not yet at the point where the user has specified their birth date
return false;
}
const now = new Date();
const yearDiff = now.getFullYear() - birthYear;
if (yearDiff > 16) {
return false;
}
if (yearDiff < 16) {
return true;
}
const currentMonth1Based = now.getMonth() + 1;
const monthsLeftToBirthday = birthMonth - currentMonth1Based;
return monthsLeftToBirthday >= 0;
}
render () { render () {
return ( return (
<main> <main>
@ -264,6 +298,7 @@ class JoinFlow extends React.Component {
<EmailStep <EmailStep
sendAnalytics={this.sendAnalytics} sendAnalytics={this.sendAnalytics}
waiting={this.state.waiting} waiting={this.state.waiting}
under16={this.isUnder16()}
onCaptchaError={this.handleCaptchaError} onCaptchaError={this.handleCaptchaError}
onNextStep={this.handlePrepareToRegister} onNextStep={this.handlePrepareToRegister}
/> />
@ -272,6 +307,7 @@ class JoinFlow extends React.Component {
email={this.state.formData.email} email={this.state.formData.email}
sendAnalytics={this.sendAnalytics} sendAnalytics={this.sendAnalytics}
username={this.state.formData.username} username={this.state.formData.username}
under16={this.isUnder16()}
onNextStep={this.props.onCompleteRegistration} onNextStep={this.props.onCompleteRegistration}
/> />
</Progression> </Progression>

View file

@ -51,7 +51,7 @@ class WelcomeStep extends React.Component {
innerClassName="join-flow-inner-welcome-step" innerClassName="join-flow-inner-welcome-step"
nextButton={this.props.createProjectOnComplete ? ( nextButton={this.props.createProjectOnComplete ? (
<React.Fragment> <React.Fragment>
<FormattedMessage id="general.getStarted" /> <FormattedMessage id="registration.reviewGuidelines" />
<img <img
className="join-flow-next-button-arrow" className="join-flow-next-button-arrow"
src="/svgs/project/r-arrow.svg" src="/svgs/project/r-arrow.svg"
@ -75,7 +75,11 @@ class WelcomeStep extends React.Component {
</div> </div>
<div className="join-flow-instructions"> <div className="join-flow-instructions">
<FormattedMessage <FormattedMessage
id="registration.welcomeStepInstructions" id={
this.props.under16 ?
'registration.under16.welcomeStepInstructions' :
'registration.welcomeStepInstructions'
}
values={{ values={{
email: this.props.email email: this.props.email
}} }}
@ -95,7 +99,8 @@ WelcomeStep.propTypes = {
intl: intlShape, intl: intlShape,
onNextStep: PropTypes.func, onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func, sendAnalytics: PropTypes.func,
username: PropTypes.string username: PropTypes.string,
under16: PropTypes.bool
}; };
module.exports = injectIntl(WelcomeStep); module.exports = injectIntl(WelcomeStep);

View file

@ -8,10 +8,20 @@ const Modal = require('../base/modal.jsx');
require('./modal.scss'); require('./modal.scss');
const EmailConfirmationModal = ({ const EmailConfirmationModal = ({
email, onRequestClose, isOpen email,
onRequestClose,
isOpen,
userUsesParentEmail
}) => { }) => {
const [showEmailTips, setShowEmailTips] = useState(false); const [showEmailTips, setShowEmailTips] = useState(false);
const i18nPrefix =
userUsesParentEmail ?
'emailConfirmationModal.parentEmail' :
'emailConfirmationModal';
const showFooter = !showEmailTips || !userUsesParentEmail;
return ( return (
<Modal <Modal
className="email-confirmation-modal" className="email-confirmation-modal"
@ -31,16 +41,16 @@ const EmailConfirmationModal = ({
<div className="modal-text-content"> <div className="modal-text-content">
{showEmailTips ? {showEmailTips ?
(<React.Fragment> (<React.Fragment>
<h1><FormattedMessage id="emailConfirmationModal.confirmingTips" /></h1> <h1><FormattedMessage id={`${i18nPrefix}.confirmingTips`} /></h1>
<ul> <ul>
<li><FormattedMessage id="emailConfirmationModal.tipWaitTenMinutes" /></li> <li><FormattedMessage id={`${i18nPrefix}.tipWaitTenMinutes`} /></li>
<li><FormattedMessage id="emailConfirmationModal.tipCheckSpam" /></li> <li><FormattedMessage id={`${i18nPrefix}.tipCheckSpam`} /></li>
<li><FormattedMessage <li><FormattedMessage
id="emailConfirmationModal.correctEmail" id={`${i18nPrefix}.correctEmail`}
values={ values={
{accountSettings: {accountSettings:
(<a href="/accounts/email_change/"> (<a href="/accounts/email_change/">
<FormattedMessage id="emailConfirmationModal.accountSettings" /> <FormattedMessage id={`${i18nPrefix}.accountSettings`} />
</a>) </a>)
} }
} }
@ -48,18 +58,18 @@ const EmailConfirmationModal = ({
</ul> </ul>
</React.Fragment>) : </React.Fragment>) :
(<React.Fragment> (<React.Fragment>
<h1><FormattedMessage id="emailConfirmationModal.confirm" /></h1> <h1><FormattedMessage id={`${i18nPrefix}.confirm`} /></h1>
<p><FormattedMessage id="emailConfirmationModal.wantToShare" /></p> <p><FormattedMessage id={`${i18nPrefix}.wantToShare`} /></p>
<p><FormattedMessage id="emailConfirmationModal.clickEmailLink" /></p> <p><FormattedMessage id={`${i18nPrefix}.clickEmailLink`} /></p>
<p><b>{email}</b></p> <p><b>{email}</b></p>
<a href="/accounts/email_change/"> <a href="/accounts/email_change/">
<FormattedMessage id="emailConfirmationModal.resendEmail" /> <FormattedMessage id={`${i18nPrefix}.resendEmail`} />
</a> </a>
</React.Fragment>) </React.Fragment>)
} }
</div> </div>
</div> </div>
<div className="guide-footer"> {showFooter && (<div className="guide-footer">
{showEmailTips ? {showEmailTips ?
(<React.Fragment> (<React.Fragment>
<FormattedMessage <FormattedMessage
@ -75,7 +85,7 @@ const EmailConfirmationModal = ({
</React.Fragment>) : </React.Fragment>) :
(<React.Fragment> (<React.Fragment>
<FormattedMessage <FormattedMessage
id="emailConfirmationModal.havingTrouble" id={`${i18nPrefix}.havingTrouble`}
values={{tipsLink: ( values={{tipsLink: (
<a <a
onClick={e => { // eslint-disable-line react/jsx-no-bind onClick={e => { // eslint-disable-line react/jsx-no-bind
@ -83,17 +93,18 @@ const EmailConfirmationModal = ({
setShowEmailTips(true); setShowEmailTips(true);
}} }}
> >
<FormattedMessage id="emailConfirmationModal.checkOutTips" /> <FormattedMessage id={`${i18nPrefix}.checkOutTips`} />
</a>)}} </a>)}}
/> />
</React.Fragment>)} </React.Fragment>)}
</div> </div>)}
</Modal>); </Modal>);
}; };
EmailConfirmationModal.propTypes = { EmailConfirmationModal.propTypes = {
email: PropTypes.string, email: PropTypes.string,
isOpen: PropTypes.bool, isOpen: PropTypes.bool,
userUsesParentEmail: PropTypes.bool,
onRequestClose: PropTypes.func onRequestClose: PropTypes.func
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({

View file

@ -0,0 +1,80 @@
import React, {useEffect, useMemo} from 'react';
import Button from '../forms/button.jsx';
import {FormattedMessage} from 'react-intl';
import PropTypes from 'prop-types';
import './onboarding-navigation.scss';
import classNames from 'classnames';
const OnboardingNavigation = ({
currentPage,
totalDots,
onNextPage,
onBackPage,
nextButtonText
}) => {
useEffect(() => {
new Image().src = '/images/onboarding/right-arrow.svg';
new Image().src = '/images/onboarding/left-arrow.svg';
}, []);
const dots = useMemo(() => {
const dotsComponents = [];
if (currentPage >= 0 && totalDots){
for (let i = 0; i < totalDots; i++){
dotsComponents.push(<div
key={`dot page-${currentPage} ${i}`}
className={`dot ${currentPage === i && 'active'}`}
/>);
}
}
return dotsComponents;
}, [currentPage, totalDots]);
return (
<div className="navigation">
{
<Button
onClick={onBackPage}
className={classNames({
hidden: !onBackPage
})}
>
<img
className="left-arrow"
alt=""
src="/images/onboarding/left-arrow.svg"
/>
<span className="navText">
{<FormattedMessage
id={'communityGuidelines.buttons.back'}
/>}
</span>
</Button> }
{(currentPage >= 0 && totalDots) &&
<div className="dotRow">
{dots}
</div>}
<Button onClick={onNextPage}>
<span className="navText">
{nextButtonText || <FormattedMessage id={'communityGuidelines.buttons.next'} />}
</span>
<img
className="right-arrow"
alt=""
src="/images/onboarding/right-arrow.svg"
/>
</Button>
</div>
);
};
OnboardingNavigation.propTypes = {
currentPage: PropTypes.number,
totalDots: PropTypes.number,
onNextPage: PropTypes.func,
onBackPage: PropTypes.func,
nextButtonText: PropTypes.node
};
export default OnboardingNavigation;

View file

@ -0,0 +1,68 @@
@import "../../colors";
@import "../../frameless";
.button{
display: flex;
justify-content: center;
align-items: center;
border-radius: .3rem;
.left-arrow{
padding-right: 4px;
@media #{$small} {
padding: 0px;
}
}
.right-arrow{
padding-left: 4px;
@media #{$small} {
padding: 0px;
}
}
}
.hidden{
visibility: hidden;
}
.navigation{
display: flex;
width: 100%;
justify-content: space-around;
align-items: center;
margin-bottom: 40px;
.dotRow{
display: flex;
justify-content: space-between;
width: 244px;
min-width: 0px;
padding: 0px 5px;
}
.dot{
width: 20px;
height: 20px;
border-radius: 100%;
background-color: #d9d9d9;
border: none;
display: flex;
justify-content: center;
align-items: center;
}
.active{
border: solid 2px #4280d9;
background-color: #4c97fe;
margin-top: -2px;
}
.navText{
@media #{$small} {
display: none;
}
}
.buttonPlaceholder{
width: 20px,
}
}

View file

@ -209,6 +209,8 @@
"registration.genderOptionAnother": "Another gender:", "registration.genderOptionAnother": "Another gender:",
"registration.genderOptionPreferNotToSay": "Prefer not to say", "registration.genderOptionPreferNotToSay": "Prefer not to say",
"registration.emailStepTitle": "What's your email?", "registration.emailStepTitle": "What's your email?",
"registration.under16.emailStepTitle": "What's your parent's email address?",
"registration.under16.emailStepDescription": "We'll send them a link to verify your account.",
"registration.emailStepInfo": "This will help if you forget your password. This information will not be made public on your account.", "registration.emailStepInfo": "This will help if you forget your password. This information will not be made public on your account.",
"registration.goToClass": "Go to Class", "registration.goToClass": "Go to Class",
"registration.invitedBy": "invited by", "registration.invitedBy": "invited by",
@ -226,6 +228,7 @@
"registration.personalStepDescription": "Your individual responses will not be displayed publicly, and will be kept confidential and secure", "registration.personalStepDescription": "Your individual responses will not be displayed publicly, and will be kept confidential and secure",
"registration.private": "We will keep this information private.", "registration.private": "We will keep this information private.",
"registration.problemsAre": "The problems are:", "registration.problemsAre": "The problems are:",
"registration.reviewGuidelines": "Review Community Guidelines",
"registration.selectCountry": "Select country", "registration.selectCountry": "Select country",
"registration.startOverInstruction": "Click \"Start over.\"", "registration.startOverInstruction": "Click \"Start over.\"",
"registration.studentPersonalStepDescription": "This information will not appear on the Scratch website.", "registration.studentPersonalStepDescription": "This information will not appear on the Scratch website.",
@ -262,6 +265,7 @@
"registration.welcomeStepDescription": "You have successfully set up a Scratch account! You are now a member of the class:", "registration.welcomeStepDescription": "You have successfully set up a Scratch account! You are now a member of the class:",
"registration.welcomeStepDescriptionNonEducator": "Youre now logged in! You can start exploring and creating projects.", "registration.welcomeStepDescriptionNonEducator": "Youre now logged in! You can start exploring and creating projects.",
"registration.welcomeStepInstructions": "Want to share and comment? Click the link on the email we sent to {email}.", "registration.welcomeStepInstructions": "Want to share and comment? Click the link on the email we sent to {email}.",
"registration.under16.welcomeStepInstructions": "In order to share projects and participate in the Scratch community, your parent needs to confirm your account. They can click on the link in the email we sent to {email}.",
"registration.welcomeStepPrompt": "To get started, click on the button below.", "registration.welcomeStepPrompt": "To get started, click on the button below.",
"registration.welcomeStepTitle": "Hurray! Welcome to Scratch!", "registration.welcomeStepTitle": "Hurray! Welcome to Scratch!",
"registration.welcomeStepTitleNonEducator": "Welcome to Scratch, {username}!", "registration.welcomeStepTitleNonEducator": "Welcome to Scratch, {username}!",
@ -270,6 +274,9 @@
"emailConfirmationBanner.confirmLinkText": "Confirm your email", "emailConfirmationBanner.confirmLinkText": "Confirm your email",
"emailConfirmationBanner.faqLinkText": "Having trouble?", "emailConfirmationBanner.faqLinkText": "Having trouble?",
"emailConfirmationBanner.parentEmail.confirm": "A parent needs to {confirmLink} before you can share projects.",
"emailConfirmationBanner.parentEmail.confirmLinkText": "confirm your account",
"emailConfirmationModal.confirm": "Confirm your email", "emailConfirmationModal.confirm": "Confirm your email",
"emailConfirmationModal.wantToShare": "Want to share on Scratch?", "emailConfirmationModal.wantToShare": "Want to share on Scratch?",
"emailConfirmationModal.clickEmailLink": "Confirm your email address by clicking the link in the email we sent to:", "emailConfirmationModal.clickEmailLink": "Confirm your email address by clicking the link in the email we sent to:",
@ -284,6 +291,18 @@
"emailConfirmationModal.havingTrouble": "Having Trouble? {tipsLink}", "emailConfirmationModal.havingTrouble": "Having Trouble? {tipsLink}",
"emailConfirmationModal.checkOutTips": "Check out these tips", "emailConfirmationModal.checkOutTips": "Check out these tips",
"emailConfirmationModal.parentEmail.confirm": "Confirm your account",
"emailConfirmationModal.parentEmail.wantToShare": "Want to share on Scratch?",
"emailConfirmationModal.parentEmail.clickEmailLink": "Your parent needs to click on the link in the email we sent to:",
"emailConfirmationModal.parentEmail.resendEmail": "Resend confirmation email",
"emailConfirmationModal.parentEmail.confirmingTips": "Tips for confirming your email address",
"emailConfirmationModal.parentEmail.tipWaitTenMinutes": "Wait for ten minutes. The email may take a while to arrive.",
"emailConfirmationModal.parentEmail.tipCheckSpam": "Ask your parent to check their spam folder.",
"emailConfirmationModal.parentEmail.correctEmail": "Make sure your parent's email address is correct. Check your {accountSettings}.",
"emailConfirmationModal.parentEmail.accountSettings": "Account Settings",
"emailConfirmationModal.parentEmail.havingTrouble": "Having Trouble? {tipsLink}",
"emailConfirmationModal.parentEmail.checkOutTips": "Check out these tips",
"thumbnail.by": "by", "thumbnail.by": "by",
"report.error": "Something went wrong when trying to send your message. Please try again.", "report.error": "Something went wrong when trying to send your message. Please try again.",
"report.project": "Report Project", "report.project": "Report Project",
@ -480,5 +499,33 @@
"renameAccount.scratchsCommunityGuidelines": "Scratch's Community Guidelines", "renameAccount.scratchsCommunityGuidelines": "Scratch's Community Guidelines",
"renameAccount.change": "Change", "renameAccount.change": "Change",
"renameAccount.goToProfile": "Go to your profile", "renameAccount.goToProfile": "Go to your profile",
"renameAccount.pastNotifications": "Here are your past admin notifications" "renameAccount.pastNotifications": "Here are your past admin notifications",
"communityGuidelines.buttons.back": "Back",
"communityGuidelines.buttons.next": "Next",
"communityGuidelines.buttons.finish": "I Agree",
"communityGuidelines.guidelines.respectSection": "Become a New Scratcher - Treat everyone with respect",
"communityGuidelines.guidelines.respectHeader": "New Scratchers treat everyone with respect.",
"communityGuidelines.guidelines.respectBody": "Everyone on Scratch is encouraged to share things that excite them and are important to them—we hope that you find ways to celebrate your own identity on Scratch, and allow others to do the same.",
"communityGuidelines.guidelines.safeSection": "Become a New Scratcher - Be safe",
"communityGuidelines.guidelines.safeHeader": "New Scratchers are safe: we keep personal and contact information private.",
"communityGuidelines.guidelines.safeBody": "This includes not sharing real last names, phone numbers, addresses, hometowns, school names, email addresses, usernames or links to social media sites, video chatting applications, or websites with private chat functionality.",
"communityGuidelines.guidelines.feedbackSection": "Become a New Scratcher - Give helpful feedback",
"communityGuidelines.guidelines.feedbackHeader": "New Scratchers give helpful feedback.",
"communityGuidelines.guidelines.feedbackBody": "When commenting on a project, remember to say something you like about it, offer suggestions, and be kind, not critical.",
"communityGuidelines.guidelines.remix1Section": "Become a New Scratcher - Embrace remix culture",
"communityGuidelines.guidelines.remix1Header": "New Scratchers embrace remix culture.",
"communityGuidelines.guidelines.remix1Body": "Remixing is when you build upon someone elses projects, code, ideas, images, or anything else they share on Scratch to make your own unique creation.",
"communityGuidelines.guidelines.remix2Section": "Become a New Scratcher - Embrace remix culture",
"communityGuidelines.guidelines.remix2Header": "Remixing is a great way to collaborate and connect with other Scratchers.",
"communityGuidelines.guidelines.remix2Body": "You are encouraged to use anything you find on Scratch in your own creations, as long as you provide credit to everyone whose work you used and make a meaningful change to it. ",
"communityGuidelines.guidelines.remix3Section": "Become a New Scratcher - Embrace remix culture",
"communityGuidelines.guidelines.remix3Header": "Remixing means sharing with others.",
"communityGuidelines.guidelines.remix3Body": "When you share something on Scratch, you are giving permission to all Scratchers to use your work in their creations, too.",
"communityGuidelines.guidelines.honestSection": "Become a New Scratcher - Be honest",
"communityGuidelines.guidelines.honestHeader": "New Scratchers are honest.",
"communityGuidelines.guidelines.honestBody": "Its important to be honest and authentic when interacting with others on Scratch, and remember that there is a person behind every Scratch account.",
"communityGuidelines.guidelines.friendlySection": "Become a New Scratcher - Keep the site friendly",
"communityGuidelines.guidelines.friendlyHeader": "New Scratchers help keep the site friendly.",
"communityGuidelines.guidelines.friendlyBody": "Its important to keep your creations and conversations friendly and appropriate for all ages. If you think something on Scratch is mean, insulting, too violent, or otherwise disruptive to the community, click “Report” to let us know about it."
} }

View file

@ -15,7 +15,9 @@ const Types = keyMirror({
TOGGLE_LOGIN_OPEN: null, TOGGLE_LOGIN_OPEN: null,
SET_CANCELED_DELETION_OPEN: null, SET_CANCELED_DELETION_OPEN: null,
SET_REGISTRATION_OPEN: null, SET_REGISTRATION_OPEN: null,
HANDLE_REGISTRATION_REQUESTED: null HANDLE_REGISTRATION_REQUESTED: null,
HANDLE_REGISTRATION_COMPLETED: null,
REVIEW_COMMUNITY_GUIDELINES: null
}); });
module.exports.getInitialState = () => ({ module.exports.getInitialState = () => ({
@ -25,6 +27,9 @@ module.exports.getInitialState = () => ({
loginError: null, loginError: null,
loginOpen: false, loginOpen: false,
registrationOpen: false, registrationOpen: false,
// This is set shortly before changing the window.location (hence refreshing the page)
// We need something more durable than redux state in that case -> so we use `localStorage`
shouldReviewCommunityGuidelines: localStorage.getItem('shouldReviewCommunityGuidelines') === 'true',
searchTerm: '' searchTerm: ''
}); });
@ -56,6 +61,12 @@ module.exports.navigationReducer = (state, action) => {
return state; return state;
} }
return defaults({registrationOpen: true}, state); return defaults({registrationOpen: true}, state);
case Types.HANDLE_REGISTRATION_COMPLETED:
localStorage.setItem('shouldReviewCommunityGuidelines', 'true');
return defaults({shouldReviewCommunityGuidelines: true}, state);
case Types.REVIEW_COMMUNITY_GUIDELINES:
localStorage.setItem('shouldReviewCommunityGuidelines', 'false');
return defaults({shouldReviewCommunityGuidelines: false}, state);
default: default:
return state; return state;
} }
@ -103,6 +114,14 @@ module.exports.handleRegistrationRequested = () => ({
type: Types.HANDLE_REGISTRATION_REQUESTED type: Types.HANDLE_REGISTRATION_REQUESTED
}); });
module.exports.handleRegistrationCompleted = () => ({
type: Types.HANDLE_REGISTRATION_COMPLETED
});
module.exports.reviewCommunityGuidelines = () => ({
type: Types.REVIEW_COMMUNITY_GUIDELINES
});
module.exports.handleCompleteRegistration = createProject => (dispatch => { module.exports.handleCompleteRegistration = createProject => (dispatch => {
if (createProject) { if (createProject) {
// TODO: Ideally this would take you to the editor with the getting started // TODO: Ideally this would take you to the editor with the getting started
@ -114,6 +133,7 @@ module.exports.handleCompleteRegistration = createProject => (dispatch => {
dispatch(module.exports.setRegistrationOpen(false)) dispatch(module.exports.setRegistrationOpen(false))
); );
} }
dispatch(module.exports.handleRegistrationCompleted());
}); });
module.exports.handleLogIn = (formData, callback) => (dispatch => { module.exports.handleLogIn = (formData, callback) => (dispatch => {

View file

@ -1,5 +1,5 @@
/* eslint-disable react/jsx-no-bind */ /* eslint-disable react/jsx-no-bind */
import React, {useState, useEffect} from 'react'; import React, {useState, useEffect, useCallback} from 'react';
import useWindowSize from 'react-use/lib/useWindowSize'; import useWindowSize from 'react-use/lib/useWindowSize';
import Confetti from 'react-confetti'; import Confetti from 'react-confetti';
import {FormattedMessage, injectIntl} from 'react-intl'; import {FormattedMessage, injectIntl} from 'react-intl';
@ -14,63 +14,14 @@ import Button from '../../components/forms/button.jsx';
import Modal from '../../components/modal/base/modal.jsx'; import Modal from '../../components/modal/base/modal.jsx';
import NotAvailable from '../../components/not-available/not-available.jsx'; import NotAvailable from '../../components/not-available/not-available.jsx';
import WarningBanner from '../../components/title-banner/warning-banner.jsx'; import WarningBanner from '../../components/title-banner/warning-banner.jsx';
import OnboardingNavigation from '../../components/onboarding-navigation/onboarding-navigation.jsx';
import {
CommunityGuidelines,
communityGuidelines
} from '../../components/community-guidelines/community-guidelines.jsx';
import './become-a-scratcher.scss'; import './become-a-scratcher.scss';
const communityGuidelines = [
{
section: 'becomeAScratcher.guidelines.respectSection',
header: 'becomeAScratcher.guidelines.respectHeader',
body: 'becomeAScratcher.guidelines.respectBody',
image: 'respect-illustration.svg',
imageLeft: true
},
{
section: 'becomeAScratcher.guidelines.safeSection',
header: 'becomeAScratcher.guidelines.safeHeader',
body: 'becomeAScratcher.guidelines.safeBody',
image: 'safe-illustration.svg'
},
{
section: 'becomeAScratcher.guidelines.feedbackSection',
header: 'becomeAScratcher.guidelines.feedbackHeader',
body: 'becomeAScratcher.guidelines.feedbackBody',
image: 'feedback-illustration.svg',
imageLeft: true
},
{
section: 'becomeAScratcher.guidelines.remix1Section',
header: 'becomeAScratcher.guidelines.remix1Header',
body: 'becomeAScratcher.guidelines.remix1Body',
image: 'remix-illustration-1.svg'
},
{
section: 'becomeAScratcher.guidelines.remix2Section',
header: 'becomeAScratcher.guidelines.remix2Header',
body: 'becomeAScratcher.guidelines.remix2Body',
image: 'remix-illustration-2.svg'
},
{
section: 'becomeAScratcher.guidelines.remix3Section',
header: 'becomeAScratcher.guidelines.remix3Header',
body: 'becomeAScratcher.guidelines.remix3Body',
image: 'remix-illustration-3.svg'
},
{
section: 'becomeAScratcher.guidelines.honestSection',
header: 'becomeAScratcher.guidelines.honestHeader',
body: 'becomeAScratcher.guidelines.honestBody',
image: 'honest-illustration.svg',
imageLeft: true
},
{
section: 'becomeAScratcher.guidelines.friendlySection',
header: 'becomeAScratcher.guidelines.friendlyHeader',
body: 'becomeAScratcher.guidelines.friendlyBody',
image: 'friendly-illustration.svg'
}
];
/* eslint-disable max-len */ /* eslint-disable max-len */
const confettiPaths = [ const confettiPaths = [
new Path2D('M34.549 3.1361L40.613 15.4191L54.1718 17.3947C58.7918 18.0636 60.6345 23.7378 57.2946 26.9979L47.4788 36.5612L49.7954 50.0668C50.5839 54.6646 45.7557 58.1728 41.6274 56.0024L29.4994 49.6239L17.3714 56.0024C13.2386 58.1728 8.4149 54.6646 9.19893 50.0668L11.52 36.5612L1.70862 26.9979C-1.63567 23.7378 0.20701 18.0636 4.82699 17.3947L18.3902 15.4191L24.4497 3.1361C26.5183 -1.04537 32.4805 -1.04537 34.549 3.1361Z'), new Path2D('M34.549 3.1361L40.613 15.4191L54.1718 17.3947C58.7918 18.0636 60.6345 23.7378 57.2946 26.9979L47.4788 36.5612L49.7954 50.0668C50.5839 54.6646 45.7557 58.1728 41.6274 56.0024L29.4994 49.6239L17.3714 56.0024C13.2386 58.1728 8.4149 54.6646 9.19893 50.0668L11.52 36.5612L1.70862 26.9979C-1.63567 23.7378 0.20701 18.0636 4.82699 17.3947L18.3902 15.4191L24.4497 3.1361C26.5183 -1.04537 32.4805 -1.04537 34.549 3.1361Z'),
@ -78,9 +29,9 @@ const confettiPaths = [
new Path2D('M10.9967 45.1305C5.99892 36.9346 5.59074 25.9968 9.99448 17.3259C14.5575 8.00641 22.2367 3.87569 25.3229 2.53264C27.178 1.67111 29.1327 0.999586 31.2366 0.504948L33.3008 0.0594462C34.8174 -0.25175 36.3273 0.68839 36.6558 2.18868C36.9877 3.69225 36.022 5.17289 34.4988 5.50047L32.491 5.93286C30.8218 6.32595 29.2223 6.87628 27.6625 7.6035C25.6349 8.4814 18.9281 11.8783 15.0586 19.786C12.1217 25.5612 11.2456 34.7431 15.8683 42.3199C20.0564 49.6183 28.6315 54.0929 36.7654 53.3395C44.4578 52.7859 51.5164 47.6659 53.992 40.8851C56.5042 34.5072 54.835 27.9688 52.0772 24.2869C48.7553 19.75 44.6204 18.3545 42.9976 17.9647C42.7554 17.8926 37.074 16.186 32.0563 18.6985C29.8959 19.7336 27.1017 22.0627 25.605 25.5612C23.9889 29.1743 24.407 33.8193 26.5973 36.9051C28.8008 40.2136 32.9556 42.0873 36.5297 41.4518C40.0872 40.8917 42.4932 38.2449 43.064 35.9191C43.7343 33.4197 42.7056 31.3068 41.9025 30.5468C40.5386 29.2005 39.3605 29.1776 39.3107 29.1743C38.7532 29.1579 38.4777 29.2005 38.3118 29.2267C37.6746 29.4593 36.772 29.9703 36.5065 30.5075C36.46 30.596 36.3406 30.8384 36.5696 31.4444C37.1171 32.8825 36.3771 34.4908 34.9202 35.0313C33.47 35.5751 31.8373 34.8446 31.2864 33.4033C30.3804 31.0186 30.8815 29.1514 31.4623 28.0049C32.9789 25.0207 36.4999 23.9397 36.8981 23.825C37.0806 23.7693 37.2731 23.7366 37.4623 23.7202C37.8505 23.6612 38.5342 23.5695 39.46 23.6055C41.5806 23.6317 43.9965 24.7389 45.8483 26.5701C48.0352 28.6338 49.7476 32.7809 48.533 37.2883C47.3483 42.1135 42.7952 46.1034 37.4822 46.9387C31.7676 47.9575 25.3329 45.1403 21.9347 40.0334C18.6593 35.431 18.032 28.696 20.4281 23.3533C23.0564 17.2014 28.0773 14.4171 29.5508 13.7095C36.6359 10.1717 44.2089 12.5073 44.5275 12.6056C46.5651 13.0871 52.2299 14.9838 56.6336 21.0013C60.0186 25.5284 62.763 33.9831 59.2752 42.8342C56.0894 51.5575 47.0197 58.1843 37.2399 58.8886C36.4733 58.9607 35.6968 59 34.9236 59C25.4325 59 15.8186 53.5295 10.9967 45.1305Z') new Path2D('M10.9967 45.1305C5.99892 36.9346 5.59074 25.9968 9.99448 17.3259C14.5575 8.00641 22.2367 3.87569 25.3229 2.53264C27.178 1.67111 29.1327 0.999586 31.2366 0.504948L33.3008 0.0594462C34.8174 -0.25175 36.3273 0.68839 36.6558 2.18868C36.9877 3.69225 36.022 5.17289 34.4988 5.50047L32.491 5.93286C30.8218 6.32595 29.2223 6.87628 27.6625 7.6035C25.6349 8.4814 18.9281 11.8783 15.0586 19.786C12.1217 25.5612 11.2456 34.7431 15.8683 42.3199C20.0564 49.6183 28.6315 54.0929 36.7654 53.3395C44.4578 52.7859 51.5164 47.6659 53.992 40.8851C56.5042 34.5072 54.835 27.9688 52.0772 24.2869C48.7553 19.75 44.6204 18.3545 42.9976 17.9647C42.7554 17.8926 37.074 16.186 32.0563 18.6985C29.8959 19.7336 27.1017 22.0627 25.605 25.5612C23.9889 29.1743 24.407 33.8193 26.5973 36.9051C28.8008 40.2136 32.9556 42.0873 36.5297 41.4518C40.0872 40.8917 42.4932 38.2449 43.064 35.9191C43.7343 33.4197 42.7056 31.3068 41.9025 30.5468C40.5386 29.2005 39.3605 29.1776 39.3107 29.1743C38.7532 29.1579 38.4777 29.2005 38.3118 29.2267C37.6746 29.4593 36.772 29.9703 36.5065 30.5075C36.46 30.596 36.3406 30.8384 36.5696 31.4444C37.1171 32.8825 36.3771 34.4908 34.9202 35.0313C33.47 35.5751 31.8373 34.8446 31.2864 33.4033C30.3804 31.0186 30.8815 29.1514 31.4623 28.0049C32.9789 25.0207 36.4999 23.9397 36.8981 23.825C37.0806 23.7693 37.2731 23.7366 37.4623 23.7202C37.8505 23.6612 38.5342 23.5695 39.46 23.6055C41.5806 23.6317 43.9965 24.7389 45.8483 26.5701C48.0352 28.6338 49.7476 32.7809 48.533 37.2883C47.3483 42.1135 42.7952 46.1034 37.4822 46.9387C31.7676 47.9575 25.3329 45.1403 21.9347 40.0334C18.6593 35.431 18.032 28.696 20.4281 23.3533C23.0564 17.2014 28.0773 14.4171 29.5508 13.7095C36.6359 10.1717 44.2089 12.5073 44.5275 12.6056C46.5651 13.0871 52.2299 14.9838 56.6336 21.0013C60.0186 25.5284 62.763 33.9831 59.2752 42.8342C56.0894 51.5575 47.0197 58.1843 37.2399 58.8886C36.4733 58.9607 35.6968 59 34.9236 59C25.4325 59 15.8186 53.5295 10.9967 45.1305Z')
]; ];
const OnboardingHeader = ({user, sectionText, secondary}) => { // eslint-disable-next-line no-unused-vars
const OnboardingHeader = ({user, section, secondary}) => {
const [showModal, setShowModal] = useState(false); const [showModal, setShowModal] = useState(false);
return ( return (
<div className="header"> <div className="header">
{/* Finish Later Modal */} {/* Finish Later Modal */}
@ -126,7 +77,11 @@ const OnboardingHeader = ({user, sectionText, secondary}) => {
</div> </div>
</Modal> </Modal>
<span> <span>
<span className="section">{sectionText}</span> <span className="section">
{/* TODO: The section prop was never actually visualised here (previously the prop name differed from the one passed).
Should it be visualised, or should it be removed from the guidelines entirely? */}
{null}
</span>
</span> </span>
<Button <Button
onClick={() => setShowModal(true)} onClick={() => setShowModal(true)}
@ -145,60 +100,10 @@ OnboardingHeader.propTypes = {
thumbnailUrl: PropTypes.string, thumbnailUrl: PropTypes.string,
username: PropTypes.string username: PropTypes.string
}), }),
sectionText: PropTypes.string, section: PropTypes.node,
secondary: PropTypes.bool secondary: PropTypes.bool
}; };
const OnboardingNavigation = ({currentPage, totalDots, onNextPage, onBackPage, nextButtonText}) => {
const dots = [];
if (currentPage && totalDots){
for (let i = 0; i < totalDots; i++){
// First two pages don't have dots
dots.push(<div className={`dot ${currentPage === i + 2 && 'active'}`} />);
}
}
return (
<div className="navigation">
<Button onClick={onBackPage}>
<img
className="left-arrow"
alt=""
src="/images/onboarding/left-arrow.svg"
/>
<span className="navText">
<FormattedMessage
id={'becomeAScratcher.buttons.back'}
/>
</span>
</Button>
{(currentPage && totalDots) &&
<div className="dotRow">
{dots}
</div>}
<Button onClick={onNextPage}>
<span className="navText">
{nextButtonText || <FormattedMessage id={'becomeAScratcher.buttons.next'} />}
</span>
<img
className="right-arrow"
alt=""
src="/images/onboarding/right-arrow.svg"
/>
</Button>
</div>
);
};
OnboardingNavigation.propTypes = {
currentPage: PropTypes.number,
totalDots: PropTypes.number,
onNextPage: PropTypes.func,
onBackPage: PropTypes.func,
nextButtonText: PropTypes.string
};
const BecomeAScratcher = ({user, invitedScratcher, scratcher, sessionStatus}) => { const BecomeAScratcher = ({user, invitedScratcher, scratcher, sessionStatus}) => {
const [currentPage, setCurrentPage] = useState(0); const [currentPage, setCurrentPage] = useState(0);
@ -231,8 +136,6 @@ const BecomeAScratcher = ({user, invitedScratcher, scratcher, sessionStatus}) =>
}); });
new Image().src = '/images/onboarding/community-guidelines.svg'; new Image().src = '/images/onboarding/community-guidelines.svg';
new Image().src = '/images/onboarding/create-a-project.svg'; new Image().src = '/images/onboarding/create-a-project.svg';
new Image().src = '/images/onboarding/right-arrow.svg';
new Image().src = '/images/onboarding/left-arrow.svg';
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -265,6 +168,10 @@ const BecomeAScratcher = ({user, invitedScratcher, scratcher, sessionStatus}) =>
setCurrentPage(Math.max(currentPage - 1, 0)); setCurrentPage(Math.max(currentPage - 1, 0));
}; };
const constructHeader = useCallback(guideline => (<OnboardingHeader
user={user}
section={(<FormattedMessage id={guideline?.section} />)}
/>), [user]);
if (sessionStatus === sessionActions.Status.FETCHED){ if (sessionStatus === sessionActions.Status.FETCHED){
// Not logged in // Not logged in
@ -386,51 +293,13 @@ const BecomeAScratcher = ({user, invitedScratcher, scratcher, sessionStatus}) =>
</div> </div>
); );
} else if (currentPage < 2 + communityGuidelines.length) { } else if (currentPage < 2 + communityGuidelines.length) {
const guideline = communityGuidelines[currentPage - 2]; return (<CommunityGuidelines
return ( currentPage={currentPage - 2}
<div className="onboarding col"> userId={`${user.id}`}
<OnboardingHeader constructHeader={constructHeader}
user={user} onNextPage={nextPage}
section={(<FormattedMessage id={guideline.section} />)} onBackPage={backPage}
/> />);
<div className="content">
{guideline.imageLeft && (
<div className="image-content">
<img
alt=""
src={`/images/onboarding/${guideline.image}`}
/>
</div>
)}
<div className="text-content">
<h1><FormattedMessage id={guideline.header} /></h1>
<div>
<FormattedMessage id={guideline.body} />
</div>
</div>
{!guideline.imageLeft && (
<div className="image-content">
<div className="image-inner-content">
<img
alt=""
src={`/images/onboarding/${guideline.image}`}
/>
{currentPage === 3 && <img
className="security-avatar"
src={thumbnailUrl(user.id, 100, 100)}
/>}
</div>
</div>
)}
</div>
<OnboardingNavigation
currentPage={currentPage}
totalDots={communityGuidelines.length}
onNextPage={nextPage}
onBackPage={backPage}
/>
</div>
);
} else if (currentPage === lastPage - 1) { } else if (currentPage === lastPage - 1) {
return (<div className="onboarding blue-background col"> return (<div className="onboarding blue-background col">
{ {

View file

@ -24,19 +24,6 @@ html,body{
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: .3rem; border-radius: .3rem;
.left-arrow{
padding-right: 4px;
@media #{$small} {
padding: 0px;
}
}
.right-arrow{
padding-left: 4px;
@media #{$small} {
padding: 0px;
}
}
} }
.no-invitation{ .no-invitation{
@ -229,45 +216,6 @@ html,body{
} }
} }
.navigation{
display: flex;
width: 100%;
justify-content: space-around;
align-items: center;
margin-bottom: 40px;
.dotRow{
display: flex;
justify-content: space-between;
width: 244px;
min-width: 0px;
padding: 0px 5px;
}
.dot{
width: 20px;
height: 20px;
border-radius: 100%;
background-color: #d9d9d9;
border: none;
display: flex;
justify-content: center;
align-items: center;
}
.active{
border: solid 2px #4280d9;
background-color: #4c97fe;
margin-top: -2px;
}
.navText{
@media #{$small} {
display: none;
}
}
}
.onboarding { .onboarding {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -334,10 +282,6 @@ html,body{
} }
} }
.image-inner-content{
position: relative;
}
.image-content-1{ .image-content-1{
display: flex; display: flex;
flex: 4; flex: 4;
@ -363,21 +307,6 @@ html,body{
} }
} }
.text-content{
flex: 8;
display: flex;
justify-content: center;
align-items: flex-start;
flex-direction: column;
padding: 40px;
@media #{$medium-and-smaller} {
flex: 12;
order: 2;
padding-top: 0px;
justify-content: flex-start;
}
}
.opening-text-content{ .opening-text-content{
flex: 6; flex: 6;
display: flex; display: flex;
@ -456,18 +385,3 @@ html,body{
left: -18px; left: -18px;
right: 0; right: 0;
} }
.security-avatar{
position: absolute;
border-radius: 100%;
width: 65px;
height: 65px;
top: 172px;
left: 149px;
@media #{$medium-and-smaller} {
width: 60px !important;
height: 60px !important;
top: 140.5px;
left: 121.5px;
}
}

View file

@ -8,7 +8,6 @@
"becomeAScratcher.buttons.iAgree": "I Agree", "becomeAScratcher.buttons.iAgree": "I Agree",
"becomeAScratcher.buttons.takeMeBack": "Take me back to Scratch", "becomeAScratcher.buttons.takeMeBack": "Take me back to Scratch",
"becomeAScratcher.buttons.backToProfile": "Back to Profile Page", "becomeAScratcher.buttons.backToProfile": "Back to Profile Page",
"becomeAScratcher.buttons.finishLater": "Finish Later",
"becomeAScratcher.congratulations.header": "Congratulations, {username}! You have shown that you are ready to become a Scratcher.", "becomeAScratcher.congratulations.header": "Congratulations, {username}! You have shown that you are ready to become a Scratcher.",
"becomeAScratcher.congratulations.body": "Scratch is a friendly and welcoming community for everyone, where people create, share, and learn together. We welcome people of all ages, races, ethnicities, religions, abilities, sexual orientations, and gender identities.", "becomeAScratcher.congratulations.body": "Scratch is a friendly and welcoming community for everyone, where people create, share, and learn together. We welcome people of all ages, races, ethnicities, religions, abilities, sexual orientations, and gender identities.",
"becomeAScratcher.toBeAScratcher.header": "What does it mean to be a Scratcher?", "becomeAScratcher.toBeAScratcher.header": "What does it mean to be a Scratcher?",
@ -18,30 +17,6 @@
"becomeAScratcher.toBeAScratcher.createStudios": "Create studios", "becomeAScratcher.toBeAScratcher.createStudios": "Create studios",
"becomeAScratcher.toBeAScratcher.helpOut": "Help out in the community", "becomeAScratcher.toBeAScratcher.helpOut": "Help out in the community",
"becomeAScratcher.toBeAScratcher.communityGuidelines": "Next, we will take you through the community guidelines and explain what these are.", "becomeAScratcher.toBeAScratcher.communityGuidelines": "Next, we will take you through the community guidelines and explain what these are.",
"becomeAScratcher.guidelines.respectSection": "Become a Scratcher - Treat everyone with respect",
"becomeAScratcher.guidelines.respectHeader": "Scratchers treat everyone with respect.",
"becomeAScratcher.guidelines.respectBody": "Everyone on Scratch is encouraged to share things that excite them and are important to them—we hope that you find ways to celebrate your own identity on Scratch, and allow others to do the same.",
"becomeAScratcher.guidelines.safeSection": "Become a Scratcher - Be safe",
"becomeAScratcher.guidelines.safeHeader": "Scratchers are safe: we keep personal and contact information private.",
"becomeAScratcher.guidelines.safeBody": "This includes not sharing real last names, phone numbers, addresses, hometowns, school names, email addresses, usernames or links to social media sites, video chatting applications, or websites with private chat functionality.",
"becomeAScratcher.guidelines.feedbackSection": "Become a Scratcher - Give helpful feedback",
"becomeAScratcher.guidelines.feedbackHeader": "Scratchers give helpful feedback.",
"becomeAScratcher.guidelines.feedbackBody": "When commenting on a project, remember to say something you like about it, offer suggestions, and be kind, not critical.",
"becomeAScratcher.guidelines.remix1Section": "Become a Scratcher - Embrace remix culture",
"becomeAScratcher.guidelines.remix1Header": "Scratchers embrace remix culture.",
"becomeAScratcher.guidelines.remix1Body": "Remixing is when you build upon someone elses projects, code, ideas, images, or anything else they share on Scratch to make your own unique creation.",
"becomeAScratcher.guidelines.remix2Section": "Become a Scratcher - Embrace remix culture",
"becomeAScratcher.guidelines.remix2Header": "Remixing is a great way to collaborate and connect with other Scratchers.",
"becomeAScratcher.guidelines.remix2Body": "You are encouraged to use anything you find on Scratch in your own creations, as long as you provide credit to everyone whose work you used and make a meaningful change to it. ",
"becomeAScratcher.guidelines.remix3Section": "Become a Scratcher - Embrace remix culture",
"becomeAScratcher.guidelines.remix3Header": "Remixing means sharing with others.",
"becomeAScratcher.guidelines.remix3Body": "When you share something on Scratch, you are giving permission to all Scratchers to use your work in their creations, too.",
"becomeAScratcher.guidelines.honestSection": "Become a Scratcher - Be honest",
"becomeAScratcher.guidelines.honestHeader": "Scratchers are honest.",
"becomeAScratcher.guidelines.honestBody": "Its important to be honest and authentic when interacting with others on Scratch, and remember that there is a person behind every Scratch account.",
"becomeAScratcher.guidelines.friendlySection": "Become a Scratcher - Keep the site friendly",
"becomeAScratcher.guidelines.friendlyHeader": "Scratchers help keep the site friendly.",
"becomeAScratcher.guidelines.friendlyBody": "Its important to keep your creations and conversations friendly and appropriate for all ages. If you think something on Scratch is mean, insulting, too violent, or otherwise disruptive to the community, click “Report” to let us know about it.",
"becomeAScratcher.invitation.header": "{username}, we invite you to become a Scratcher.", "becomeAScratcher.invitation.header": "{username}, we invite you to become a Scratcher.",
"becomeAScratcher.invitation.body": "Scratch is a friendly and welcoming community for everyone. If you agree to be respectful, be safe, give helpful feedback, embrace remix culture, be honest, and help keep the site friendly, click “I agree!”", "becomeAScratcher.invitation.body": "Scratch is a friendly and welcoming community for everyone. If you agree to be respectful, be safe, give helpful feedback, embrace remix culture, be honest, and help keep the site friendly, click “I agree!”",
"becomeAScratcher.invitation.finishLater": "You get to decide if you want to become a Scratcher. If you do not want to be a Scratcher yet, just click “Finish Later” above.", "becomeAScratcher.invitation.finishLater": "You get to decide if you want to become a Scratcher. If you do not want to be a Scratcher yet, just click “Finish Later” above.",
@ -54,6 +29,31 @@
"becomeAScratcher.noInvitation.body": "To become a Scratcher, you must be active on Scratch for a while, share several projects, and comment constructively in the community. After a few weeks, you will receive a notification inviting you to become a Scratcher. Scratch on!", "becomeAScratcher.noInvitation.body": "To become a Scratcher, you must be active on Scratch for a while, share several projects, and comment constructively in the community. After a few weeks, you will receive a notification inviting you to become a Scratcher. Scratch on!",
"becomeAScratcher.finishLater.header": "No worries, take your time!", "becomeAScratcher.finishLater.header": "No worries, take your time!",
"becomeAScratcher.finishLater.body": "By leaving this page, you will not finish the process to become a Scratcher and will stay as a New Scratcher. If you change your mind later, you can always come back via your profile page.", "becomeAScratcher.finishLater.body": "By leaving this page, you will not finish the process to become a Scratcher and will stay as a New Scratcher. If you change your mind later, you can always come back via your profile page.",
"becomeAScratcher.finishLater.clickBecomeAScratcher": "Just click on “★ Become a Scratcher!” below your username." "becomeAScratcher.finishLater.clickBecomeAScratcher": "Just click on “★ Become a Scratcher!” below your username.",
"communityGuidelines.guidelines.respectSection": "Become a Scratcher - Treat everyone with respect",
"communityGuidelines.guidelines.respectHeader": "Scratchers treat everyone with respect.",
"communityGuidelines.guidelines.respectBody": "Everyone on Scratch is encouraged to share things that excite them and are important to them—we hope that you find ways to celebrate your own identity on Scratch, and allow others to do the same.",
"communityGuidelines.guidelines.safeSection": "Become a Scratcher - Be safe",
"communityGuidelines.guidelines.safeHeader": "Scratchers are safe: we keep personal and contact information private.",
"communityGuidelines.guidelines.safeBody": "This includes not sharing real last names, phone numbers, addresses, hometowns, school names, email addresses, usernames or links to social media sites, video chatting applications, or websites with private chat functionality.",
"communityGuidelines.guidelines.feedbackSection": "Become a Scratcher - Give helpful feedback",
"communityGuidelines.guidelines.feedbackHeader": "Scratchers give helpful feedback.",
"communityGuidelines.guidelines.feedbackBody": "When commenting on a project, remember to say something you like about it, offer suggestions, and be kind, not critical.",
"communityGuidelines.guidelines.remix1Section": "Become a Scratcher - Embrace remix culture",
"communityGuidelines.guidelines.remix1Header": "Scratchers embrace remix culture.",
"communityGuidelines.guidelines.remix1Body": "Remixing is when you build upon someone elses projects, code, ideas, images, or anything else they share on Scratch to make your own unique creation.",
"communityGuidelines.guidelines.remix2Section": "Become a Scratcher - Embrace remix culture",
"communityGuidelines.guidelines.remix2Header": "Remixing is a great way to collaborate and connect with other Scratchers.",
"communityGuidelines.guidelines.remix2Body": "You are encouraged to use anything you find on Scratch in your own creations, as long as you provide credit to everyone whose work you used and make a meaningful change to it. ",
"communityGuidelines.guidelines.remix3Section": "Become a Scratcher - Embrace remix culture",
"communityGuidelines.guidelines.remix3Header": "Remixing means sharing with others.",
"communityGuidelines.guidelines.remix3Body": "When you share something on Scratch, you are giving permission to all Scratchers to use your work in their creations, too.",
"communityGuidelines.guidelines.honestSection": "Become a Scratcher - Be honest",
"communityGuidelines.guidelines.honestHeader": "Scratchers are honest.",
"communityGuidelines.guidelines.honestBody": "Its important to be honest and authentic when interacting with others on Scratch, and remember that there is a person behind every Scratch account.",
"communityGuidelines.guidelines.friendlySection": "Become a Scratcher - Keep the site friendly",
"communityGuidelines.guidelines.friendlyHeader": "Scratchers help keep the site friendly.",
"communityGuidelines.guidelines.friendlyBody": "Its important to keep your creations and conversations friendly and appropriate for all ages. If you think something on Scratch is mean, insulting, too violent, or otherwise disruptive to the community, click “Report” to let us know about it."
} }

View file

@ -16,7 +16,6 @@ const Register = () => (
src="/images/logo_sm.png" src="/images/logo_sm.png"
/> />
</a> </a>
</nav> </nav>
<Scratch3Registration <Scratch3Registration
createProjectOnComplete createProjectOnComplete

View file

@ -1,5 +1,6 @@
{ {
"parents.title": "For Parents", "parents.title": "For Parents",
"parents.emailConfirmedTitle": "Your child's account has been confirmed",
"parents.intro": "Scratch is a programming language and an online community where children\n can program and share interactive media such as stories, games, and \nanimation with people from all over the world. As children create with \nScratch, they learn to think creatively, work collaboratively, and \nreason systematically. Scratch is designed, developed, and moderated by the {scratchFoundation}, a nonprofit organization. ", "parents.intro": "Scratch is a programming language and an online community where children\n can program and share interactive media such as stories, games, and \nanimation with people from all over the world. As children create with \nScratch, they learn to think creatively, work collaboratively, and \nreason systematically. Scratch is designed, developed, and moderated by the {scratchFoundation}, a nonprofit organization. ",
"parents.scratchFoundationLinkText": "Scratch Foundation", "parents.scratchFoundationLinkText": "Scratch Foundation",
"parents.overview": "How it works", "parents.overview": "How it works",

View file

@ -10,12 +10,24 @@ const render = require('../../lib/render.jsx');
require('./parents.scss'); require('./parents.scss');
const Landing = () => ( const Landing = () => {
<div className="parents"> const isParentConfirmingChildEmail = React.useMemo(() => {
const query = window.location.search;
return query.indexOf('from_confirmation=true') >= 0;
}, [window.location.search]);
return (<div className="parents">
<TitleBanner className="masthead"> <TitleBanner className="masthead">
<div className="inner"> <div className="inner">
<h1 className="title-banner-h1"> <h1 className="title-banner-h1">
<FormattedMessage id="parents.title" /> <FormattedMessage
id={
isParentConfirmingChildEmail ?
'parents.emailConfirmedTitle' :
'parents.title'
}
/>
</h1> </h1>
<FlexRow className="masthead-info"> <FlexRow className="masthead-info">
<p className="title-banner-p intro"> <p className="title-banner-p intro">
@ -266,7 +278,7 @@ const Landing = () => (
</section> </section>
</div> </div>
</TitleBanner> </TitleBanner>
</div> </div>);
); };
render(<Page><Landing /></Page>, document.getElementById('app')); render(<Page><Landing /></Page>, document.getElementById('app'));

View file

@ -147,6 +147,7 @@ const PreviewPresentation = ({
socialOpen, socialOpen,
user, user,
userOwnsProject, userOwnsProject,
userUsesParentEmail,
visibilityInfo visibilityInfo
}) => { }) => {
const [canViewProjectJourney, setCanViewProjectJourney] = useState(false); const [canViewProjectJourney, setCanViewProjectJourney] = useState(false);
@ -275,6 +276,7 @@ const PreviewPresentation = ({
/> />
} }
{showEmailConfirmationBanner && <EmailConfirmationBanner {showEmailConfirmationBanner && <EmailConfirmationBanner
userUsesParentEmail={userUsesParentEmail}
/* eslint-disable react/jsx-no-bind */ /* eslint-disable react/jsx-no-bind */
onRequestDismiss={() => onBannerDismiss('confirmed_email')} onRequestDismiss={() => onBannerDismiss('confirmed_email')}
/* eslint-enable react/jsx-no-bind */ /* eslint-enable react/jsx-no-bind */
@ -839,6 +841,7 @@ PreviewPresentation.propTypes = {
id: PropTypes.number id: PropTypes.number
}), }),
userOwnsProject: PropTypes.bool, userOwnsProject: PropTypes.bool,
userUsesParentEmail: PropTypes.bool,
visibilityInfo: PropTypes.shape({ visibilityInfo: PropTypes.shape({
censored: PropTypes.bool, censored: PropTypes.bool,
censoredByAdmin: PropTypes.bool, censoredByAdmin: PropTypes.bool,

View file

@ -878,6 +878,7 @@ class Preview extends React.Component {
socialOpen={this.state.socialOpen} socialOpen={this.state.socialOpen}
user={this.props.user} user={this.props.user}
userOwnsProject={this.props.userOwnsProject} userOwnsProject={this.props.userOwnsProject}
userUsesParentEmail={this.props.userUsesParentEmail}
visibilityInfo={this.props.visibilityInfo} visibilityInfo={this.props.visibilityInfo}
onAddComment={this.handleAddComment} onAddComment={this.handleAddComment}
onAddToStudioClicked={this.handleAddToStudioClick} onAddToStudioClicked={this.handleAddToStudioClick}
@ -1071,6 +1072,7 @@ Preview.propTypes = {
classroomId: PropTypes.string classroomId: PropTypes.string
}), }),
userOwnsProject: PropTypes.bool, userOwnsProject: PropTypes.bool,
userUsesParentEmail: PropTypes.bool,
userPresent: PropTypes.bool, userPresent: PropTypes.bool,
visibilityInfo: PropTypes.shape({ visibilityInfo: PropTypes.shape({
censored: PropTypes.bool, censored: PropTypes.bool,
@ -1117,6 +1119,7 @@ const mapStateToProps = state => {
state.session.session.flags.has_outstanding_email_confirmation && state.session.session.flags.has_outstanding_email_confirmation &&
state.session.session.flags.confirm_email_banner; state.session.session.flags.confirm_email_banner;
const isTotallyNormal = state.session.session.flags && selectIsTotallyNormal(state); const isTotallyNormal = state.session.session.flags && selectIsTotallyNormal(state);
const userUsesParentEmail = state.session.session.flags && state.session.session.flags.with_parent_email;
// if we don't have projectInfo, assume it's shared until we know otherwise // if we don't have projectInfo, assume it's shared until we know otherwise
const isShared = !projectInfoPresent || state.preview.projectInfo.is_published; const isShared = !projectInfoPresent || state.preview.projectInfo.is_published;
@ -1169,6 +1172,7 @@ const mapStateToProps = state => {
useScratch3Registration: state.navigation.useScratch3Registration, useScratch3Registration: state.navigation.useScratch3Registration,
user: state.session.session.user, user: state.session.session.user,
userOwnsProject: userOwnsProject, userOwnsProject: userOwnsProject,
userUsesParentEmail: userUsesParentEmail,
userPresent: userPresent, userPresent: userPresent,
visibilityInfo: state.preview.visibilityInfo visibilityInfo: state.preview.visibilityInfo
}; };

View file

@ -357,6 +357,7 @@ class SplashPresentation extends React.Component { // eslint-disable-line react/
<div className="splash"> <div className="splash">
{(this.props.shouldShowEmailConfirmation && {(this.props.shouldShowEmailConfirmation &&
<EmailConfirmationBanner <EmailConfirmationBanner
userUsesParentEmail={this.props.userUsesParentEmail}
onRequestDismiss={() => { // eslint-disable-line react/jsx-no-bind onRequestDismiss={() => { // eslint-disable-line react/jsx-no-bind
this.props.onDismiss('confirmed_email'); this.props.onDismiss('confirmed_email');
}} }}
@ -553,7 +554,8 @@ SplashPresentation.propTypes = {
shouldShowHOCTopBanner: PropTypes.bool.isRequired, shouldShowHOCTopBanner: PropTypes.bool.isRequired,
shouldShowIntro: PropTypes.bool.isRequired, shouldShowIntro: PropTypes.bool.isRequired,
shouldShowWelcome: PropTypes.bool.isRequired, shouldShowWelcome: PropTypes.bool.isRequired,
user: PropTypes.object.isRequired // eslint-disable-line react/forbid-prop-types user: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
userUsesParentEmail: PropTypes.bool
}; };
SplashPresentation.defaultProps = { SplashPresentation.defaultProps = {

View file

@ -8,9 +8,14 @@ const log = require('../../lib/log');
const render = require('../../lib/render.jsx'); const render = require('../../lib/render.jsx');
const sessionActions = require('../../redux/session.js'); const sessionActions = require('../../redux/session.js');
const splashActions = require('../../redux/splash.js'); const splashActions = require('../../redux/splash.js');
const navigationActions = require('../../redux/navigation.js');
const Page = require('../../components/page/www/page.jsx'); const Page = require('../../components/page/www/page.jsx');
const SplashPresentation = require('./presentation.jsx'); const SplashPresentation = require('./presentation.jsx');
const {injectIntl} = require('react-intl');
const {
CommunityGuidelinesModal
} = require('../../components/community-guidelines/community-guidelines-modal.jsx');
const SCRATCH_WEEK_START_TIME = 1621224000000; // 2021-05-17 00:00:00 -- No end time for now const SCRATCH_WEEK_START_TIME = 1621224000000; // 2021-05-17 00:00:00 -- No end time for now
// const HOC_START_TIME = 1638144000000; // 2021-11-29 00:00:00 GMT in ms // const HOC_START_TIME = 1638144000000; // 2021-11-29 00:00:00 GMT in ms
@ -29,6 +34,7 @@ class Splash extends React.Component {
'getNews', 'getNews',
'handleRefreshHomepageCache', 'handleRefreshHomepageCache',
'getHomepageRefreshStatus', 'getHomepageRefreshStatus',
'handleCommunityGuidelinesReview',
'handleCloseAdminPanel', 'handleCloseAdminPanel',
'handleCloseDonateBanner', 'handleCloseDonateBanner',
'handleOpenAdminPanel', 'handleOpenAdminPanel',
@ -137,6 +143,9 @@ class Splash extends React.Component {
if (!err) this.props.refreshSession(); if (!err) this.props.refreshSession();
}); });
} }
handleCommunityGuidelinesReview () {
this.props.reviewCommunityGuidelines();
}
shouldShowWelcome () { shouldShowWelcome () {
if (!this.props.user || !this.props.flags.show_welcome) return false; if (!this.props.user || !this.props.flags.show_welcome) return false;
return ( return (
@ -190,8 +199,16 @@ class Splash extends React.Component {
const showIntro = this.shouldShowIntro() || false; const showIntro = this.shouldShowIntro() || false;
const showWelcome = this.shouldShowWelcome(); const showWelcome = this.shouldShowWelcome();
const homepageRefreshStatus = this.getHomepageRefreshStatus(); const homepageRefreshStatus = this.getHomepageRefreshStatus();
const userUsesParentEmail = this.props.flags && this.props.flags.with_parent_email;
return ( const shouldReviewCommunityGuidelines = this.props.shouldReviewCommunityGuidelines;
return (<>
<CommunityGuidelinesModal
isOpen={shouldReviewCommunityGuidelines && this.props.user.id}
userId={`${this.props.user.id}`}
onComplete={this.handleCommunityGuidelinesReview}
/>
<SplashPresentation <SplashPresentation
activity={this.props.activity} activity={this.props.activity}
adminPanelOpen={this.state.adminPanelOpen} adminPanelOpen={this.state.adminPanelOpen}
@ -212,12 +229,13 @@ class Splash extends React.Component {
shouldShowIntro={showIntro} shouldShowIntro={showIntro}
shouldShowWelcome={showWelcome} shouldShowWelcome={showWelcome}
user={this.props.user} user={this.props.user}
userUsesParentEmail={userUsesParentEmail}
onCloseDonateBanner={this.handleCloseDonateBanner} onCloseDonateBanner={this.handleCloseDonateBanner}
onCloseAdminPanel={this.handleCloseAdminPanel} onCloseAdminPanel={this.handleCloseAdminPanel}
onDismiss={this.handleDismiss} onDismiss={this.handleDismiss}
onOpenAdminPanel={this.handleOpenAdminPanel} onOpenAdminPanel={this.handleOpenAdminPanel}
onRefreshHomepageCache={this.handleRefreshHomepageCache} onRefreshHomepageCache={this.handleRefreshHomepageCache}
/> /></>
); );
} }
} }
@ -238,7 +256,8 @@ Splash.propTypes = {
has_outstanding_email_confirmation: PropTypes.bool, has_outstanding_email_confirmation: PropTypes.bool,
show_welcome: PropTypes.bool, show_welcome: PropTypes.bool,
confirm_email_banner: PropTypes.bool, confirm_email_banner: PropTypes.bool,
unsupported_browser_banner: PropTypes.bool unsupported_browser_banner: PropTypes.bool,
with_parent_email: PropTypes.bool
}), }),
getActivity: PropTypes.func.isRequired, getActivity: PropTypes.func.isRequired,
getFeaturedGlobal: PropTypes.func.isRequired, getFeaturedGlobal: PropTypes.func.isRequired,
@ -249,9 +268,11 @@ Splash.propTypes = {
isEducator: PropTypes.bool, isEducator: PropTypes.bool,
loved: PropTypes.arrayOf(PropTypes.object).isRequired, loved: PropTypes.arrayOf(PropTypes.object).isRequired,
refreshSession: PropTypes.func.isRequired, refreshSession: PropTypes.func.isRequired,
reviewCommunityGuidelines: PropTypes.func.isRequired,
sessionStatus: PropTypes.string, sessionStatus: PropTypes.string,
setRows: PropTypes.func.isRequired, setRows: PropTypes.func.isRequired,
shared: PropTypes.arrayOf(PropTypes.object).isRequired, shared: PropTypes.arrayOf(PropTypes.object).isRequired,
shouldReviewCommunityGuidelines: PropTypes.bool.isRequired,
studios: PropTypes.arrayOf(PropTypes.object).isRequired, studios: PropTypes.arrayOf(PropTypes.object).isRequired,
user: PropTypes.shape({ user: PropTypes.shape({
id: PropTypes.number, id: PropTypes.number,
@ -284,7 +305,8 @@ const mapStateToProps = state => ({
sessionStatus: state.session.status, sessionStatus: state.session.status,
shared: state.splash.shared.rows, shared: state.splash.shared.rows,
studios: state.splash.studios.rows, studios: state.splash.studios.rows,
user: state.session.session.user user: state.session.session.user,
shouldReviewCommunityGuidelines: state.navigation.shouldReviewCommunityGuidelines
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
@ -308,19 +330,22 @@ const mapDispatchToProps = dispatch => ({
}, },
setRows: (type, rows) => { setRows: (type, rows) => {
dispatch(splashActions.setRows(type, rows)); dispatch(splashActions.setRows(type, rows));
},
reviewCommunityGuidelines: () => {
dispatch(navigationActions.reviewCommunityGuidelines());
} }
}); });
const ConnectedSplash = connect( const IntlConnectedSplash = injectIntl(connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(Splash); )(Splash));
render( render(
<Page <Page
showDonorRecognition showDonorRecognition
> >
<ConnectedSplash /> <IntlConnectedSplash />
</Page>, </Page>,
document.getElementById('app'), document.getElementById('app'),
{splash: splashActions.splashReducer} {splash: splashActions.splashReducer}