Merge pull request #3807 from picklesrus/student-username-update

Change up the messaging in student registration.
This commit is contained in:
picklesrus 2020-04-21 14:28:09 -04:00 committed by GitHub
commit 01afd414cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 3 deletions

View file

@ -28,6 +28,7 @@ const Spinner = require('../../components/spinner/spinner.jsx');
const StepNavigation = require('../../components/stepnavigation/stepnavigation.jsx'); const StepNavigation = require('../../components/stepnavigation/stepnavigation.jsx');
const TextArea = require('../../components/forms/textarea.jsx'); const TextArea = require('../../components/forms/textarea.jsx');
const Tooltip = require('../../components/tooltip/tooltip.jsx'); const Tooltip = require('../../components/tooltip/tooltip.jsx');
const ValidationMessage = require('../../components/forms/validation-message.jsx');
require('./steps.scss'); require('./steps.scss');
@ -84,11 +85,13 @@ class UsernameStep extends React.Component {
'handleChangeShowPassword', 'handleChangeShowPassword',
'handleUsernameBlur', 'handleUsernameBlur',
'handleValidSubmit', 'handleValidSubmit',
'validateUsername' 'validateUsername',
'handleFocus'
]); ]);
this.state = { this.state = {
showPassword: props.showPassword, showPassword: props.showPassword,
waiting: false, waiting: false,
showUsernameTip: true,
validUsername: '' validUsername: ''
}; };
} }
@ -159,6 +162,9 @@ class UsernameStep extends React.Component {
if (isValid) return this.props.onNextStep(formData); if (isValid) return this.props.onNextStep(formData);
}); });
} }
handleFocus () {
this.setState({showUsernameTip: false});
}
render () { render () {
return ( return (
<Slide className="registration-step username-step"> <Slide className="registration-step username-step">
@ -205,6 +211,13 @@ class UsernameStep extends React.Component {
null null
)} )}
</label> </label>
{ this.state.showUsernameTip &&
<ValidationMessage
className={'validation-full-width-input'}
message={this.props.intl.formatMessage({id: 'registration.usernameAdviceShort'})}
mode="info"
/>
}
<Input <Input
required required
className={this.state.validUsername} className={this.state.validUsername}
@ -227,6 +240,7 @@ class UsernameStep extends React.Component {
maxLength: 20 maxLength: 20
}} }}
onBlur={this.handleUsernameBlur} onBlur={this.handleUsernameBlur}
onFocus={this.handleFocus}
/> />
</div> </div>
<Input <Input
@ -253,6 +267,7 @@ class UsernameStep extends React.Component {
notEqualsField: 'user.username' notEqualsField: 'user.username'
}} }}
/> />
<Checkbox <Checkbox
help={null} help={null}
name="showPassword" name="showPassword"

View file

@ -57,6 +57,10 @@
.username-label { .username-label {
margin-bottom: .75rem; margin-bottom: .75rem;
} }
.validation-info {
top:auto;
left:auto;
}
} }
&.demographics-step { &.demographics-step {

View file

@ -218,7 +218,7 @@
"registration.studentUsernameStepDescription": "You can make games, animations, and stories using Scratch. Setting up an account is easy and it's free. Fill in the form below to get started.", "registration.studentUsernameStepDescription": "You can make games, animations, and stories using Scratch. Setting up an account is easy and it's free. Fill in the form below to get started.",
"registration.studentUsernameStepHelpText": "Already have a Scratch account?", "registration.studentUsernameStepHelpText": "Already have a Scratch account?",
"registration.studentUsernameStepTooltip": "You'll need to create a new Scratch account to join this class.", "registration.studentUsernameStepTooltip": "You'll need to create a new Scratch account to join this class.",
"registration.studentUsernameFieldHelpText": "For safety, don't use your real name!", "registration.studentUsernameSuggestion": "Try your favorite food, hobby, or animal along with some numbers",
"registration.acceptTermsOfUse": "By creating an account, you acknowledge the {privacyPolicyLink} and you accept and agree to the {touLink}.", "registration.acceptTermsOfUse": "By creating an account, you acknowledge the {privacyPolicyLink} and you accept and agree to the {touLink}.",
"registration.usernameStepTitle": "Request a Teacher Account", "registration.usernameStepTitle": "Request a Teacher Account",
"registration.usernameStepTitleScratcher": "Create a Scratch Account", "registration.usernameStepTitleScratcher": "Create a Scratch Account",

View file

@ -126,7 +126,7 @@ class StudentRegistration extends React.Component {
id: 'registration.studentUsernameStepTooltip' id: 'registration.studentUsernameStepTooltip'
})} })}
usernameHelp={this.props.intl.formatMessage({ usernameHelp={this.props.intl.formatMessage({
id: 'registration.studentUsernameFieldHelpText' id: 'registration.studentUsernameSuggestion'
})} })}
waiting={this.state.waiting} waiting={this.state.waiting}
onNextStep={this.handleAdvanceStep} onNextStep={this.handleAdvanceStep}