Skip to content

Commit 9147889

Browse files
Merge pull request #727 from freeCodeCamp/main
Create a new pull request by comparing changes across two branches
2 parents c9eb037 + d3cfb8e commit 9147889

File tree

37 files changed

+207
-200
lines changed

37 files changed

+207
-200
lines changed

.github/workflows/node.js-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ jobs:
194194
run: |
195195
cp sample.env .env
196196
echo 'SHOW_UPCOMING_CHANGES=true' >> .env
197-
echo 'SHOW_NEW_CURRICULUM=true' >> .env
198197
cat .env
199198
200199
- name: Start MongoDB

.github/workflows/temporary-container-checks.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ jobs:
5151
--build-arg PATREON_CLIENT_ID=id_from_patreon_dashboard \
5252
--build-arg DEPLOYMENT_ENV=staging \
5353
--build-arg SHOW_UPCOMING_CHANGES=false \
54-
--build-arg SHOW_NEW_CURRICULUM=false \
5554
--build-arg GROWTHBOOK_URI=api_URI_from_Growthbook_dashboard \
5655
--build-arg FREECODECAMP_NODE_ENV=development \
5756
-f docker/web/Dockerfile .

api/src/utils/env.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,8 @@ assert.ok(process.env.AUTH0_CLIENT_ID);
5050
assert.ok(process.env.AUTH0_CLIENT_SECRET);
5151
assert.ok(process.env.AUTH0_DOMAIN);
5252
assert.ok(process.env.API_LOCATION);
53-
assert.ok(process.env.FCC_ENABLE_SWAGGER_UI);
54-
assert.ok(process.env.FCC_ENABLE_DEV_LOGIN_MODE);
5553
assert.ok(process.env.JWT_SECRET);
5654
assert.ok(process.env.STRIPE_SECRET_KEY);
57-
assert.ok(process.env.SHOW_UPCOMING_CHANGES);
5855
assert.ok(process.env.MONGOHQ_URL);
5956
assert.ok(process.env.COOKIE_SECRET);
6057

@@ -68,13 +65,15 @@ const LOG_LEVELS: LogLevel[] = [
6865
'silent'
6966
] as const;
7067

