Skip to content

Commit f110a0a

Browse files
kiram15jsnwesson
authored andcommitted
feat: adding new plugin slot for an enterprise modal
1 parent 93bd883 commit f110a0a

File tree

9 files changed

+48
-163
lines changed

9 files changed

+48
-163
lines changed

src/containers/Dashboard/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from 'react';
22

33
import { reduxHooks } from 'hooks';
44
import { RequestKeys } from 'data/constants/requests';
5-
import EnterpriseDashboardModal from 'containers/EnterpriseDashboardModal';
65
import SelectSessionModal from 'containers/SelectSessionModal';
76
import CoursesPanel from 'containers/CoursesPanel';
7+
import EnterpriseDashboardModalSlot from 'plugin-slots/EnterpriseDashboardModalSlot';
88

99
import LoadingView from './LoadingView';
1010
import DashboardLayout from './DashboardLayout';
@@ -24,7 +24,7 @@ export const Dashboard = () => {
2424
<h1 className="sr-only">{pageTitle}</h1>
2525
{!initIsPending && (
2626
<>
27-
{hasAvailableDashboards && <EnterpriseDashboardModal />}
27+
{hasAvailableDashboards && <EnterpriseDashboardModalSlot />}
2828
{(hasCourses && showSelectSessionModal) && <SelectSessionModal />}
2929
</>
3030
)}

src/containers/Dashboard/index.test.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { shallow } from '@edx/react-unit-test-utils';
22

33
import { reduxHooks } from 'hooks';
44

5-
import EnterpriseDashboardModal from 'containers/EnterpriseDashboardModal';
65
import SelectSessionModal from 'containers/SelectSessionModal';
76
import CoursesPanel from 'containers/CoursesPanel';
7+
import EnterpriseDashboardModalSlot from 'plugin-slots/EnterpriseDashboardModalSlot';
88

99
import DashboardLayout from './DashboardLayout';
1010
import LoadingView from './LoadingView';
@@ -20,7 +20,7 @@ jest.mock('hooks', () => ({
2020
},
2121
}));
2222

23-
jest.mock('containers/EnterpriseDashboardModal', () => 'EnterpriseDashboardModal');
23+
jest.mock('plugin-slots/EnterpriseDashboardModalSlot', () => 'EnterpriseDashboardModalSlot');
2424
jest.mock('containers/CoursesPanel', () => 'CoursesPanel');
2525
jest.mock('./LoadingView', () => 'LoadingView');
2626
jest.mock('./DashboardLayout', () => 'DashboardLayout');
@@ -81,7 +81,7 @@ describe('Dashboard', () => {
8181
testContent(contentEl);
8282
});
8383
it(`${renderString(showEnterpriseModal)} dashbaord modal`, () => {
84-
expect(wrapper.instance.findByType(EnterpriseDashboardModal).length)
84+
expect(wrapper.instance.findByType(EnterpriseDashboardModalSlot).length)
8585
.toEqual(showEnterpriseModal ? 1 : 0);
8686
});
8787
it(`${renderString(showSelectSessionModal)} select session modal`, () => {

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

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

src/containers/EnterpriseDashboardModal/index.jsx

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

src/containers/EnterpriseDashboardModal/index.test.jsx

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

src/containers/EnterpriseDashboardModal/messages.js

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Course Card Action Slot
2+
3+
### Slot ID: `enterprise_dashboard_modal_slot`
4+
5+
## Description
6+
7+
This slot is used for the modal on a dashboard that directs you to the enterprise dashboard if applicable.
8+
The following `env.config.jsx` will render the modal.
9+
10+
```js
11+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
12+
import { EnterpriseDashboardModal } from '@edx/frontend-plugin-learner-dashboard';
13+
14+
const config = {
15+
pluginSlots: {
16+
enterprise_dashboard_modal_slot: {
17+
plugins: [
18+
{
19+
op: PLUGIN_OPERATIONS.Insert,
20+
widget: {
21+
id: 'dashboard_modal',
22+
type: DIRECT_PLUGIN,
23+
priority: 60,
24+
RenderWidget: EnterpriseDashboardModal,
25+
},
26+
},
27+
],
28+
}
29+
},
30+
}
31+
32+
export default config;
33+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react';
2+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
3+
4+
const EnterpriseDashboardModal = () => (
5+
<PluginSlot id="enterprise_dashboard_modal_slot" />
6+
);
7+
8+
export default EnterpriseDashboardModal;

src/plugin-slots/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
* [`footer_slot`](./FooterSlot/)
55
* [`widget_sidebar_slot`](./WidgetSidebarSlot/)
66
* [`course_list_slot`](./CourseListSlot/)
7-
* [`no_courses_view_slot`](./NoCoursesViewSlot/)
7+
* [`no_courses_view_slot`](./NoCoursesViewSlot/)
8+
* [`enterprise_dashboard_modal_slot](./EnterpriseDashboardModalSlot)

0 commit comments

Comments
 (0)