From 6350c9101b1ee4baa34309eca94a767e7a1ac98c Mon Sep 17 00:00:00 2001 From: c0d1ng_ma5ter Date: Thu, 27 Mar 2025 07:37:21 -0600 Subject: [PATCH] fix(client): Change reset lesson message to be dynamic (#59400) Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com> Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> --- client/i18n/locales/english/translations.json | 2 +- client/src/templates/Challenges/classic/show.tsx | 2 +- .../src/templates/Challenges/components/reset-modal.tsx | 8 ++++++-- e2e/challenge-reset-modal.spec.ts | 6 +++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index bd6dd44fea5..778c4e45908 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -445,7 +445,7 @@ "rsa": "Read, search, ask", "rsa-forum": "Before making a new post please <0>check if your question has already been answered on the forum.", "reset": "Reset this lesson?", - "reset-warn": "Are you sure you wish to reset this lesson? The editors and tests will be reset.", + "reset-warn": "Are you sure you wish to reset this lesson ({{title}})? The code editors and tests will be reset.", "reset-warn-2": "This cannot be undone.", "revert-warn": "Are you sure you wish to revert this lesson? Your latest changes will be undone and the code reverted to the most recently saved version.", "scrimba-tip": "Tip: If the mini-browser is covering the code, click and drag to move it. Also, feel free to stop and edit the code in the video at any time.", diff --git a/client/src/templates/Challenges/classic/show.tsx b/client/src/templates/Challenges/classic/show.tsx index e88a5e8e323..1775a2fa3bc 100644 --- a/client/src/templates/Challenges/classic/show.tsx +++ b/client/src/templates/Challenges/classic/show.tsx @@ -528,7 +528,7 @@ function ShowClassic({ superBlock={superBlock} /> - + void; + challengeTitle: string; } const mapStateToProps = createSelector( @@ -41,7 +42,8 @@ function ResetModal({ reset, close, challengeType, - isOpen + isOpen, + challengeTitle }: ResetModalProps): JSX.Element { const { t } = useTranslation(); if (isOpen) { @@ -56,7 +58,9 @@ function ResetModal({

{canSaveToDB(challengeType) ? t('learn.revert-warn') - : t('learn.reset-warn')} + : t('learn.reset-warn', { + title: challengeTitle + })}

{t('learn.reset-warn-2')} diff --git a/e2e/challenge-reset-modal.spec.ts b/e2e/challenge-reset-modal.spec.ts index 5c42de5f249..0b14057e3c6 100644 --- a/e2e/challenge-reset-modal.spec.ts +++ b/e2e/challenge-reset-modal.spec.ts @@ -42,7 +42,11 @@ test('should render the modal content correctly', async ({ page }) => { }) ).toBeVisible(); - await expect(page.getByText(translations.learn['reset-warn'])).toBeVisible(); + await expect( + page.getByText( + 'Are you sure you wish to reset this lesson (Step 3)? The code editors and tests will be reset.' + ) + ).toBeVisible(); }); test('User can reset challenge', async ({ page, isMobile, browserName }) => {