Skip to content

Commit 8eee5ca

Browse files
authored
feat(client): Editor file visual indication (freeCodeCamp#59186)
1 parent e832ce6 commit 8eee5ca

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

client/src/templates/Challenges/classic/editor.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ textarea.inputarea {
6060
white-space: pre-wrap;
6161
}
6262

63+
.editor-file-name {
64+
font-size: 18px;
65+
font-weight: bold;
66+
border-bottom: 1px solid var(--quaternary-background);
67+
padding-left: 11px;
68+
overflow: hidden;
69+
}
70+
6371
.action-row-container,
6472
.description-container {
6573
background-color: var(--secondary-background);

client/src/templates/Challenges/classic/editor.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,15 @@ const Editor = (props: EditorProps): JSX.Element => {
13171317
return challengeIsComplete();
13181318
};
13191319

1320+
const challengeFile = props.challengeFiles?.find(
1321+
challengeFile => challengeFile.fileKey === props.fileKey
1322+
);
1323+
const showFileName = challengeFile && props.challengeFiles!.length > 1;
13201324
return (
13211325
<Suspense fallback={<Loader loaderDelay={600} />}>
1326+
{showFileName && (
1327+
<div className='editor-file-name'>{`${challengeFile.name}.${challengeFile.ext}`}</div>
1328+
)}
13221329
<span className='notranslate'>
13231330
<MonacoEditor
13241331
editorDidMount={editorDidMount}

e2e/multifile-editor.spec.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ test.beforeEach(async ({ page }) => {
1212

1313
test.describe('MultifileEditor Component', () => {
1414
test('Multiple editors should be selected and able to insert text into', async ({
15-
page,
16-
isMobile
15+
page
1716
}) => {
1817
// Spawn second editor to test MultifileEditor component
1918
const stylesEditor = page.getByRole('button', {
@@ -31,13 +30,7 @@ test.describe('MultifileEditor Component', () => {
3130
const test_string = 'TestString';
3231
let index = 0;
3332
for (const editor of await editors.all()) {
34-
// For some reason the click event doesn't work on mobile
35-
if (isMobile) {
36-
await editor.focus();
37-
} else {
38-
await editor.click();
39-
}
40-
33+
await editor.focus();
4134
await page.keyboard.insertText(test_string + index.toString());
4235
const text = page.getByText(test_string + index.toString());
4336
await expect(text).toBeVisible();

0 commit comments

Comments
 (0)