71-
function assertLogLevel(level: unknown): level is LogLevel {
72-
return typeof level === 'string' && LOG_LEVELS.includes(level);
68+
function isLogLevel(level: string): level is LogLevel {
69+
return LOG_LEVELS.includes(level);
7370
}
7471

72+
const LOG_LEVEL = process.env.FCC_API_LOG_LEVEL || 'info';
73+
7574
assert.ok(
76-
assertLogLevel(process.env.FCC_API_LOG_LEVEL),
77-
`FCC_API_LOG_LEVEL must be one of ${LOG_LEVELS.join(',')}. Found ${process.env.FCC_API_LOG_LEVEL}`
75+
isLogLevel(LOG_LEVEL),
76+
`FCC_API_LOG_LEVEL must be one of ${LOG_LEVELS.join(', ')}. Found ${LOG_LEVEL}`
7877
);
7978

8079
if (process.env.FREECODECAMP_NODE_ENV !== 'development') {
@@ -157,7 +156,7 @@ export const FCC_ENABLE_EXAM_ENVIRONMENT =
157156
process.env.FCC_ENABLE_EXAM_ENVIRONMENT === 'true';
158157
export const FCC_ENABLE_SENTRY_ROUTES =
159158
process.env.FCC_ENABLE_SENTRY_ROUTES === 'true';
160-
export const FCC_API_LOG_LEVEL = process.env.FCC_API_LOG_LEVEL;
159+
export const FCC_API_LOG_LEVEL = LOG_LEVEL;
161160
export const SENTRY_DSN =
162161
process.env.SENTRY_DSN === 'dsn_from_sentry_dashboard'
163162
? ''

client/i18n/locales/english/intro.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@
19071907
"workshop-final-exams-table": {
19081908
"title": "Build a Final Exams Table",
19091909
"intro": [
1910-
"In this workshop, you will learn how to work with HTML tables by building a table of final exams."
1910+
"In this workshop, you will practice working with HTML tables by building a table of final exams."
19111911
]
19121912
},
19131913
"lab-book-catalog-table": {

client/i18n/locales/english/translations.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,10 @@
527527
"building-a-university": "We're Building a Free Computer Science University Degree Program 🎉",
528528
"if-help-university": "We've already made a ton of progress. Donate now to help our charity with the road ahead.",
529529
"preview-external-window": "Preview currently showing in external window.",
530-
"fill-in-the-blank": "Fill in the blank",
531-
"blank": "blank",
530+
"fill-in-the-blank": {
531+
"heading": "Fill in the blank",
532+
"blank": "blank"
533+
},
532534
"quiz": {
533535
"correct-answer": "Correct!",
534536
"incorrect-answer": "Incorrect.",

client/src/components/Map/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ import { SuperBlockIcon } from '../../assets/superblock-icon';
1414
import LinkButton from '../../assets/icons/link-button';
1515
import { ButtonLink } from '../helpers';
1616
import { getSuperBlockTitleForMap } from '../../utils/superblock-map-titles';
17-
import {
18-
showUpcomingChanges,
19-
showNewCurriculum
20-
} from '../../../config/env.json';
17+
import { showUpcomingChanges } from '../../../config/env.json';
2118

2219
import './map.css';
2320

@@ -165,7 +162,6 @@ function Map({
165162
return (
166163
<div className='map-ui' data-test-label='curriculum-map'>
167164
{getStageOrder({
168-
showNewCurriculum,
169165
showUpcomingChanges
170166
}).map(stage => (
171167
<Fragment key={stage}>

client/src/pages/learn/full-stack-developer/workshop-final-exams-table/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ superBlock: full-stack-developer
66

77
## Introduction to the Build a Final Exams Table
88

9-
This is a test for the new project-based curriculum.
9+
In this workshop, you will practice working with HTML tables by building a table of final exams.

client/src/templates/Challenges/components/fill-in-the-blanks.tsx

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { useTranslation } from 'react-i18next';
3-
43
import { Spacer } from '@freecodecamp/ui';
4+
55
import { parseBlanks } from '../fill-in-the-blank/parse-blanks';
66
import PrismFormatted from '../components/prism-formatted';
77
import { FillInTheBlank } from '../../../redux/prop-types';
@@ -26,18 +26,22 @@ function FillInTheBlanks({
2626
}: FillInTheBlankProps): JSX.Element {
2727
const { t } = useTranslation();
2828

29-
const addInputClass = (index: number): string => {
30-
if (answersCorrect[index] === true) return 'green-underline';
31-
if (answersCorrect[index] === false) return 'red-underline';
32-
return '';
29+
const getInputClass = (index: number): string => {
30+
let cls = 'fill-in-the-blank-input';
31+
32+
if (answersCorrect[index] === false) {
33+
cls += ' incorrect-blank-answer';
34+
}
35+
36+
return cls;
3337
};
3438

3539
const paragraphs = parseBlanks(sentence);
3640
const blankAnswers = blanks.map(b => b.answer);
3741

3842
return (
3943
<>
40-
<ChallengeHeading heading={t('learn.fill-in-the-blank')} />
44+
<ChallengeHeading heading={t('learn.fill-in-the-blank.heading')} />
4145
<Spacer size='xs' />
4246
<div className='fill-in-the-blank-wrap'>
4347
{paragraphs.map((p, i) => {
@@ -47,36 +51,49 @@ function FillInTheBlanks({
4751
<p key={i}>
4852
{p.map((node, j) => {
4953
const { type, value } = node;
50-
if (type === 'text') return value;
51-
if (type === 'blank')
54+
if (type === 'text') {
55+
return value;
56+
}
57+
58+
// If a blank is answered correctly, render the answer as part of the sentence.
59+
if (type === 'blank' && answersCorrect[value] === true) {
5260
return (
53-
<input
54-
key={j}
55-
type='text'
56-
maxLength={blankAnswers[value].length + 3}
57-
className={`fill-in-the-blank-input ${addInputClass(
58-
value
59-
)}`}
60-
onChange={handleInputChange}
61-
data-index={node.value}
62-
size={blankAnswers[value].length}
63-
aria-label={t('learn.blank')}
64-
/>
61+
<span key={j} className='correct-blank-answer'>
62+
{blankAnswers[value]}
63+
</span>
6564
);
65+
}
66+
67+
return (
68+
<input
69+
key={j}
70+
type='text'
71+
maxLength={blankAnswers[value].length + 3}
72+
className={getInputClass(value)}
73+
onChange={handleInputChange}
74+
data-index={node.value}
75+
size={blankAnswers[value].length}
76+
autoComplete='off'
77+
aria-label={t('learn.fill-in-the-blank.blank')}
78+
{...(answersCorrect[value] === false
79+
? { 'aria-invalid': 'true' }
80+
: {})}
81+
/>
82+
);
6683
})}
6784
</p>
6885
);
6986
})}
7087
</div>
7188
<Spacer size='m' />
72-
{showFeedback && feedback && (
73-
<>
74-
<PrismFormatted text={feedback} />
75-
<Spacer size='m' />
76-
</>
77-
)}
78-
<div className='text-center'>
79-
{showWrong && <span>{t('learn.wrong-answer')}</span>}
89+
<div aria-live='polite'>
90+
{showWrong && (
91+
<div className='text-center'>
92+
<span>{t('learn.wrong-answer')}</span>
93+
<Spacer size='m' />
94+
</div>
95+
)}
96+
{showFeedback && feedback && <PrismFormatted text={feedback} />}
8097
</div>
8198
</>
8299
);

client/src/templates/Challenges/fill-in-the-blank/show.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@
3636
z-index: 2;
3737
}
3838

39-
.green-underline {
40-
border-bottom-color: var(--success-background) !important;
39+
.correct-blank-answer {
40+
color: var(--background-success) !important;
41+
font-weight: bold;
4142
}
4243

43-
.red-underline {
44-
border-bottom-color: var(--danger-background) !important;
44+
.incorrect-blank-answer {
45+
border-bottom-color: var(--background-danger) !important;
4546
}

client/tools/create-env.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ if (FREECODECAMP_NODE_ENV !== 'development') {
4949
'curriculumLocale',
5050
'deploymentEnv',
5151
'environment',
52-
'showUpcomingChanges',
53-
'showNewCurriculum'
52+
'showUpcomingChanges'
5453
];
5554
const searchKeys = ['algoliaAppId', 'algoliaAPIKey'];
5655
const donationKeys = ['stripePublicKey', 'paypalClientId', 'patreonClientId'];
@@ -114,14 +113,9 @@ if (FREECODECAMP_NODE_ENV !== 'development') {
114113
checkCurriculumLocale();
115114
if (fs.existsSync(`${configPath}/env.json`)) {
116115
/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment */
117-
const { showNewCurriculum, showUpcomingChanges } = require(
118-
`${configPath}/env.json`
119-
);
116+
const { showUpcomingChanges } = require(`${configPath}/env.json`);
120117
/* eslint-enable @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment */
121-
if (
122-
env['showUpcomingChanges'] !== showUpcomingChanges ||
123-
env['showNewCurriculum'] !== showNewCurriculum
124-
) {
118+
if (env['showUpcomingChanges'] !== showUpcomingChanges) {
125119
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
126120
console.log('Feature flags have been changed, cleaning client cache.');
127121
const child = spawn('pnpm', ['run', '-w', 'clean:client']);

0 commit comments

Comments
 (0)