From 5ef5ed954cb3d64c02460d5b98e339426266925b Mon Sep 17 00:00:00 2001 From: Diana Olarte Date: Fri, 18 Oct 2024 23:44:14 +1100 Subject: [PATCH 1/5] fix: display SUPPORT_URL only if the url is configured --- .env.development | 2 +- .env.test | 2 +- .../LearnerDashboardHeader/LearnerDashboardMenu.jsx | 7 ++++--- .../__snapshots__/index.test.jsx.snap | 10 +--------- src/containers/LearnerDashboardHeader/index.test.jsx | 7 +++++++ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.env.development b/.env.development index 86014958f..55cfa7101 100644 --- a/.env.development +++ b/.env.development @@ -20,7 +20,7 @@ LMS_CLIENT_ID='login-service-client-id' SEGMENT_KEY='' FEATURE_FLAGS={} MARKETING_SITE_BASE_URL='http://localhost:18000' -SUPPORT_URL='http://localhost:18000/support' +SUPPORT_URL='' CONTACT_URL='http://localhost:18000/contact' OPEN_SOURCE_URL='http://localhost:18000/openedx' TERMS_OF_SERVICE_URL='http://localhost:18000/terms-of-service' diff --git a/.env.test b/.env.test index 705a9889b..e66d42c81 100644 --- a/.env.test +++ b/.env.test @@ -20,7 +20,7 @@ LMS_CLIENT_ID='login-service-client-id' SEGMENT_KEY='' FEATURE_FLAGS={} MARKETING_SITE_BASE_URL='http://localhost:18000' -SUPPORT_URL='http://localhost:18000/support' +SUPPORT_URL='' CONTACT_URL='http://localhost:18000/contact' OPEN_SOURCE_URL='http://localhost:18000/openedx' TERMS_OF_SERVICE_URL='http://localhost:18000/terms-of-service' diff --git a/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx b/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx index 9dcecc3a1..092bcfe7c 100644 --- a/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx +++ b/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx @@ -32,11 +32,11 @@ const getLearnerHeaderMenu = ( }, ], secondaryMenu: [ - { + ...(getConfig().SUPPORT_URL ? [{ type: 'item', href: `${getConfig().SUPPORT_URL}`, content: formatMessage(messages.help), - }, + }] : []), ], userMenu: [ { @@ -70,6 +70,7 @@ const getLearnerHeaderMenu = ( ], }, ], -}); +} +); export default getLearnerHeaderMenu; diff --git a/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap b/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap index a1f0a9e71..80d090019 100644 --- a/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap +++ b/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap @@ -25,15 +25,7 @@ exports[`LearnerDashboardHeader render 1`] = ` }, ] } - secondaryMenuItems={ - [ - { - "content": "Help", - "href": "http://localhost:18000/support", - "type": "item", - }, - ] - } + secondaryMenuItems={[]} userMenuItems={ [ { diff --git a/src/containers/LearnerDashboardHeader/index.test.jsx b/src/containers/LearnerDashboardHeader/index.test.jsx index e07fbda42..4e552925e 100644 --- a/src/containers/LearnerDashboardHeader/index.test.jsx +++ b/src/containers/LearnerDashboardHeader/index.test.jsx @@ -31,5 +31,12 @@ describe('LearnerDashboardHeader', () => { expect(wrapper.instance.findByType(Header)).toHaveLength(1); wrapper.instance.findByType(Header)[0].props.mainMenuItems[2].onClick(); expect(findCoursesNavClicked).toHaveBeenCalledWith(urls.baseAppUrl('/course-search-url')); + expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(0); + }); + + test('should display Help link if SUPPORT_URL is set', () => { + mergeConfig({ SUPPORT_URL: 'http://localhost:18000/support' }); + const wrapper = shallow(); + expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(1); }); }); From 261448dee95e978a70e10b80330eea07c1336021 Mon Sep 17 00:00:00 2001 From: Diana Olarte Date: Tue, 19 Nov 2024 10:25:17 +1100 Subject: [PATCH 2/5] fix: display programs tab only if it is configured fix: apply feedback --- .env | 1 + .env.development | 1 + .env.test | 1 + src/config/index.js | 1 + .../LearnerDashboardHeader/LearnerDashboardMenu.jsx | 4 ++-- .../__snapshots__/index.test.jsx.snap | 5 ----- src/containers/LearnerDashboardHeader/hooks.test.js | 2 +- src/containers/LearnerDashboardHeader/index.test.jsx | 7 ++++++- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.env b/.env index 40c4e09b8..dd38ba312 100644 --- a/.env +++ b/.env @@ -41,3 +41,4 @@ ACCOUNT_PROFILE_URL='' ENABLE_NOTICES='' CAREER_LINK_URL='' ENABLE_EDX_PERSONAL_DASHBOARD=false +ENABLE_PROGRAMS=false diff --git a/.env.development b/.env.development index 55cfa7101..6685c05a8 100644 --- a/.env.development +++ b/.env.development @@ -47,3 +47,4 @@ ACCOUNT_PROFILE_URL='http://localhost:1995' ENABLE_NOTICES='' CAREER_LINK_URL='' ENABLE_EDX_PERSONAL_DASHBOARD=false +ENABLE_PROGRAMS=false diff --git a/.env.test b/.env.test index e66d42c81..0769651aa 100644 --- a/.env.test +++ b/.env.test @@ -46,3 +46,4 @@ ACCOUNT_PROFILE_URL='http://account-profile-url.test' ENABLE_NOTICES='' CAREER_LINK_URL='' ENABLE_EDX_PERSONAL_DASHBOARD=true +ENABLE_PROGRAMS=false diff --git a/src/config/index.js b/src/config/index.js index a2e2a5667..e1bacea87 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -19,6 +19,7 @@ const configuration = { LOGO_URL: process.env.LOGO_URL, ENABLE_EDX_PERSONAL_DASHBOARD: process.env.ENABLE_EDX_PERSONAL_DASHBOARD === 'true', SEARCH_CATALOG_URL: process.env.SEARCH_CATALOG_URL || null, + ENABLE_PROGRAMS: process.env.ENABLE_PROGRAMS === 'true', }; const features = {}; diff --git a/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx b/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx index 092bcfe7c..165d48666 100644 --- a/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx +++ b/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx @@ -17,11 +17,11 @@ const getLearnerHeaderMenu = ( content: formatMessage(messages.course), isActive: true, }, - { + ...(getConfig().ENABLE_PROGRAMS ? [{ type: 'item', href: `${urls.programsUrl()}`, content: formatMessage(messages.program), - }, + }] : []), { type: 'item', href: `${urls.baseAppUrl(courseSearchUrl)}`, diff --git a/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap b/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap index 80d090019..34bcdc1f9 100644 --- a/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap +++ b/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap @@ -12,11 +12,6 @@ exports[`LearnerDashboardHeader render 1`] = ` "isActive": true, "type": "item", }, - { - "content": "Programs", - "href": "http://localhost:18000/dashboard/programs", - "type": "item", - }, { "content": "Discover New", "href": "http://localhost:18000/course-search-url", diff --git a/src/containers/LearnerDashboardHeader/hooks.test.js b/src/containers/LearnerDashboardHeader/hooks.test.js index c9bac080a..54b84cf58 100644 --- a/src/containers/LearnerDashboardHeader/hooks.test.js +++ b/src/containers/LearnerDashboardHeader/hooks.test.js @@ -56,7 +56,7 @@ describe('LearnerDashboardHeader hooks', () => { username: 'test', }; const learnerHomeHeaderMenu = useLearnerDashboardHeaderMenu({ courseSearchUrl, authenticatedUser }); - expect(learnerHomeHeaderMenu.mainMenu.length).toBe(3); + expect(learnerHomeHeaderMenu.mainMenu.length).toBe(2); }); }); diff --git a/src/containers/LearnerDashboardHeader/index.test.jsx b/src/containers/LearnerDashboardHeader/index.test.jsx index 4e552925e..86eb1acfa 100644 --- a/src/containers/LearnerDashboardHeader/index.test.jsx +++ b/src/containers/LearnerDashboardHeader/index.test.jsx @@ -29,7 +29,7 @@ describe('LearnerDashboardHeader', () => { expect(wrapper.instance.findByType('ConfirmEmailBanner')).toHaveLength(1); expect(wrapper.instance.findByType('MasqueradeBar')).toHaveLength(1); expect(wrapper.instance.findByType(Header)).toHaveLength(1); - wrapper.instance.findByType(Header)[0].props.mainMenuItems[2].onClick(); + wrapper.instance.findByType(Header)[0].props.mainMenuItems[1].onClick(); expect(findCoursesNavClicked).toHaveBeenCalledWith(urls.baseAppUrl('/course-search-url')); expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(0); }); @@ -39,4 +39,9 @@ describe('LearnerDashboardHeader', () => { const wrapper = shallow(); expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(1); }); + test('should display Programs link if it is enabled by configuration', () => { + mergeConfig({ ENABLE_PROGRAMS: true }); + const wrapper = shallow(); + expect(wrapper.instance.findByType(Header)[0].props.mainMenuItems.length).toBe(3); + }); }); From 8e0e2174021681d7daf82551917b94be7a395867 Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Fri, 6 Dec 2024 10:04:06 -0300 Subject: [PATCH 3/5] fix: Use browserslist-config We were installing browserslist-config but not declaring it. This had the effect that webpack - and likely others - were not using it. --- package-lock.json | 9 +++++---- package.json | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d408305a8..63f9c125f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "AGPL-3.0", "dependencies": { "@edx/brand": "npm:@openedx/brand-openedx@^1.2.2", - "@edx/browserslist-config": "^1.1.0", "@edx/frontend-component-header": "^5.6.0", "@edx/frontend-enterprise-hotjar": "3.0.0", "@edx/frontend-platform": "8.1.2", @@ -63,6 +62,7 @@ "whatwg-fetch": "^3.6.2" }, "devDependencies": { + "@edx/browserslist-config": "^1.3.0", "@edx/reactifex": "^2.1.1", "@openedx/frontend-build": "14.1.5", "@testing-library/jest-dom": "^5.14.1", @@ -2060,9 +2060,10 @@ "integrity": "sha512-Dn9CtpC8fovh++Xi4NF5NJoeR9yU2yXZnV9IujxIyGd/dn0Phq5t6dzJVfupwq09mpDnzJv7egA8Znz/3ljO+w==" }, "node_modules/@edx/browserslist-config": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.2.0.tgz", - "integrity": "sha512-T1+6P52Yx7SMkmoIr4O0Q3m/DyRdrLTJbv1xVijdRLFEq1hqdafEs+Ln1423U5LSkTePb9AOkEtL1G0RZLFl1w==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.3.0.tgz", + "integrity": "sha512-qf4BHyjdsx/bVMQmfj1y/MwTZwI5+9DAOul+PJnyO+YhWSwdxtdvXqkOw1wLxqmDtqOPc5bYgDQf8zZfe+aDFA==", + "license": "AGPL-3.0" }, "node_modules/@edx/eslint-config": { "version": "4.2.0", diff --git a/package.json b/package.json index 3edbc3e1b..2e9f3b1a9 100755 --- a/package.json +++ b/package.json @@ -6,6 +6,9 @@ "type": "git", "url": "git+https://github.com/edx/frontend-app-learner-dashboard.git" }, + "browserslist": [ + "extends @edx/browserslist-config" + ], "scripts": { "build": "fedx-scripts webpack", "i18n_extract": "fedx-scripts formatjs extract", @@ -27,7 +30,6 @@ }, "dependencies": { "@edx/brand": "npm:@openedx/brand-openedx@^1.2.2", - "@edx/browserslist-config": "^1.1.0", "@edx/frontend-component-header": "^5.6.0", "@edx/frontend-enterprise-hotjar": "3.0.0", "@edx/frontend-platform": "8.1.2", @@ -80,6 +82,7 @@ "whatwg-fetch": "^3.6.2" }, "devDependencies": { + "@edx/browserslist-config": "^1.3.0", "@edx/reactifex": "^2.1.1", "@openedx/frontend-build": "14.1.5", "@testing-library/jest-dom": "^5.14.1", From 021f52b303946580a59b413df0bbed9b5fb5993e Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Fri, 6 Dec 2024 14:59:52 -0300 Subject: [PATCH 4/5] feat: remove upgrade button This removes the upgrade button as default content in CourseCardActionSlot. This is, for the moment, a Sumac-specific change. The button is still present in master, pending proper removal (including the component definitions from the rest of the repository) prior to the U release by the maintainers. See: https://github.com/openedx/frontend-app-learner-dashboard/issues/438 --- .../CourseCardActionSlot/index.jsx | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/plugin-slots/CourseCardActionSlot/index.jsx b/src/plugin-slots/CourseCardActionSlot/index.jsx index 6747ee185..7a95b675b 100644 --- a/src/plugin-slots/CourseCardActionSlot/index.jsx +++ b/src/plugin-slots/CourseCardActionSlot/index.jsx @@ -2,27 +2,14 @@ import React from 'react'; import PropTypes from 'prop-types'; import { PluginSlot } from '@openedx/frontend-plugin-framework'; -import { reduxHooks } from 'hooks'; -import UpgradeButton from 'containers/CourseCard/components/CourseCardActions/UpgradeButton'; - -const CourseCardActionSlot = ({ cardId }) => { - const { isEntitlement } = reduxHooks.useCardEntitlementData(cardId); - const { - isVerified, - isExecEd2UCourse, - } = reduxHooks.useCardEnrollmentData(cardId); - - return ( - - {!(isEntitlement || isVerified || isExecEd2UCourse) && } - - ); -}; +const CourseCardActionSlot = ({ cardId }) => ( + +); CourseCardActionSlot.propTypes = { cardId: PropTypes.string.isRequired, From 4978525fbb4bb289a3ee3c153852b955725f3533 Mon Sep 17 00:00:00 2001 From: Zubair Shakoor Date: Mon, 12 May 2025 23:55:43 +0500 Subject: [PATCH 5/5] fix: fixed html heading tags orders --- src/containers/CoursesPanel/index.jsx | 2 +- src/containers/Dashboard/index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/containers/CoursesPanel/index.jsx b/src/containers/CoursesPanel/index.jsx index 6bf525ab4..7409d7b2d 100644 --- a/src/containers/CoursesPanel/index.jsx +++ b/src/containers/CoursesPanel/index.jsx @@ -27,7 +27,7 @@ export const CoursesPanel = () => { return (
-

{formatMessage(messages.myCourses)}

+

{formatMessage(messages.myCourses)}

diff --git a/src/containers/Dashboard/index.jsx b/src/containers/Dashboard/index.jsx index d26077339..6175c8f31 100644 --- a/src/containers/Dashboard/index.jsx +++ b/src/containers/Dashboard/index.jsx @@ -21,7 +21,7 @@ export const Dashboard = () => { return (
-

{pageTitle}

+ {pageTitle} {!initIsPending && ( <> {hasAvailableDashboards && }