From a04eeaa9f2285ce6ee00746bd32c13a2c8e91235 Mon Sep 17 00:00:00 2001 From: Jatin_Mehta <143813065+JatinMehta007@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:02:56 +0530 Subject: [PATCH] fix(learn): Rename "Preview" button to "Terminal" for Python lessons (#63068) --- client/i18n/locales/english/translations.json | 1 + .../templates/Challenges/classic/action-row.tsx | 17 +++++++++++++++-- .../Challenges/classic/desktop-layout.tsx | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index 9a69e69c50d..e0b8d0cbe0a 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -523,6 +523,7 @@ "instructions": "Instructions", "notes": "Notes", "preview": "Preview", + "terminal": "Terminal", "editor": "Editor", "interactive-editor": "Interactive Editor" }, diff --git a/client/src/templates/Challenges/classic/action-row.tsx b/client/src/templates/Challenges/classic/action-row.tsx index c14fe5d4aef..5d1631243bd 100644 --- a/client/src/templates/Challenges/classic/action-row.tsx +++ b/client/src/templates/Challenges/classic/action-row.tsx @@ -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')} > {getPreviewBtnsSrText().pane} - +