Skip to content

Commit 63a4729

Browse files
feat(client): add local instructions for rdb courses (freeCodeCamp#59184)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
1 parent fd0c4db commit 63a4729

File tree

12 files changed

+550
-116
lines changed

12 files changed

+550
-116
lines changed

client/i18n/locales/english/translations.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,28 @@
509509
"learn-more": "Learn more about <0>Gitpod workspaces.</0>",
510510
"logout-warning": "If you log out of freeCodeCamp before you complete the entire {{course}} course, your progress will not be saved to your freeCodeCamp account."
511511
},
512+
"local": {
513+
"intro": "This course runs in a virtual Linux machine on your computer. To run the course, you first need to download each of the following if you don't already have them:",
514+
"download-vscode": "<0>VS Code</0> and the <1>Dev Containers</1> extension",
515+
"heading": "Then, follow these instructions to start the course:",
516+
"step-1": "Open a terminal and clone the RDB Alpha repo if you don't already have it with <0>git clone https://github.com/freeCodeCamp/rdb-alpha</0>",
517+
"step-2": "Navigate to the <0>rdb-alpha</0> directory in the terminal with <1>cd rdb-alpha</1>, and open VS Code with <2>code .</2>",
518+
"sub-step-heading": "If you want to save your progress to your freeCodeCamp account, do the following:",
519+
"sub-step-1": "Generate a user token if you don't already have one:",
520+
"generate-token-btn": "Generate User Token",
521+
"sub-step-2": "Copy your user token:",
522+
"copy-token-btn": "Copy User Token",
523+
"logout-warning": "If you log out of freeCodeCamp before you complete the entire {{course}} course, your user token will be deleted and your progress will not be saved to your freeCodeCamp account.",
524+
"sub-step-3": "In the VS Code that opened, find and open the file named <0>Dockerfile</0>. At the bottom of the file, paste your token in as the value for the <1>CODEROAD_WEBHOOK_TOKEN</1> variable. It should look like this: <2>ENV CODEROAD_WEBHOOK_TOKEN=your-token-here</2>",
525+
"step-3": "Open the command palette in VS Code by expanding the \"View\" menu and clicking \"Command Palette...\" and enter <0>Dev Containers: Rebuild and Reopen in Container</0> in the input.",
526+
"step-4": "A new VS Code window will open and begin building the Docker image. It will take several minutes the first time.",
527+
"step-5": "Once it is finished building, open the command palette again and enter <0>CodeRoad: Start</0> to open CodeRoad.",
528+
"step-6": "In the CodeRoad window, click \"Start New Tutorial\" and then the \"URL\" tab at the top.",
529+
"step-7": "Copy the course URL below, paste it in the URL input, and click \"Load\".",
530+
"copy-url": "Copy Course URL",
531+
"step-8": "Click \"Start\" to begin.",
532+
"step-9": "Follow the instructions in CodeRoad to complete the course. Note: You may need to restart the terminal once for terminal settings to take effect and the tests to pass."
533+
},
512534
"step-1": "Step 1: Complete the project",
513535
"step-2": "Step 2: Submit your code",
514536
"submit-public-url": "When you have completed the project, save all the required files into a public repository and submit the URL to it below.",
@@ -918,6 +940,12 @@
918940
"generate-exam-error": "An error occurred trying to generate your exam.",
919941
"cert-not-found": "The certification {{certSlug}} does not exist.",
920942
"reset-editor-layout": "Your editor layout has been reset.",
943+
"user-token-generated": "A user token was created for you.",
944+
"user-token-generate-error": "Something went wrong trying to generate a user token for you.",
945+
"user-token-copied": "User token copied to clipboard.",
946+
"user-token-copy-error": "Something went wrong trying to copy your token.",
947+
"course-url-copied": "Course URL copied to clipboard.",
948+
"course-url-copy-error": "Something went wrong trying to copy the course URL.",
921949
"ms": {
922950
"transcript": {
923951
"link-err-1": "Please include a Microsoft transcript URL in the request.",

client/src/components/Flash/redux/flash-messages.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export enum FlashMessages {
1111
CodeSaveError = 'flash.code-save-error',
1212
CodeSaveLess = 'flash.code-save-less',
1313
CompleteProjectFirst = 'flash.complete-project-first',
14+
CourseUrlCopied = 'flash.course-url-copied',
15+
CourseUrlCopyError = 'flash.course-url-copy-error',
1416
DeleteTokenErr = 'flash.delete-token-err',
1517
EmailValid = 'flash.email-valid',
1618
GenerateExamError = 'flash.generate-exam-error',
@@ -66,6 +68,10 @@ export enum FlashMessages {
6668
UsernameUpdated = 'flash.username-updated',
6769
UsernameUsed = 'flash.username-used',
6870
UserNotCertified = 'flash.user-not-certified',
71+
UserTokenCopied = 'flash.user-token-copied',
72+
UserTokenCopyError = 'flash.user-token-copy-error',
73+
UserTokenGenerated = 'flash.user-token-generated',
74+
UserTokenGenerateError = 'flash.user-token-generate-error',
6975
WrongName = 'flash.wrong-name',
7076
WrongUpdating = 'flash.wrong-updating',
7177
WentWrong = 'flash.went-wrong'

client/src/components/growth-book/codeally-button.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,34 @@ import React from 'react';
44
import { useFeature } from '@growthbook/growthbook-react';
55
import { useTranslation } from 'react-i18next';
66
import { Button } from '@freecodecamp/ui';
7+
import { challengeTypes } from '../../../../shared/config/challenge-types';
78

89
interface CodeAllyButtonProps {
9-
text: string;
10+
challengeType: number;
1011
onClick: () => void;
1112
}
1213

13-
export function CodeAllyButton(props: CodeAllyButtonProps): JSX.Element | null {
14+
export function CodeAllyButton({
15+
challengeType,
16+
onClick
17+
}: CodeAllyButtonProps): JSX.Element | null {
1418
const codeAllyDisabledFeature = useFeature('codeally_disabled');
1519
const { t } = useTranslation();
1620

21+
const text =
22+
challengeType === challengeTypes.codeAllyCert
23+
? t('buttons.click-start-project')
24+
: t('buttons.click-start-course');
25+
1726
return (
1827
<Button
19-
onClick={codeAllyDisabledFeature.on ? () => {} : props.onClick}
28+
onClick={codeAllyDisabledFeature.on ? () => {} : onClick}
2029
disabled={codeAllyDisabledFeature.on}
2130
variant='primary'
2231
block={true}
2332
>
2433
<span className='sr-only'>, {t('aria.opens-new-window')}</span>
25-
{props.text}&nbsp;&nbsp;
34+
{text}&nbsp;&nbsp;
2635
<FontAwesomeIcon icon={faExternalLinkAlt} />
2736
</Button>
2837
);
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React from 'react';
2+
import { Trans } from 'react-i18next';
3+
import { Alert, Spacer } from '@freecodecamp/ui';
4+
5+
interface RdbGitpodContinueAlertProps {
6+
course: string;
7+
}
8+
9+
function RdbGitpodContinueAlert({
10+
course
11+
}: RdbGitpodContinueAlertProps): JSX.Element {
12+
return (
13+
<Alert variant='info'>
14+
<Trans values={{ course }} i18nKey='learn.gitpod.continue-project'>
15+
<a
16+
href='https://gitpod.io/workspaces'
17+
rel='noopener noreferrer'
18+
target='_blank'
19+
>
20+
placeholder
21+
</a>
22+
</Trans>
23+
<Spacer size='m' />
24+
<Trans i18nKey='learn.gitpod.learn-more'>
25+
<a
26+
href='https://forum.freecodecamp.org/t/using-gitpod-in-the-curriculum/668669'
27+
rel='noopener noreferrer'
28+
target='_blank'
29+
>
30+
placeholder
31+
</a>
32+
</Trans>
33+
</Alert>
34+
);
35+
}
36+
37+
RdbGitpodContinueAlert.displayName = 'RdbGitpodContinueAlert';
38+
39+
export default RdbGitpodContinueAlert;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react';
2+
import { Trans, useTranslation } from 'react-i18next';
3+
4+
function RdbGitpodInstructions(): JSX.Element {
5+
const { t } = useTranslation();
6+
7+
return (
8+
<div className='ca-description'>
9+
<p>{t('learn.gitpod.intro')}</p>
10+
<ol>
11+
<li>
12+
<Trans i18nKey='learn.gitpod.step-1'>
13+
<a
14+
href='https://github.com/join'
15+
rel='noopener noreferrer'
16+
target='_blank'
17+
title={t('learn.source-code-link')}
18+
>
19+
placeholder
20+
</a>
21+
</Trans>
22+
</li>
23+
<li>{t('learn.gitpod.step-2')}</li>
24+
<li>{t('learn.gitpod.step-3')}</li>
25+
<li>
26+
{t('learn.gitpod.step-4')}
27+
<ul>
28+
<li>{t('learn.gitpod.step-5')}</li>
29+
<li>{t('learn.gitpod.step-6')}</li>
30+
<li>{t('learn.gitpod.step-7')}</li>
31+
<li>{t('learn.gitpod.step-8')}</li>
32+
</ul>
33+
</li>
34+
<li>{t('learn.gitpod.step-9')}</li>
35+
</ol>
36+
</div>
37+
);
38+
}
39+
40+
RdbGitpodInstructions.displayName = 'RdbGitpodInstructions';
41+
42+
export default RdbGitpodInstructions;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react';
2+
import { useTranslation } from 'react-i18next';
3+
import { Alert } from '@freecodecamp/ui';
4+
5+
interface RdbGitpodLogoutAlertProps {
6+
course: string;
7+
}
8+
9+
function RdbGitpodLogoutAlert({
10+
course
11+
}: RdbGitpodLogoutAlertProps): JSX.Element {
12+
const { t } = useTranslation();
13+
14+
return (
15+
<Alert variant='danger'>
16+
{t('learn.gitpod.logout-warning', { course })}
17+
</Alert>
18+
);
19+
}
20+
21+
RdbGitpodLogoutAlert.displayName = 'RdbGitpodLogoutAlert';
22+
23+
export default RdbGitpodLogoutAlert;

0 commit comments

Comments
 (0)