diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index 15e80e1f481..b970e68d682 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -584,9 +584,9 @@ "instructions": "Instructions", "notes": "Notes", "preview": "Preview", - "terminal": "Terminal", "editor": "Editor", - "interactive-editor": "Interactive Editor" + "interactive-editor": "Interactive Editor", + "terminal": "Terminal" }, "editor-alerts": { "tab-trapped": "Pressing tab will now insert the tab character", @@ -1034,6 +1034,10 @@ "terminal-output": "Terminal output", "not-available": "Not available", "interactive-editor-desc": "Turn static code examples into interactive editors. This allows you to edit and run the code directly on the page.", + "hide-terminal": "Hide the terminal", + "move-terminal-to-new-window": "Move the terminal to a new window and focus it", + "move-terminal-to-main-window": "Move the terminal to this window and close the external terminal window", + "close-external-terminal-window": "Close the external terminal window", "pinyin-to-hanzi-input-desc": "This task uses Pinyin-to-Hanzi inputs. Type pinyin with tone numbers (1 to 5). When you enter a correct syllable, it will turn into a Chinese character. If you press backspace after a Chinese character, it will change back to pinyin and remove the last thing you typed: if it's a tone number, the tone is removed; if it's a letter, the letter is removed.", "pinyin-tone-input-desc": "This task uses Pinyin Tone inputs. Type pinyin with tone numbers (1 to 5). When you enter a tone number, it will be converted to a tone mark. If you press backspace, the last thing you typed is removed: if it's a tone number, the tone is removed; if it's a letter, the letter is removed." }, diff --git a/client/src/templates/Challenges/classic/action-row.tsx b/client/src/templates/Challenges/classic/action-row.tsx index fa4725b5789..893a61333ef 100644 --- a/client/src/templates/Challenges/classic/action-row.tsx +++ b/client/src/templates/Challenges/classic/action-row.tsx @@ -4,7 +4,6 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import store from 'store'; import { DailyCodingChallengeLanguages } from '../../../redux/prop-types'; -import { challengeTypes } from '@freecodecamp/shared/config/challenge-types'; import EditorTabs from './editor-tabs'; interface ClassicLayoutProps { @@ -21,9 +20,9 @@ interface ClassicLayoutProps { showInstructions: boolean; showPreviewPane: boolean; showPreviewPortal: boolean; - challengeType: number; togglePane: (pane: string) => void; hasInteractiveEditor?: never; + usesTerminal: boolean; hasContentOutline?: never; } @@ -108,7 +107,7 @@ const ActionRow = (props: ActionRowProps): JSX.Element => { isDailyCodingChallenge, dailyCodingChallengeLanguage, setDailyCodingChallengeLanguage, - challengeType + usesTerminal } = props; // sets screen reader text for the two preview buttons @@ -119,35 +118,39 @@ const ActionRow = (props: ActionRowProps): JSX.Element => { portal: t('aria.open-preview-in-new-window') }; - // preview open in main window + // open in main window if (showPreviewPane && !showPreviewPortal) { - previewBtnsSrText.pane = t('aria.hide-preview'); - previewBtnsSrText.portal = t('aria.move-preview-to-new-window'); - - // preview open in external window + if (usesTerminal) { + previewBtnsSrText.pane = t('aria.hide-terminal'); + previewBtnsSrText.portal = t('aria.move-terminal-to-new-window'); + } else { + previewBtnsSrText.pane = t('aria.hide-preview'); + previewBtnsSrText.portal = t('aria.move-preview-to-new-window'); + } + // open in external window } else if (showPreviewPortal && !showPreviewPane) { - previewBtnsSrText.pane = t('aria.move-preview-to-main-window'); - previewBtnsSrText.portal = t('aria.close-external-preview-window'); + if (usesTerminal) { + previewBtnsSrText.pane = t('aria.move-terminal-to-main-window'); + previewBtnsSrText.portal = t('aria.close-external-terminal-window'); + } else { + previewBtnsSrText.pane = t('aria.move-preview-to-main-window'); + previewBtnsSrText.portal = t('aria.close-external-preview-window'); + } } 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); }; + const previewPaneButtonText = + usesTerminal == false + ? 'learn.editor-tabs.preview' + : 'learn.editor-tabs.terminal'; + return (
@@ -207,7 +210,7 @@ const ActionRow = (props: ActionRowProps): JSX.Element => { onClick={() => togglePane('showPreviewPane')} > {getPreviewBtnsSrText().pane} - +