mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-30 12:05:39 -05:00
feat(client): move sentence array outside lowerjaw component (#51061)
This commit is contained in:
@@ -71,6 +71,18 @@ const mapStateToProps = createSelector(
|
||||
})
|
||||
);
|
||||
|
||||
const sentenceArray = [
|
||||
'learn.sorry-try-again',
|
||||
'learn.sorry-keep-trying',
|
||||
'learn.sorry-getting-there',
|
||||
'learn.sorry-hang-in-there',
|
||||
'learn.sorry-dont-giveup'
|
||||
];
|
||||
|
||||
const sentencePicker = (currentAttempts: number) => {
|
||||
return sentenceArray[currentAttempts % sentenceArray.length];
|
||||
};
|
||||
|
||||
const LowerButtonsPanel = ({
|
||||
resetButtonText,
|
||||
helpButtonText,
|
||||
@@ -264,17 +276,6 @@ const LowerJaw = ({
|
||||
updateContainer();
|
||||
});
|
||||
|
||||
const sentencePicker = () => {
|
||||
const sentenceArray = [
|
||||
'learn.sorry-try-again',
|
||||
'learn.sorry-keep-trying',
|
||||
'learn.sorry-getting-there',
|
||||
'learn.sorry-hang-in-there',
|
||||
'learn.sorry-dont-giveup'
|
||||
];
|
||||
return sentenceArray[currentAttempts % sentenceArray.length];
|
||||
};
|
||||
|
||||
const isAttemptsLargerThanTest =
|
||||
currentAttempts &&
|
||||
testsLength &&
|
||||
@@ -352,7 +353,7 @@ const LowerJaw = ({
|
||||
showFeedback={isFeedbackHidden}
|
||||
testText={t('learn.test')}
|
||||
htmlDescription={`${hintRef.current}`}
|
||||
learnEncouragementText={t(sentencePicker())}
|
||||
learnEncouragementText={t(sentencePicker(currentAttempts))}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user