From 77c8809b00324f13f00733b16fdce6031692c4bd Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Thu, 9 Feb 2023 21:37:22 +0200 Subject: [PATCH] refactor(client): cleanup honesty policy section (#49003) Co-authored-by: Bruce B Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Co-authored-by: sidemt <25644062+sidemt@users.noreply.github.com> Co-authored-by: Mrugesh Mohapatra Co-authored-by: Quincy Larson --- client/i18n/locales/english/translations.json | 6 ++-- .../__snapshots__/Honesty.test.tsx.snap | 16 ++++----- client/src/components/settings/honesty.css | 16 ++++++--- client/src/components/settings/honesty.tsx | 34 +++++++------------ client/src/resources/honesty-policy.tsx | 2 +- .../e2e/default/settings/certifications.ts | 8 ++--- cypress/support/commands.ts | 2 +- 7 files changed, 39 insertions(+), 45 deletions(-) diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index ce97b267a1f..9ce112fd71e 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -15,8 +15,8 @@ "show-cert": "Show Certification", "claim-cert": "Claim Certification", "save-progress": "Save Progress", - "accepted-honesty": "You have accepted our Academic Honesty Policy.", - "agree": "Agree", + "accepted-honesty": "You have agreed to our Academic Honesty Policy.", + "agree-honesty": "I agree to freeCodeCamp's Academic Honesty Policy.", "save-portfolio": "Save this portfolio item", "remove-portfolio": "Remove this portfolio item", "add-portfolio": "Add a new portfolio Item", @@ -517,7 +517,7 @@ "opens-new-window": "Opens in new window" }, "flash": { - "honest-first": "To claim a certification, you must first accept our academic honesty policy", + "honest-first": "To claim a certification, you must first agree to our academic honesty policy", "really-weird": "Something really weird happened, if it happens again, please consider raising an issue on https://github.com/freeCodeCamp/freeCodeCamp/issues/new", "not-right": "Something is not quite right. A report has been generated and the freeCodeCamp.org team have been notified", "went-wrong": "Something went wrong, please check and try again", diff --git a/client/src/components/settings/__snapshots__/Honesty.test.tsx.snap b/client/src/components/settings/__snapshots__/Honesty.test.tsx.snap index 9e6d5accbde..86dcb3e0089 100644 --- a/client/src/components/settings/__snapshots__/Honesty.test.tsx.snap +++ b/client/src/components/settings/__snapshots__/Honesty.test.tsx.snap @@ -2,7 +2,6 @@ exports[` snapshot when isHonest is false: Honesty 1`] = `
@@ -14,16 +13,16 @@ exports[` snapshot when isHonest is false: Honesty 1`] = > -
@@ -31,7 +30,6 @@ exports[` snapshot when isHonest is false: Honesty 1`] = exports[` snapshot when isHonest is true: HonestyAccepted 1`] = `
@@ -43,18 +41,16 @@ exports[` snapshot when isHonest is true: HonestyAccepted > -
diff --git a/client/src/components/settings/honesty.css b/client/src/components/settings/honesty.css index 4eab7d1efad..979df5c6c86 100644 --- a/client/src/components/settings/honesty.css +++ b/client/src/components/settings/honesty.css @@ -1,3 +1,14 @@ +#honesty-policy + :is( + button[aria-disabled='true'], + button[aria-disabled='true']:is(:focus, :hover) + ) { + background-color: var(--quaternary-background); + color: var(--secondary-color); + opacity: 0.65; + cursor: not-allowed; +} + .honesty-panel p { margin-inline: 10px; font-family: 'Lato', sans-serif; @@ -7,11 +18,6 @@ padding-top: 15px; } -.honesty-policy .disabled-agreed p { - margin-top: 0; - margin-bottom: 0; -} - .honesty-panel .btn-invert { color: var(--primary-background); } diff --git a/client/src/components/settings/honesty.tsx b/client/src/components/settings/honesty.tsx index c8db8c62c9d..b8c54e31d96 100644 --- a/client/src/components/settings/honesty.tsx +++ b/client/src/components/settings/honesty.tsx @@ -15,33 +15,25 @@ type HonestyProps = { const Honesty = ({ isHonest, updateIsHonest }: HonestyProps): JSX.Element => { const { t } = useTranslation(); - const button = isHonest ? ( - - ) : ( - - ); + const buttonText = isHonest + ? t('buttons.accepted-honesty') + : t('buttons.agree-honesty'); + return ( -
+
{t('settings.headings.honesty')} -
- {button} +
); diff --git a/client/src/resources/honesty-policy.tsx b/client/src/resources/honesty-policy.tsx index dea6b82c460..2a3a3f489ed 100644 --- a/client/src/resources/honesty-policy.tsx +++ b/client/src/resources/honesty-policy.tsx @@ -3,7 +3,7 @@ import { Trans, useTranslation } from 'react-i18next'; const HonestyPolicy = (): JSX.Element => { const { t } = useTranslation(); - const email = 'team@freecodecamp.org'; + const email = 'support@freecodecamp.org'; return ( <> diff --git a/cypress/e2e/default/settings/certifications.ts b/cypress/e2e/default/settings/certifications.ts index ad242e24f09..02611708b68 100644 --- a/cypress/e2e/default/settings/certifications.ts +++ b/cypress/e2e/default/settings/certifications.ts @@ -13,10 +13,10 @@ describe('Settings certifications area', () => { expect($btns).to.have.length(16); }); cy.findByText('Show Certification').should('not.exist'); - cy.contains('Agree'); + cy.contains(`I agree to freeCodeCamp's Academic Honesty Policy.`); cy.contains('Claim Certification').click(); cy.contains( - 'To claim a certification, you must first accept our academic honesty policy' + 'To claim a certification, you must first agree to our academic honesty policy' ); }); }); @@ -29,8 +29,8 @@ describe('Settings certifications area', () => { it('Should update the user as they try to claim their certifications', () => { cy.visit('/settings'); - cy.contains('Agree').click(); - cy.contains('You have accepted our Academic Honesty Policy.'); + cy.contains(`I agree to freeCodeCamp's Academic Honesty Policy.`).click(); + cy.contains('You have agreed to our Academic Honesty Policy.'); cy.contains('Claim Certification').click(); cy.contains( 'It looks like you have not completed the necessary steps. Please complete the required projects to claim the Responsive Web Design Certification' diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 8087b69f2c7..e1121adf333 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -21,7 +21,7 @@ const setPrivacyTogglesToPublic = () => { }); cy.get('[data-cy=save-privacy-settings]').click(); cy.get('#honesty-policy').find('button').click(); - cy.contains('You have accepted our Academic Honesty Policy'); + cy.contains('You have agreed to our Academic Honesty Policy'); }; const goToSettings = () => {