feat(client): adjust solution-form for gitpod (#53511)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Shaun Hamilton
2024-02-05 18:17:33 +02:00
committed by GitHub
parent e7fc01cee4
commit 4a0519e7a6
5 changed files with 12 additions and 8 deletions
@@ -364,7 +364,7 @@
"assignments": "Assignments",
"question": "Question",
"solution-link": "Solution Link",
"github-link": "GitHub Link",
"source-code-link": "Source Code Link",
"ms-link": "Microsoft Link",
"submit-and-go": "Submit and go to my next challenge",
"congratulations": "Congratulations, your code passes. Submit your code to continue.",
@@ -1,7 +1,9 @@
import React from 'react';
import { Trans } from 'react-i18next';
// Matches editor links for: Replit, Glitch, CodeSandbox, GitHub
// Matches editor links for: Replit, Glitch, CodeSandbox, GitHub. NOT Codespaces, and NOT Gitpod yet
// Once safari allows negative lookbehinds, this can be used:
// |(?<!\.app)\.github\.dev
const editorRegex =
/repl\.?it(\.com)?\/(@|join\/)|glitch\.com\/edit\/#!|codesandbox\.io\/s\/|github\.com/;
const fCCRegex =
@@ -234,7 +234,7 @@ class ShowCodeAlly extends Component<ShowCodeAllyProps> {
const isCompleted = completedChallenges.some(
challenge => challenge.id === challengeId
);
const titleContext = t('learn.github-link');
const titleContext = t('learn.source-code-link');
return showCodeAlly ? (
<LearnLayout>
<Helmet title={windowTitle} />
@@ -51,7 +51,7 @@ export class SolutionForm extends Component<SolutionFormProps> {
];
const backEndProjectFields = [
{ name: 'solution', label: t('learn.solution-link') },
{ name: 'githubLink', label: t('learn.github-link') }
{ name: 'githubLink', label: t('learn.source-code-link') }
];
const buttonCopy = t('learn.i-completed');
@@ -80,12 +80,14 @@ export class SolutionForm extends Component<SolutionFormProps> {
case challengeTypes.backend:
formFields = solutionField;
options.isLocalLinkAllowed = true;
solutionLink = solutionLink + 'https://project-name.camperbot.repl.co/';
solutionLink = solutionLink + 'https://3000-project-url.gitpod.io/';
break;
case challengeTypes.backEndProject:
formFields = backEndProjectFields;
solutionLink = solutionLink + 'https://project-name.camperbot.repl.co/';
options.required.push('githubLink');
options.isLocalLinkAllowed = true;
solutionLink = solutionLink + 'https://3000-project-url.gitpod.io/';
solutionFormID = 'back-end-form';
break;
@@ -121,7 +123,7 @@ export class SolutionForm extends Component<SolutionFormProps> {
...options,
placeholders: {
solution: solutionLink,
githubLink: 'ex: https://github.com/camperbot/hello'
githubLink: 'ex: https://your-git-repo.url/files'
}
}}
submit={this.handleSubmit}
+1 -1
View File
@@ -83,7 +83,7 @@ test.describe('Test form with solution link and github link', () => {
);
await expect(githubLinkInputLabel).toBeVisible();
await expect(githubLinkInputLabel).toHaveText(
translations.learn['github-link']
translations.learn['source-code-link']
);
const githubLinkInput = solutionForm.getByTestId('githubLink-form-control');