Skip to content

Commit 44c7978

Browse files
committed
Revert "fix: PR requests"
This reverts commit 57d09af.
1 parent 3ea088e commit 44c7978

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

src/containers/Dashboard/index.jsx

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

@@ -23,7 +24,7 @@ export const Dashboard = () => {
2324
<h1 className="sr-only">{pageTitle}</h1>
2425
{!initIsPending && (
2526
<>
26-
<DashboardModalSlot />
27+
{hasAvailableDashboards && <DashboardModalSlot />}
2728
{(hasCourses && showSelectSessionModal) && <SelectSessionModal />}
2829
</>
2930
)}

src/containers/Dashboard/index.test.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Dashboard from '.';
1414
jest.mock('hooks', () => ({
1515
reduxHooks: {
1616
useHasCourses: jest.fn(),
17+
useHasAvailableDashboards: jest.fn(),
1718
useShowSelectSessionModal: jest.fn(),
1819
useRequestIsPending: jest.fn(),
1920
},
@@ -37,10 +38,12 @@ describe('Dashboard', () => {
3738
});
3839
const createWrapper = ({
3940
hasCourses,
41+
hasAvailableDashboards,
4042
initIsPending,
4143
showSelectSessionModal,
4244
}) => {
4345
reduxHooks.useHasCourses.mockReturnValueOnce(hasCourses);
46+
reduxHooks.useHasAvailableDashboards.mockReturnValueOnce(hasAvailableDashboards);
4447
reduxHooks.useRequestIsPending.mockReturnValueOnce(initIsPending);
4548
reduxHooks.useShowSelectSessionModal.mockReturnValueOnce(showSelectSessionModal);
4649
return shallow(<Dashboard />);
@@ -77,7 +80,7 @@ describe('Dashboard', () => {
7780
it(`renders ${contentName}`, () => {
7881
testContent(contentEl);
7982
});
80-
it(`${renderString(showEnterpriseModal)} dashboard modal`, () => {
83+
it(`${renderString(showEnterpriseModal)} dashbaord modal`, () => {
8184
expect(wrapper.instance.findByType(DashboardModalSlot).length)
8285
.toEqual(showEnterpriseModal ? 1 : 0);
8386
});
@@ -89,6 +92,7 @@ describe('Dashboard', () => {
8992
testView({
9093
props: {
9194
hasCourses: false,
95+
hasAvailableDashboards: false,
9296
initIsPending: true,
9397
showSelectSessionModal: false,
9498
},
@@ -98,10 +102,11 @@ describe('Dashboard', () => {
98102
});
99103
});
100104

101-
describe('courses loaded, show select session modal', () => {
105+
describe('courses loaded, show select session modal, no available dashboards', () => {
102106
testView({
103107
props: {
104108
hasCourses: true,
109+
hasAvailableDashboards: false,
105110
initIsPending: false,
106111
showSelectSessionModal: true,
107112
},
@@ -113,10 +118,11 @@ describe('Dashboard', () => {
113118
});
114119
});
115120

116-
describe('there are no courses', () => {
121+
describe('there are no courses, there ARE available dashboards', () => {
117122
testView({
118123
props: {
119124
hasCourses: false,
125+
hasAvailableDashboards: true,
120126
initIsPending: false,
121127
showSelectSessionModal: false,
122128
},

src/data/redux/hooks/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ 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);
2122
export const useCurrentCourseList = (opts) => useSelector(
2223
state => selectors.currentList(state, opts),
2324
);

src/plugin-slots/DashboardModalSlot/README.md

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

55
## Description
66

7-
This slot is used for the modal on a dashboard that appears on initial load.
7+
This slot is used for the modal on a dashboard that directs you to the enterprise dashboard if applicable.
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-
1510
```js
1611
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
17-
import { ModalDialog } from '@openedx/paragon';
12+
import { DashboardModal } from '@edx/frontend-plugin-learner-dashboard';
1813

1914
const config = {
2015
pluginSlots: {
@@ -26,8 +21,10 @@ const config = {
2621
id: 'dashboard_modal',
2722
type: DIRECT_PLUGIN,
2823
priority: 60,
29-
RenderWidget:
30-
<ModalDialog title="Modal that appears on initial render of learner dashboard" />,
24+
RenderWidget: DashboardModal,
25+
content: {
26+
store,
27+
},
3128
},
3229
},
3330
],
Binary file not shown.

0 commit comments

Comments
 (0)