Skip to content

Commit 3663efb

Browse files
committed
feat!: remove custom header settings
1 parent 9ef5840 commit 3663efb

File tree

8 files changed

+9
-402
lines changed

8 files changed

+9
-402
lines changed

src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx

Lines changed: 0 additions & 77 deletions
This file was deleted.

src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,7 @@
33
exports[`LearnerDashboardHeader render 1`] = `
44
<Fragment>
55
<ConfirmEmailBanner />
6-
<Header
7-
mainMenuItems={
8-
[
9-
{
10-
"content": "Courses",
11-
"href": "/",
12-
"isActive": true,
13-
"type": "item",
14-
},
15-
{
16-
"content": "Discover New",
17-
"href": "http://localhost:18000/course-search-url",
18-
"onClick": [Function],
19-
"type": "item",
20-
},
21-
]
22-
}
23-
secondaryMenuItems={[]}
24-
userMenuItems={
25-
[
26-
{
27-
"heading": "",
28-
"items": [
29-
{
30-
"content": "Profile",
31-
"href": "http://account-profile-url.test/u/undefined",
32-
"type": "item",
33-
},
34-
{
35-
"content": "Account",
36-
"href": "http://account-settings-url.test",
37-
"type": "item",
38-
},
39-
{
40-
"content": "Order History",
41-
"href": "test-url",
42-
"type": "item",
43-
},
44-
],
45-
},
46-
{
47-
"heading": "",
48-
"items": [
49-
{
50-
"content": "Sign Out",
51-
"href": "http://localhost:18000/logout",
52-
"type": "item",
53-
},
54-
],
55-
},
56-
]
57-
}
58-
/>
6+
<Header />
597
<MasqueradeBar />
608
</Fragment>
619
`;

src/containers/LearnerDashboardHeader/hooks.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/containers/LearnerDashboardHeader/hooks.test.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/containers/LearnerDashboardHeader/index.jsx

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,16 @@
11
import React from 'react';
22

3-
import MasqueradeBar from 'containers/MasqueradeBar';
4-
import { AppContext } from '@edx/frontend-platform/react';
53
import Header from '@edx/frontend-component-header';
6-
import { reduxHooks } from 'hooks';
7-
import urls from 'data/services/lms/urls';
8-
4+
import MasqueradeBar from 'containers/MasqueradeBar';
95
import ConfirmEmailBanner from './ConfirmEmailBanner';
106

11-
import { useLearnerDashboardHeaderMenu, findCoursesNavClicked } from './hooks';
12-
13-
import './index.scss';
14-
15-
export const LearnerDashboardHeader = () => {
16-
const { authenticatedUser } = React.useContext(AppContext);
17-
const { courseSearchUrl } = reduxHooks.usePlatformSettingsData();
18-
19-
const exploreCoursesClick = () => {
20-
findCoursesNavClicked(urls.baseAppUrl(courseSearchUrl));
21-
};
22-
23-
const learnerHomeHeaderMenu = useLearnerDashboardHeaderMenu({
24-
courseSearchUrl,
25-
authenticatedUser,
26-
exploreCoursesClick,
27-
});
28-
29-
return (
30-
<>
31-
<ConfirmEmailBanner />
32-
<Header
33-
mainMenuItems={learnerHomeHeaderMenu.mainMenu}
34-
secondaryMenuItems={learnerHomeHeaderMenu.secondaryMenu}
35-
userMenuItems={learnerHomeHeaderMenu.userMenu}
36-
/>
37-
<MasqueradeBar />
38-
</>
39-
);
40-
};
7+
export const LearnerDashboardHeader = () => (
8+
<>
9+
<ConfirmEmailBanner />
10+
<Header />
11+
<MasqueradeBar />
12+
</>
13+
);
4114

4215
LearnerDashboardHeader.propTypes = {};
4316

src/containers/LearnerDashboardHeader/index.scss

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,18 @@
1-
import { mergeConfig } from '@edx/frontend-platform';
21
import { shallow } from '@edx/react-unit-test-utils';
32
import Header from '@edx/frontend-component-header';
43

5-
import urls from 'data/services/lms/urls';
64
import LearnerDashboardHeader from '.';
7-
import { findCoursesNavClicked } from './hooks';
85

9-
jest.mock('hooks', () => ({
10-
reduxHooks: {
11-
usePlatformSettingsData: jest.fn(() => ({
12-
courseSearchUrl: '/course-search-url',
13-
})),
14-
},
15-
}));
16-
jest.mock('./hooks', () => ({
17-
...jest.requireActual('./hooks'),
18-
findCoursesNavClicked: jest.fn(),
19-
}));
206
jest.mock('containers/MasqueradeBar', () => 'MasqueradeBar');
217
jest.mock('./ConfirmEmailBanner', () => 'ConfirmEmailBanner');
228
jest.mock('@edx/frontend-component-header', () => 'Header');
239

2410
describe('LearnerDashboardHeader', () => {
2511
test('render', () => {
26-
mergeConfig({ ORDER_HISTORY_URL: 'test-url' });
2712
const wrapper = shallow(<LearnerDashboardHeader />);
2813
expect(wrapper.snapshot).toMatchSnapshot();
2914
expect(wrapper.instance.findByType('ConfirmEmailBanner')).toHaveLength(1);
3015
expect(wrapper.instance.findByType('MasqueradeBar')).toHaveLength(1);
3116
expect(wrapper.instance.findByType(Header)).toHaveLength(1);
32-
wrapper.instance.findByType(Header)[0].props.mainMenuItems[1].onClick();
33-
expect(findCoursesNavClicked).toHaveBeenCalledWith(urls.baseAppUrl('/course-search-url'));
34-
expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(0);
35-
});
36-
37-
test('should display Help link if SUPPORT_URL is set', () => {
38-
mergeConfig({ SUPPORT_URL: 'http://localhost:18000/support' });
39-
const wrapper = shallow(<LearnerDashboardHeader />);
40-
expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(1);
41-
});
42-
test('should display Programs link if it is enabled by configuration', () => {
43-
mergeConfig({ ENABLE_PROGRAMS: true });
44-
const wrapper = shallow(<LearnerDashboardHeader />);
45-
expect(wrapper.instance.findByType(Header)[0].props.mainMenuItems.length).toBe(3);
46-
});
47-
test('should not display Discover New tab if it is disabled by configuration', () => {
48-
mergeConfig({ NON_BROWSABLE_COURSES: true });
49-
const wrapper = shallow(<LearnerDashboardHeader />);
50-
expect(wrapper.instance.findByType(Header)[0].props.mainMenuItems.length).toBe(2);
5117
});
5218
});

0 commit comments

Comments
 (0)