fix(learn): Rename "Preview" button to "Terminal" for Python lessons (#63068)

This commit is contained in:
Jatin_Mehta
2025-10-27 15:02:56 +05:30
committed by GitHub
parent 418fd7525c
commit a04eeaa9f2
3 changed files with 17 additions and 2 deletions

View File

@@ -523,6 +523,7 @@
"instructions": "Instructions",
"notes": "Notes",
"preview": "Preview",
"terminal": "Terminal",
"editor": "Editor",
"interactive-editor": "Interactive Editor"
},

View File

@@ -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}

View File

@@ -287,6 +287,7 @@ const DesktopLayout = (props: DesktopLayoutProps): JSX.Element => {
showPreviewPane={showPreviewPane}
showPreviewPortal={showPreviewPortal}
togglePane={togglePane}
challengeType={challengeType}
data-playwright-test-label='action-row'
/>
)}