Under 13 -> under 16

This commit is contained in:
Georgi Angelov 2024-10-22 15:56:17 +03:00
parent 5b35c81f72
commit f4ea98d724
4 changed files with 20 additions and 20 deletions

View file

@ -98,12 +98,12 @@ class EmailStep extends React.Component {
this.captchaRef = ref; this.captchaRef = ref;
} }
render () { render () {
const title = this.props.under13 ? const title = this.props.under16 ?
this.props.intl.formatMessage({id: 'registration.under13.emailStepTitle'}) : this.props.intl.formatMessage({id: 'registration.under16.emailStepTitle'}) :
this.props.intl.formatMessage({id: 'registration.emailStepTitle'}); this.props.intl.formatMessage({id: 'registration.emailStepTitle'});
const description = this.props.under13 ? const description = this.props.under16 ?
this.props.intl.formatMessage({id: 'registration.under13.emailStepDescription'}) : this.props.intl.formatMessage({id: 'registration.under16.emailStepDescription'}) :
null; null;
return ( return (
@ -215,7 +215,7 @@ EmailStep.propTypes = {
onNextStep: PropTypes.func, onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func.isRequired, sendAnalytics: PropTypes.func.isRequired,
waiting: PropTypes.bool, waiting: PropTypes.bool,
under13: 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.isUnder13()); 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, isUnder13) { handleSubmitRegistration (formData, isUnder16) {
this.setState({ this.setState({
registrationError: null, // clear any existing error registrationError: null, // clear any existing error
waiting: true waiting: true
@ -191,7 +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_13': isUnder13, '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,
@ -214,7 +214,7 @@ class JoinFlow extends React.Component {
} }
handleErrorNext () { handleErrorNext () {
if (this.canTryAgain()) { if (this.canTryAgain()) {
this.handleSubmitRegistration(this.state.formData, this.isUnder13()); this.handleSubmitRegistration(this.state.formData, this.isUnder16());
} else { } else {
this.resetState(); this.resetState();
} }
@ -237,7 +237,7 @@ class JoinFlow extends React.Component {
} }
} }
isUnder13 () { isUnder16 () {
const birthYear = this.parseDateComponent(this.state.formData.birth_year); const birthYear = this.parseDateComponent(this.state.formData.birth_year);
const birthMonth = this.parseDateComponent(this.state.formData.birth_month); const birthMonth = this.parseDateComponent(this.state.formData.birth_month);
@ -249,11 +249,11 @@ class JoinFlow extends React.Component {
const now = new Date(); const now = new Date();
const yearDiff = now.getFullYear() - birthYear; const yearDiff = now.getFullYear() - birthYear;
if (yearDiff > 13) { if (yearDiff > 16) {
return false; return false;
} }
if (yearDiff < 13) { if (yearDiff < 16) {
return true; return true;
} }
@ -298,7 +298,7 @@ class JoinFlow extends React.Component {
<EmailStep <EmailStep
sendAnalytics={this.sendAnalytics} sendAnalytics={this.sendAnalytics}
waiting={this.state.waiting} waiting={this.state.waiting}
under13={this.isUnder13()} under16={this.isUnder16()}
onCaptchaError={this.handleCaptchaError} onCaptchaError={this.handleCaptchaError}
onNextStep={this.handlePrepareToRegister} onNextStep={this.handlePrepareToRegister}
/> />
@ -307,7 +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}
under13={this.isUnder13()} under16={this.isUnder16()}
onNextStep={this.props.onCompleteRegistration} onNextStep={this.props.onCompleteRegistration}
/> />
</Progression> </Progression>

View file

@ -76,8 +76,8 @@ class WelcomeStep extends React.Component {
<div className="join-flow-instructions"> <div className="join-flow-instructions">
<FormattedMessage <FormattedMessage
id={ id={
this.props.under13 ? this.props.under16 ?
'registration.under13.welcomeStepInstructions' : 'registration.under16.welcomeStepInstructions' :
'registration.welcomeStepInstructions' 'registration.welcomeStepInstructions'
} }
values={{ values={{
@ -100,7 +100,7 @@ WelcomeStep.propTypes = {
onNextStep: PropTypes.func, onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func, sendAnalytics: PropTypes.func,
username: PropTypes.string, username: PropTypes.string,
under13: PropTypes.bool under16: PropTypes.bool
}; };
module.exports = injectIntl(WelcomeStep); module.exports = injectIntl(WelcomeStep);

View file

@ -209,8 +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.under13.emailStepTitle": "What's your parent's email address?", "registration.under16.emailStepTitle": "What's your parent's email address?",
"registration.under13.emailStepDescription": "We'll send them a link to verify your account.", "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",
@ -264,7 +264,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.under13.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.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}!",