Compare commits
4 Commits
master
...
open-relea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
021f52b303 | ||
|
|
8e0e217402 | ||
|
|
261448dee9 | ||
|
|
5ef5ed954c |
1
.env
1
.env
@@ -41,3 +41,4 @@ ACCOUNT_PROFILE_URL=''
|
|||||||
ENABLE_NOTICES=''
|
ENABLE_NOTICES=''
|
||||||
CAREER_LINK_URL=''
|
CAREER_LINK_URL=''
|
||||||
ENABLE_EDX_PERSONAL_DASHBOARD=false
|
ENABLE_EDX_PERSONAL_DASHBOARD=false
|
||||||
|
ENABLE_PROGRAMS=false
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ LMS_CLIENT_ID='login-service-client-id'
|
|||||||
SEGMENT_KEY=''
|
SEGMENT_KEY=''
|
||||||
FEATURE_FLAGS={}
|
FEATURE_FLAGS={}
|
||||||
MARKETING_SITE_BASE_URL='http://localhost:18000'
|
MARKETING_SITE_BASE_URL='http://localhost:18000'
|
||||||
SUPPORT_URL='http://localhost:18000/support'
|
SUPPORT_URL=''
|
||||||
CONTACT_URL='http://localhost:18000/contact'
|
CONTACT_URL='http://localhost:18000/contact'
|
||||||
OPEN_SOURCE_URL='http://localhost:18000/openedx'
|
OPEN_SOURCE_URL='http://localhost:18000/openedx'
|
||||||
TERMS_OF_SERVICE_URL='http://localhost:18000/terms-of-service'
|
TERMS_OF_SERVICE_URL='http://localhost:18000/terms-of-service'
|
||||||
@@ -47,3 +47,4 @@ ACCOUNT_PROFILE_URL='http://localhost:1995'
|
|||||||
ENABLE_NOTICES=''
|
ENABLE_NOTICES=''
|
||||||
CAREER_LINK_URL=''
|
CAREER_LINK_URL=''
|
||||||
ENABLE_EDX_PERSONAL_DASHBOARD=false
|
ENABLE_EDX_PERSONAL_DASHBOARD=false
|
||||||
|
ENABLE_PROGRAMS=false
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ LMS_CLIENT_ID='login-service-client-id'
|
|||||||
SEGMENT_KEY=''
|
SEGMENT_KEY=''
|
||||||
FEATURE_FLAGS={}
|
FEATURE_FLAGS={}
|
||||||
MARKETING_SITE_BASE_URL='http://localhost:18000'
|
MARKETING_SITE_BASE_URL='http://localhost:18000'
|
||||||
SUPPORT_URL='http://localhost:18000/support'
|
SUPPORT_URL=''
|
||||||
CONTACT_URL='http://localhost:18000/contact'
|
CONTACT_URL='http://localhost:18000/contact'
|
||||||
OPEN_SOURCE_URL='http://localhost:18000/openedx'
|
OPEN_SOURCE_URL='http://localhost:18000/openedx'
|
||||||
TERMS_OF_SERVICE_URL='http://localhost:18000/terms-of-service'
|
TERMS_OF_SERVICE_URL='http://localhost:18000/terms-of-service'
|
||||||
@@ -46,3 +46,4 @@ ACCOUNT_PROFILE_URL='http://account-profile-url.test'
|
|||||||
ENABLE_NOTICES=''
|
ENABLE_NOTICES=''
|
||||||
CAREER_LINK_URL=''
|
CAREER_LINK_URL=''
|
||||||
ENABLE_EDX_PERSONAL_DASHBOARD=true
|
ENABLE_EDX_PERSONAL_DASHBOARD=true
|
||||||
|
ENABLE_PROGRAMS=false
|
||||||
|
|||||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -10,7 +10,6 @@
|
|||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
||||||
"@edx/browserslist-config": "^1.1.0",
|
|
||||||
"@edx/frontend-component-header": "^5.6.0",
|
"@edx/frontend-component-header": "^5.6.0",
|
||||||
"@edx/frontend-enterprise-hotjar": "3.0.0",
|
"@edx/frontend-enterprise-hotjar": "3.0.0",
|
||||||
"@edx/frontend-platform": "8.1.2",
|
"@edx/frontend-platform": "8.1.2",
|
||||||
@@ -63,6 +62,7 @@
|
|||||||
"whatwg-fetch": "^3.6.2"
|
"whatwg-fetch": "^3.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@edx/browserslist-config": "^1.3.0",
|
||||||
"@edx/reactifex": "^2.1.1",
|
"@edx/reactifex": "^2.1.1",
|
||||||
"@openedx/frontend-build": "14.1.5",
|
"@openedx/frontend-build": "14.1.5",
|
||||||
"@testing-library/jest-dom": "^5.14.1",
|
"@testing-library/jest-dom": "^5.14.1",
|
||||||
@@ -2060,9 +2060,10 @@
|
|||||||
"integrity": "sha512-Dn9CtpC8fovh++Xi4NF5NJoeR9yU2yXZnV9IujxIyGd/dn0Phq5t6dzJVfupwq09mpDnzJv7egA8Znz/3ljO+w=="
|
"integrity": "sha512-Dn9CtpC8fovh++Xi4NF5NJoeR9yU2yXZnV9IujxIyGd/dn0Phq5t6dzJVfupwq09mpDnzJv7egA8Znz/3ljO+w=="
|
||||||
},
|
},
|
||||||
"node_modules/@edx/browserslist-config": {
|
"node_modules/@edx/browserslist-config": {
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.3.0.tgz",
|
||||||
"integrity": "sha512-T1+6P52Yx7SMkmoIr4O0Q3m/DyRdrLTJbv1xVijdRLFEq1hqdafEs+Ln1423U5LSkTePb9AOkEtL1G0RZLFl1w=="
|
"integrity": "sha512-qf4BHyjdsx/bVMQmfj1y/MwTZwI5+9DAOul+PJnyO+YhWSwdxtdvXqkOw1wLxqmDtqOPc5bYgDQf8zZfe+aDFA==",
|
||||||
|
"license": "AGPL-3.0"
|
||||||
},
|
},
|
||||||
"node_modules/@edx/eslint-config": {
|
"node_modules/@edx/eslint-config": {
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/edx/frontend-app-learner-dashboard.git"
|
"url": "git+https://github.com/edx/frontend-app-learner-dashboard.git"
|
||||||
},
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"extends @edx/browserslist-config"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "fedx-scripts webpack",
|
"build": "fedx-scripts webpack",
|
||||||
"i18n_extract": "fedx-scripts formatjs extract",
|
"i18n_extract": "fedx-scripts formatjs extract",
|
||||||
@@ -27,7 +30,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
||||||
"@edx/browserslist-config": "^1.1.0",
|
|
||||||
"@edx/frontend-component-header": "^5.6.0",
|
"@edx/frontend-component-header": "^5.6.0",
|
||||||
"@edx/frontend-enterprise-hotjar": "3.0.0",
|
"@edx/frontend-enterprise-hotjar": "3.0.0",
|
||||||
"@edx/frontend-platform": "8.1.2",
|
"@edx/frontend-platform": "8.1.2",
|
||||||
@@ -80,6 +82,7 @@
|
|||||||
"whatwg-fetch": "^3.6.2"
|
"whatwg-fetch": "^3.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@edx/browserslist-config": "^1.3.0",
|
||||||
"@edx/reactifex": "^2.1.1",
|
"@edx/reactifex": "^2.1.1",
|
||||||
"@openedx/frontend-build": "14.1.5",
|
"@openedx/frontend-build": "14.1.5",
|
||||||
"@testing-library/jest-dom": "^5.14.1",
|
"@testing-library/jest-dom": "^5.14.1",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const configuration = {
|
|||||||
LOGO_URL: process.env.LOGO_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
ENABLE_EDX_PERSONAL_DASHBOARD: process.env.ENABLE_EDX_PERSONAL_DASHBOARD === 'true',
|
ENABLE_EDX_PERSONAL_DASHBOARD: process.env.ENABLE_EDX_PERSONAL_DASHBOARD === 'true',
|
||||||
SEARCH_CATALOG_URL: process.env.SEARCH_CATALOG_URL || null,
|
SEARCH_CATALOG_URL: process.env.SEARCH_CATALOG_URL || null,
|
||||||
|
ENABLE_PROGRAMS: process.env.ENABLE_PROGRAMS === 'true',
|
||||||
};
|
};
|
||||||
|
|
||||||
const features = {};
|
const features = {};
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ const getLearnerHeaderMenu = (
|
|||||||
content: formatMessage(messages.course),
|
content: formatMessage(messages.course),
|
||||||
isActive: true,
|
isActive: true,
|
||||||
},
|
},
|
||||||
{
|
...(getConfig().ENABLE_PROGRAMS ? [{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
href: `${urls.programsUrl()}`,
|
href: `${urls.programsUrl()}`,
|
||||||
content: formatMessage(messages.program),
|
content: formatMessage(messages.program),
|
||||||
},
|
}] : []),
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
href: `${urls.baseAppUrl(courseSearchUrl)}`,
|
href: `${urls.baseAppUrl(courseSearchUrl)}`,
|
||||||
@@ -32,11 +32,11 @@ const getLearnerHeaderMenu = (
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
secondaryMenu: [
|
secondaryMenu: [
|
||||||
{
|
...(getConfig().SUPPORT_URL ? [{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
href: `${getConfig().SUPPORT_URL}`,
|
href: `${getConfig().SUPPORT_URL}`,
|
||||||
content: formatMessage(messages.help),
|
content: formatMessage(messages.help),
|
||||||
},
|
}] : []),
|
||||||
],
|
],
|
||||||
userMenu: [
|
userMenu: [
|
||||||
{
|
{
|
||||||
@@ -70,6 +70,7 @@ const getLearnerHeaderMenu = (
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export default getLearnerHeaderMenu;
|
export default getLearnerHeaderMenu;
|
||||||
|
|||||||
@@ -12,11 +12,6 @@ exports[`LearnerDashboardHeader render 1`] = `
|
|||||||
"isActive": true,
|
"isActive": true,
|
||||||
"type": "item",
|
"type": "item",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"content": "Programs",
|
|
||||||
"href": "http://localhost:18000/dashboard/programs",
|
|
||||||
"type": "item",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"content": "Discover New",
|
"content": "Discover New",
|
||||||
"href": "http://localhost:18000/course-search-url",
|
"href": "http://localhost:18000/course-search-url",
|
||||||
@@ -25,15 +20,7 @@ exports[`LearnerDashboardHeader render 1`] = `
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
secondaryMenuItems={
|
secondaryMenuItems={[]}
|
||||||
[
|
|
||||||
{
|
|
||||||
"content": "Help",
|
|
||||||
"href": "http://localhost:18000/support",
|
|
||||||
"type": "item",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
userMenuItems={
|
userMenuItems={
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ describe('LearnerDashboardHeader hooks', () => {
|
|||||||
username: 'test',
|
username: 'test',
|
||||||
};
|
};
|
||||||
const learnerHomeHeaderMenu = useLearnerDashboardHeaderMenu({ courseSearchUrl, authenticatedUser });
|
const learnerHomeHeaderMenu = useLearnerDashboardHeaderMenu({ courseSearchUrl, authenticatedUser });
|
||||||
expect(learnerHomeHeaderMenu.mainMenu.length).toBe(3);
|
expect(learnerHomeHeaderMenu.mainMenu.length).toBe(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,19 @@ describe('LearnerDashboardHeader', () => {
|
|||||||
expect(wrapper.instance.findByType('ConfirmEmailBanner')).toHaveLength(1);
|
expect(wrapper.instance.findByType('ConfirmEmailBanner')).toHaveLength(1);
|
||||||
expect(wrapper.instance.findByType('MasqueradeBar')).toHaveLength(1);
|
expect(wrapper.instance.findByType('MasqueradeBar')).toHaveLength(1);
|
||||||
expect(wrapper.instance.findByType(Header)).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(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(<LearnerDashboardHeader />);
|
||||||
|
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(<LearnerDashboardHeader />);
|
||||||
|
expect(wrapper.instance.findByType(Header)[0].props.mainMenuItems.length).toBe(3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,27 +2,14 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
||||||
|
|
||||||
import { reduxHooks } from 'hooks';
|
const CourseCardActionSlot = ({ cardId }) => (
|
||||||
import UpgradeButton from 'containers/CourseCard/components/CourseCardActions/UpgradeButton';
|
<PluginSlot
|
||||||
|
id="course_card_action_slot"
|
||||||
const CourseCardActionSlot = ({ cardId }) => {
|
pluginProps={{
|
||||||
const { isEntitlement } = reduxHooks.useCardEntitlementData(cardId);
|
cardId,
|
||||||
const {
|
}}
|
||||||
isVerified,
|
/>
|
||||||
isExecEd2UCourse,
|
);
|
||||||
} = reduxHooks.useCardEnrollmentData(cardId);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PluginSlot
|
|
||||||
id="course_card_action_slot"
|
|
||||||
pluginProps={{
|
|
||||||
cardId,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{!(isEntitlement || isVerified || isExecEd2UCourse) && <UpgradeButton cardId={cardId} />}
|
|
||||||
</PluginSlot>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
CourseCardActionSlot.propTypes = {
|
CourseCardActionSlot.propTypes = {
|
||||||
cardId: PropTypes.string.isRequired,
|
cardId: PropTypes.string.isRequired,
|
||||||
|
|||||||
Reference in New Issue
Block a user