From 513d3fc4eb03e229148d2132c23595bf6231e78c Mon Sep 17 00:00:00 2001 From: leangseu-edx <83240113+leangseu-edx@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:49:47 -0500 Subject: [PATCH] fix: a few typos (#279) --- src/ExperimentContext.test.jsx | 4 +- .../RelatedProgramsBanner/index.jsx | 22 +-- .../components/RelatedProgramsBadge/index.jsx | 13 +- .../CollapsedHeader/CollapseMenuBody.jsx | 132 +++++++++--------- .../CollapseMenuBody.test.jsx.snap | 2 +- .../__snapshots__/index.test.jsx.snap | 2 +- .../ConfirmEmailBanner/messages.js | 2 +- .../__snapshots__/index.test.jsx.snap | 2 +- .../ExpandedHeader/index.jsx | 10 +- src/i18n/messages/pt_BR.json | 2 +- src/i18n/messages/zh_CN.json | 2 +- .../ProductRecommendations/index.test.jsx | 12 +- 12 files changed, 108 insertions(+), 97 deletions(-) diff --git a/src/ExperimentContext.test.jsx b/src/ExperimentContext.test.jsx index b0a83863..9c6664c4 100644 --- a/src/ExperimentContext.test.jsx +++ b/src/ExperimentContext.test.jsx @@ -39,7 +39,7 @@ describe('experiments context', () => { it('calls useEffect once', () => { expect(calls.length).toEqual(1); }); - describe('successfull fetch', () => { + describe('successful fetch', () => { it('sets the country code', async () => { let resolveFn; api.fetchRecommendationsContext.mockReturnValueOnce( @@ -57,7 +57,7 @@ describe('experiments context', () => { }); }); }); - describe('unsuccessfull fetch', () => { + describe('unsuccessful fetch', () => { it('sets the country code to an empty string', async () => { let rejectFn; api.fetchRecommendationsContext.mockReturnValueOnce( diff --git a/src/containers/CourseCard/components/CourseCardBanners/RelatedProgramsBanner/index.jsx b/src/containers/CourseCard/components/CourseCardBanners/RelatedProgramsBanner/index.jsx index b1150f55..7681870d 100644 --- a/src/containers/CourseCard/components/CourseCardBanners/RelatedProgramsBanner/index.jsx +++ b/src/containers/CourseCard/components/CourseCardBanners/RelatedProgramsBanner/index.jsx @@ -15,16 +15,20 @@ export const RelatedProgramsBanner = ({ cardId }) => { const programData = reduxHooks.useCardRelatedProgramsData(cardId); + if (!programData?.length) { + return null; + } + return ( - programData?.length > 0 && ( - - {formatMessage(messages.relatedPrograms)} - - - ) + + + {formatMessage(messages.relatedPrograms)} + + + ); }; RelatedProgramsBanner.propTypes = { diff --git a/src/containers/CourseCard/components/RelatedProgramsBadge/index.jsx b/src/containers/CourseCard/components/RelatedProgramsBadge/index.jsx index a0a5f70f..4b9663d2 100644 --- a/src/containers/CourseCard/components/RelatedProgramsBadge/index.jsx +++ b/src/containers/CourseCard/components/RelatedProgramsBadge/index.jsx @@ -10,13 +10,14 @@ import useRelatedProgramsBadgeData from './hooks'; export const RelatedProgramsBadge = ({ cardId }) => { const { - isOpen, - openModal, - closeModal, - numPrograms, - programsMessage, + isOpen, openModal, closeModal, numPrograms, programsMessage, } = useRelatedProgramsBadgeData({ cardId }); - return (numPrograms > 0) && ( + + if (numPrograms === 0) { + return null; + } + + return ( <> - - - - - {authenticatedUser && ( - <> - {!!dashboard && ( - - )} - {!dashboard && getConfig().CAREER_LINK_URL && ( - - )} - + + + + + {authenticatedUser && ( + <> + {!!dashboard && ( + - - {getConfig().ORDER_HISTORY_URL && ( - - )} + )} + + + {getConfig().ORDER_HISTORY_URL && ( - - )} - - ) + )} + + + )} + ); }; diff --git a/src/containers/LearnerDashboardHeader/CollapsedHeader/__snapshots__/CollapseMenuBody.test.jsx.snap b/src/containers/LearnerDashboardHeader/CollapsedHeader/__snapshots__/CollapseMenuBody.test.jsx.snap index 87ed984d..96efcfe5 100644 --- a/src/containers/LearnerDashboardHeader/CollapsedHeader/__snapshots__/CollapseMenuBody.test.jsx.snap +++ b/src/containers/LearnerDashboardHeader/CollapsedHeader/__snapshots__/CollapseMenuBody.test.jsx.snap @@ -69,7 +69,7 @@ exports[`CollapseMenuBody render 1`] = ` `; -exports[`CollapseMenuBody render empty if not open 1`] = `false`; +exports[`CollapseMenuBody render empty if not open 1`] = `null`; exports[`CollapseMenuBody render unauthenticated 1`] = `
- We've sent you an email to verify your acccount. Please check your inbox and click on the big red button to confirm and keep learning. + We've sent you an email to verify your account. Please check your inbox and click on the big red button to confirm and keep learning.

diff --git a/src/containers/LearnerDashboardHeader/ConfirmEmailBanner/messages.js b/src/containers/LearnerDashboardHeader/ConfirmEmailBanner/messages.js index 5260f470..fbdcdba0 100644 --- a/src/containers/LearnerDashboardHeader/ConfirmEmailBanner/messages.js +++ b/src/containers/LearnerDashboardHeader/ConfirmEmailBanner/messages.js @@ -24,7 +24,7 @@ const messages = defineMessages({ confirmEmailModalBody: { id: 'leanerDashboard.confirmEmailModalBody', description: 'text hint for confirming email modal', - defaultMessage: 'We\'ve sent you an email to verify your acccount. Please check your inbox and click on the big red button to confirm and keep learning.', + defaultMessage: 'We\'ve sent you an email to verify your account. Please check your inbox and click on the big red button to confirm and keep learning.', }, confirmEmailImageAlt: { id: 'leanerDashboard.confirmEmailImageAlt', diff --git a/src/containers/LearnerDashboardHeader/ExpandedHeader/__snapshots__/index.test.jsx.snap b/src/containers/LearnerDashboardHeader/ExpandedHeader/__snapshots__/index.test.jsx.snap index d75303ff..0fad2c78 100644 --- a/src/containers/LearnerDashboardHeader/ExpandedHeader/__snapshots__/index.test.jsx.snap +++ b/src/containers/LearnerDashboardHeader/ExpandedHeader/__snapshots__/index.test.jsx.snap @@ -52,4 +52,4 @@ exports[`ExpandedHeader render 1`] = ` `; -exports[`ExpandedHeader render empty if collapsed 1`] = `false`; +exports[`ExpandedHeader render empty if collapsed 1`] = `null`; diff --git a/src/containers/LearnerDashboardHeader/ExpandedHeader/index.jsx b/src/containers/LearnerDashboardHeader/ExpandedHeader/index.jsx index 250a7756..50aad936 100644 --- a/src/containers/LearnerDashboardHeader/ExpandedHeader/index.jsx +++ b/src/containers/LearnerDashboardHeader/ExpandedHeader/index.jsx @@ -19,10 +19,15 @@ export const ExpandedHeader = () => { const { courseSearchUrl } = reduxHooks.usePlatformSettingsData(); const isCollapsed = useIsCollapsed(); - const exploreCoursesClick = findCoursesNavClicked(urls.baseAppUrl(courseSearchUrl)); + const exploreCoursesClick = findCoursesNavClicked( + urls.baseAppUrl(courseSearchUrl), + ); + + if (isCollapsed) { + return null; + } return ( - !isCollapsed && (
@@ -66,7 +71,6 @@ export const ExpandedHeader = () => {
- ) ); }; diff --git a/src/i18n/messages/pt_BR.json b/src/i18n/messages/pt_BR.json index 774b6715..8a367ebd 100644 --- a/src/i18n/messages/pt_BR.json +++ b/src/i18n/messages/pt_BR.json @@ -12,7 +12,7 @@ "leanerDashboard.confirmEmailTextReminderBanner": "Remember to confirm your email so that you can keep learning on edX! {confirmNowButton}.", "leanerDashboard.verifiedConfirmEmailButton": "I've confirmed my email", "leanerDashboard.confirmEmailModalHeader": "Confirm your email", - "leanerDashboard.confirmEmailModalBody": "We've sent you an email to verify your acccount. Please check your inbox and click on the big red button to confirm and keep learning.", + "leanerDashboard.confirmEmailModalBody": "We've sent you an email to verify your account. Please check your inbox and click on the big red button to confirm and keep learning.", "leanerDashboard.confirmEmailImageAlt": "confirm email background", "learnerVariantDashboard.menu.dashboard.label": "Painel de controle", "learnerVariantDashboard.help.label": "Ajuda", diff --git a/src/i18n/messages/zh_CN.json b/src/i18n/messages/zh_CN.json index d552a212..8ef84194 100644 --- a/src/i18n/messages/zh_CN.json +++ b/src/i18n/messages/zh_CN.json @@ -12,7 +12,7 @@ "leanerDashboard.confirmEmailTextReminderBanner": "Remember to confirm your email so that you can keep learning on edX! {confirmNowButton}.", "leanerDashboard.verifiedConfirmEmailButton": "I've confirmed my email", "leanerDashboard.confirmEmailModalHeader": "Confirm your email", - "leanerDashboard.confirmEmailModalBody": "We've sent you an email to verify your acccount. Please check your inbox and click on the big red button to confirm and keep learning.", + "leanerDashboard.confirmEmailModalBody": "We've sent you an email to verify your account. Please check your inbox and click on the big red button to confirm and keep learning.", "leanerDashboard.confirmEmailImageAlt": "confirm email background", "learnerVariantDashboard.menu.dashboard.label": "Dashboard", "learnerVariantDashboard.help.label": "Help", diff --git a/src/widgets/ProductRecommendations/index.test.jsx b/src/widgets/ProductRecommendations/index.test.jsx index 28f537ed..ab343b98 100644 --- a/src/widgets/ProductRecommendations/index.test.jsx +++ b/src/widgets/ProductRecommendations/index.test.jsx @@ -31,7 +31,7 @@ describe('ProductRecommendations', () => { hasFailed: false, }; - const successfullLoadValues = { + const successfulLoadValues = { ...defaultValues, isLoaded: true, productRecommendations: mockCrossProductResponse, @@ -42,7 +42,7 @@ describe('ProductRecommendations', () => { it('matches snapshot', () => { hooks.useIsMobile.mockReturnValueOnce(false); hooks.useProductRecommendationsData.mockReturnValueOnce({ - ...successfullLoadValues, + ...successfulLoadValues, }); expect(shallow().snapshot).toMatchSnapshot(); @@ -73,7 +73,7 @@ describe('ProductRecommendations', () => { it('renders nothing if the user is on the mobile view', () => { hooks.useIsMobile.mockReturnValueOnce(true); hooks.useProductRecommendationsData.mockReturnValueOnce({ - ...successfullLoadValues, + ...successfulLoadValues, }); const wrapper = shallow(); @@ -84,7 +84,7 @@ describe('ProductRecommendations', () => { it('renders NoCoursesView if the request is loaded, user has courses, and the response is empty', () => { hooks.useIsMobile.mockReturnValueOnce(false); hooks.useProductRecommendationsData.mockReturnValueOnce({ - ...successfullLoadValues, + ...successfulLoadValues, productRecommendations: { amplitudeCourses: [], crossProductCourses: [], @@ -100,7 +100,7 @@ describe('ProductRecommendations', () => { it('renders with cross product data if the request completed and the user has courses', () => { hooks.useIsMobile.mockReturnValueOnce(false); hooks.useProductRecommendationsData.mockReturnValueOnce({ - ...successfullLoadValues, + ...successfulLoadValues, }); expect({ ...shallow().shallowWrapper, children: expect.any(Array) }).toMatchObject( @@ -116,7 +116,7 @@ describe('ProductRecommendations', () => { it('renders the LoadedView with Amplitude course data if the request completed', () => { hooks.useIsMobile.mockReturnValueOnce(false); hooks.useProductRecommendationsData.mockReturnValueOnce({ - ...successfullLoadValues, + ...successfulLoadValues, productRecommendations: mockAmplitudeResponse, });