Skip to content

Commit 57d09af

Browse files
kiram15jsnwesson
authored andcommitted
fix: PR requests
1 parent 86fd293 commit 57d09af

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

src/containers/Dashboard/index.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export const Dashboard = () => {
1515
hooks.useInitializeDashboard();
1616
const { pageTitle } = hooks.useDashboardMessages();
1717
const hasCourses = reduxHooks.useHasCourses();
18-
const hasAvailableDashboards = reduxHooks.useHasAvailableDashboards();
1918
const initIsPending = reduxHooks.useRequestIsPending(RequestKeys.initialize);
2019
const showSelectSessionModal = reduxHooks.useShowSelectSessionModal();
2120

@@ -24,7 +23,7 @@ export const Dashboard = () => {
2423
<h1 className="sr-only">{pageTitle}</h1>
2524
{!initIsPending && (
2625
<>
27-
{hasAvailableDashboards && <DashboardModalSlot />}
26+
<DashboardModalSlot />
2827
{(hasCourses && showSelectSessionModal) && <SelectSessionModal />}
2928
</>
3029
)}

src/containers/Dashboard/index.test.jsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import Dashboard from '.';
1414
jest.mock('hooks', () => ({
1515
reduxHooks: {
1616
useHasCourses: jest.fn(),
17-
useHasAvailableDashboards: jest.fn(),
1817
useShowSelectSessionModal: jest.fn(),
1918
useRequestIsPending: jest.fn(),
2019
},
@@ -38,12 +37,10 @@ describe('Dashboard', () => {
3837
});
3938
const createWrapper = ({
4039
hasCourses,
41-
hasAvailableDashboards,
4240
initIsPending,
4341
showSelectSessionModal,
4442
}) => {
4543
reduxHooks.useHasCourses.mockReturnValueOnce(hasCourses);
46-
reduxHooks.useHasAvailableDashboards.mockReturnValueOnce(hasAvailableDashboards);
4744
reduxHooks.useRequestIsPending.mockReturnValueOnce(initIsPending);
4845
reduxHooks.useShowSelectSessionModal.mockReturnValueOnce(showSelectSessionModal);
4946
return shallow(<Dashboard />);
@@ -80,7 +77,7 @@ describe('Dashboard', () => {
8077
it(`renders ${contentName}`, () => {
8178
testContent(contentEl);
8279
});
83-
it(`${renderString(showEnterpriseModal)} dashbaord modal`, () => {
80+
it(`${renderString(showEnterpriseModal)} dashboard modal`, () => {
8481
expect(wrapper.instance.findByType(DashboardModalSlot).length)
8582
.toEqual(showEnterpriseModal ? 1 : 0);
8683
});
@@ -92,7 +89,6 @@ describe('Dashboard', () => {
9289
testView({
9390
props: {
9491
hasCourses: false,
95-
hasAvailableDashboards: false,
9692
initIsPending: true,
9793
showSelectSessionModal: false,
9894
},
@@ -102,11 +98,10 @@ describe('Dashboard', () => {
10298
});
10399
});
104100

105-
describe('courses loaded, show select session modal, no available dashboards', () => {
101+
describe('courses loaded, show select session modal', () => {
106102
testView({
107103
props: {
108104
hasCourses: true,
109-
hasAvailableDashboards: false,
110105
initIsPending: false,
111106
showSelectSessionModal: true,
112107
},
@@ -118,11 +113,10 @@ describe('Dashboard', () => {
118113
});
119114
});
120115

121-
describe('there are no courses, there ARE available dashboards', () => {
116+
describe('there are no courses', () => {
122117
testView({
123118
props: {
124119
hasCourses: false,
125-
hasAvailableDashboards: true,
126120
initIsPending: false,
127121
showSelectSessionModal: false,
128122
},

src/data/redux/hooks/app.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const useSocialShareSettings = () => useSelector(selectors.socialShareSet
1818

1919
/** global-level meta-selectors **/
2020
export const useHasCourses = () => useSelector(selectors.hasCourses);
21-
export const useHasAvailableDashboards = () => useSelector(selectors.hasAvailableDashboards);
2221
export const useCurrentCourseList = (opts) => useSelector(
2322
state => selectors.currentList(state, opts),
2423
);

src/plugin-slots/DashboardModalSlot/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44

55
## Description
66

7-
This slot is used for the modal on a dashboard that directs you to the enterprise dashboard if applicable.
7+
This slot is used for the modal on a dashboard that appears on initial load.
88
The following `env.config.jsx` will render the modal.
99

10+
## Example
11+
12+
Learner dashboard will show modal on initial load
13+
![Screenshot of the dashboard modal](./images/widget_sidebar_slot.png)
14+
1015
```js
1116
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
12-
import { DashboardModal } from '@edx/frontend-plugin-learner-dashboard';
17+
import { ModalDialog } from '@openedx/paragon';
1318

1419
const config = {
1520
pluginSlots: {
@@ -21,10 +26,8 @@ const config = {
2126
id: 'dashboard_modal',
2227
type: DIRECT_PLUGIN,
2328
priority: 60,
24-
RenderWidget: DashboardModal,
25-
content: {
26-
store,
27-
},
29+
RenderWidget:
30+
<ModalDialog title="Modal that appears on initial render of learner dashboard" />,
2831
},
2932
},
3033
],
187 KB
Loading

0 commit comments

Comments
 (0)