mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-14 07:00:51 -04:00
fix(learn): Rename "Preview" button to "Terminal" for Python lessons (#63068)
This commit is contained in:
@@ -523,6 +523,7 @@
|
||||
"instructions": "Instructions",
|
||||
"notes": "Notes",
|
||||
"preview": "Preview",
|
||||
"terminal": "Terminal",
|
||||
"editor": "Editor",
|
||||
"interactive-editor": "Interactive Editor"
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import store from 'store';
|
||||
import { DailyCodingChallengeLanguages } from '../../../redux/prop-types';
|
||||
import { challengeTypes } from '../../../../../shared-dist/config/challenge-types';
|
||||
import EditorTabs from './editor-tabs';
|
||||
|
||||
interface ClassicLayoutProps {
|
||||
@@ -20,6 +21,7 @@ interface ClassicLayoutProps {
|
||||
showInstructions: boolean;
|
||||
showPreviewPane: boolean;
|
||||
showPreviewPortal: boolean;
|
||||
challengeType: number;
|
||||
togglePane: (pane: string) => void;
|
||||
hasInteractiveEditor?: never;
|
||||
}
|
||||
@@ -70,7 +72,8 @@ const ActionRow = (props: ActionRowProps): JSX.Element => {
|
||||
showPreviewPortal,
|
||||
isDailyCodingChallenge,
|
||||
dailyCodingChallengeLanguage,
|
||||
setDailyCodingChallengeLanguage
|
||||
setDailyCodingChallengeLanguage,
|
||||
challengeType
|
||||
} = props;
|
||||
|
||||
// sets screen reader text for the two preview buttons
|
||||
@@ -95,6 +98,16 @@ const ActionRow = (props: ActionRowProps): JSX.Element => {
|
||||
return previewBtnsSrText;
|
||||
}
|
||||
|
||||
const isPythonChallenge =
|
||||
challengeType === challengeTypes.python ||
|
||||
challengeType === challengeTypes.multifilePythonCertProject ||
|
||||
challengeType === challengeTypes.pyLab ||
|
||||
challengeType === challengeTypes.dailyChallengePy;
|
||||
|
||||
const previewButtonText = isPythonChallenge
|
||||
? t('learn.editor-tabs.terminal')
|
||||
: t('learn.editor-tabs.preview');
|
||||
|
||||
const handleLanguageChange = (language: DailyCodingChallengeLanguages) => {
|
||||
store.set('dailyCodingChallengeLanguage', language);
|
||||
setDailyCodingChallengeLanguage(language);
|
||||
@@ -161,7 +174,7 @@ const ActionRow = (props: ActionRowProps): JSX.Element => {
|
||||
onClick={() => togglePane('showPreviewPane')}
|
||||
>
|
||||
<span className='sr-only'>{getPreviewBtnsSrText().pane}</span>
|
||||
<span aria-hidden='true'>{t('learn.editor-tabs.preview')}</span>
|
||||
<span aria-hidden='true'>{previewButtonText}</span>
|
||||
</button>
|
||||
<button
|
||||
aria-expanded={!!showPreviewPortal}
|
||||
|
||||
@@ -287,6 +287,7 @@ const DesktopLayout = (props: DesktopLayoutProps): JSX.Element => {
|
||||
showPreviewPane={showPreviewPane}
|
||||
showPreviewPortal={showPreviewPortal}
|
||||
togglePane={togglePane}
|
||||
challengeType={challengeType}
|
||||
data-playwright-test-label='action-row'
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user