mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
refactor: remove extra variables definations (#51512)
This commit is contained in:
@@ -205,7 +205,6 @@ class AboutSettings extends Component<AboutProps, AboutState> {
|
||||
toggleSoundMode,
|
||||
toggleKeyboardShortcuts
|
||||
} = this.props;
|
||||
const ariaLabel = t('settings.headings.personal-info');
|
||||
return (
|
||||
<>
|
||||
<UsernameSettings username={username} />
|
||||
@@ -213,7 +212,7 @@ class AboutSettings extends Component<AboutProps, AboutState> {
|
||||
<SectionHeader>{t('settings.headings.personal-info')}</SectionHeader>
|
||||
<FullWidthRow>
|
||||
<form id='camper-identity' onSubmit={this.handleSubmit}>
|
||||
<div role='group' aria-label={ariaLabel}>
|
||||
<div role='group' aria-label={t('settings.headings.personal-info')}>
|
||||
<FormGroup controlId='about-name'>
|
||||
<ControlLabel>
|
||||
<strong>{t('settings.labels.name')}</strong>
|
||||
|
||||
@@ -137,7 +137,6 @@ function EmailSettings({
|
||||
newEmailValidation !== 'success' ||
|
||||
confirmEmailValidation !== 'success' ||
|
||||
isPristine;
|
||||
const ariaLabel = t('settings.email.heading');
|
||||
if (!currentEmail) {
|
||||
return (
|
||||
<div>
|
||||
@@ -185,7 +184,7 @@ function EmailSettings({
|
||||
<ControlLabel>{t('settings.email.current')}</ControlLabel>
|
||||
<FormControl.Static>{currentEmail}</FormControl.Static>
|
||||
</FormGroup>
|
||||
<div role='group' aria-label={ariaLabel}>
|
||||
<div role='group' aria-label={t('settings.email.heading')}>
|
||||
<FormGroup
|
||||
controlId='new-email'
|
||||
validationState={newEmailValidation}
|
||||
|
||||
@@ -180,13 +180,12 @@ class InternetSettings extends Component<InternetProps, InternetState> {
|
||||
const { state: websiteValidation, message: websiteValidationMessage } =
|
||||
this.getValidationStateFor(website);
|
||||
const isDisabled = this.isFormPristine() || !this.isFormValid();
|
||||
const ariaLabel = t('settings.headings.internet');
|
||||
return (
|
||||
<>
|
||||
<SectionHeader>{t('settings.headings.internet')}</SectionHeader>
|
||||
<FullWidthRow>
|
||||
<form id='internet-presence' onSubmit={this.handleSubmit}>
|
||||
<div role='group' aria-label={ariaLabel}>
|
||||
<div role='group' aria-label={t('settings.headings.internet')}>
|
||||
<FormGroup
|
||||
controlId='internet-github'
|
||||
validationState={githubProfileValidation}
|
||||
|
||||
@@ -369,7 +369,6 @@ class ShowExam extends Component<ShowExamProps, ShowExamState> {
|
||||
`intro:${superBlock}.blocks.${block}.title`
|
||||
)}: ${title}`;
|
||||
const windowTitle = `${blockNameTitle} | freeCodeCamp.org`;
|
||||
const ariaLabel = t('aria.answer');
|
||||
|
||||
// TODO: If already taken exam, show different messages
|
||||
|
||||
@@ -419,7 +418,7 @@ class ShowExam extends Component<ShowExamProps, ShowExamState> {
|
||||
({ answer, id }) => (
|
||||
<label className='exam-answer-label' key={id}>
|
||||
<input
|
||||
aria-label={ariaLabel}
|
||||
aria-label={t('aria.answer')}
|
||||
checked={
|
||||
userExamQuestions[currentQuestionIndex].answer
|
||||
.id === id
|
||||
|
||||
@@ -226,7 +226,6 @@ class ShowOdin extends Component<ShowOdinProps, ShowOdinState> {
|
||||
const blockNameTitle = `${t(
|
||||
`intro:${superBlock}.blocks.${block}.title`
|
||||
)} - ${title}`;
|
||||
const ariaLabel = t('aria.answer');
|
||||
return (
|
||||
<Hotkeys
|
||||
executeChallenge={() => {
|
||||
@@ -306,7 +305,7 @@ class ShowOdin extends Component<ShowOdinProps, ShowOdinState> {
|
||||
{answers.map((option, index) => (
|
||||
<label className='video-quiz-option-label' key={index}>
|
||||
<input
|
||||
aria-label={ariaLabel}
|
||||
aria-label={t('aria.answer')}
|
||||
checked={this.state.selectedOption === index}
|
||||
className='video-quiz-input-hidden'
|
||||
name='quiz'
|
||||
|
||||
@@ -203,7 +203,6 @@ class ShowVideo extends Component<ShowVideoProps, ShowVideoState> {
|
||||
const blockNameTitle = `${t(
|
||||
`intro:${superBlock}.blocks.${block}.title`
|
||||
)} - ${title}`;
|
||||
const ariaLabel = t('aria.answer');
|
||||
return (
|
||||
<Hotkeys
|
||||
executeChallenge={() => {
|
||||
@@ -258,7 +257,7 @@ class ShowVideo extends Component<ShowVideoProps, ShowVideoState> {
|
||||
// index should be fine as a key:
|
||||
<label className='video-quiz-option-label' key={index}>
|
||||
<input
|
||||
aria-label={ariaLabel}
|
||||
aria-label={t('aria.answer')}
|
||||
checked={this.state.selectedOption === index}
|
||||
className='video-quiz-input-hidden'
|
||||
name='quiz'
|
||||
|
||||
Reference in New Issue
Block a user