From 010515fcc02a5cda335521cfdd7a12f2e1045784 Mon Sep 17 00:00:00 2001 From: Anna Date: Wed, 15 May 2024 04:12:44 -0400 Subject: [PATCH] fix(client): use translations json for button text (#54737) Co-authored-by: Naomi --- client/i18n/locales/english/translations.json | 4 +++ .../components/completion-modal.tsx | 26 +++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index 6a1b87544bf..12b9afc5cff 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -72,7 +72,11 @@ "update-email": "Update my Email", "verify-email": "Verify Email", "submit-and-go": "Submit and go to next challenge", + "submit-and-go-2": "Submit and go to next challenge (Ctrl + Enter)", + "submit-and-go-3": "Submit and go to next challenge (Command + Enter)", "go-to-next": "Go to next challenge", + "go-to-next-2": "Go to next challenge (Ctrl + Enter)", + "go-to-next-3": "Go to next challenge (Command + Enter)", "ask-later": "Ask me later", "start-coding": "Start coding!", "go-to-settings": "Go to settings to claim your certification", diff --git a/client/src/templates/Challenges/components/completion-modal.tsx b/client/src/templates/Challenges/components/completion-modal.tsx index f3c2f76ba15..ce62eae76ff 100644 --- a/client/src/templates/Challenges/components/completion-modal.tsx +++ b/client/src/templates/Challenges/components/completion-modal.tsx @@ -25,7 +25,7 @@ import { import Progress from '../../../components/Progress'; import GreenPass from '../../../assets/icons/green-pass'; import { Spacer } from '../../../components/helpers'; - +import { MAX_MOBILE_WIDTH } from '../../../../config/misc'; import './completion-modal.css'; import callGA from '../../../analytics/call-ga'; @@ -166,6 +166,25 @@ class CompletionModal extends Component< const isMacOS = navigator.userAgent.includes('Mac OS'); + const isDesktop = window.innerWidth > MAX_MOBILE_WIDTH; + + let buttonText; + if (isDesktop) { + if (isMacOS) { + buttonText = isSignedIn + ? t('buttons.submit-and-go-3') + : t('buttons.go-to-next-3'); + } else { + buttonText = isSignedIn + ? t('buttons.submit-and-go-2') + : t('buttons.go-to-next-2'); + } + } else { + buttonText = isSignedIn + ? t('buttons.submit-and-go') + : t('buttons.go-to-next'); + } + return ( submitChallenge()} > - {isSignedIn ? t('buttons.submit-and-go') : t('buttons.go-to-next')} - - {isMacOS ? ' (Command + Enter)' : ' (Ctrl + Enter)'} - + {buttonText} {this.state.downloadURL ? (