diff --git a/src/containers/Dashboard/index.jsx b/src/containers/Dashboard/index.jsx index 4c890ab5..ebdb1ef7 100644 --- a/src/containers/Dashboard/index.jsx +++ b/src/containers/Dashboard/index.jsx @@ -15,7 +15,6 @@ export const Dashboard = () => { hooks.useInitializeDashboard(); const { pageTitle } = hooks.useDashboardMessages(); const hasCourses = reduxHooks.useHasCourses(); - const hasAvailableDashboards = reduxHooks.useHasAvailableDashboards(); const initIsPending = reduxHooks.useRequestIsPending(RequestKeys.initialize); const showSelectSessionModal = reduxHooks.useShowSelectSessionModal(); @@ -24,7 +23,7 @@ export const Dashboard = () => {

{pageTitle}

{!initIsPending && ( <> - {hasAvailableDashboards && } + {(hasCourses && showSelectSessionModal) && } )} diff --git a/src/containers/Dashboard/index.test.jsx b/src/containers/Dashboard/index.test.jsx index 6080dd3a..2563cad7 100644 --- a/src/containers/Dashboard/index.test.jsx +++ b/src/containers/Dashboard/index.test.jsx @@ -14,7 +14,6 @@ import Dashboard from '.'; jest.mock('hooks', () => ({ reduxHooks: { useHasCourses: jest.fn(), - useHasAvailableDashboards: jest.fn(), useShowSelectSessionModal: jest.fn(), useRequestIsPending: jest.fn(), }, @@ -38,12 +37,10 @@ describe('Dashboard', () => { }); const createWrapper = ({ hasCourses, - hasAvailableDashboards, initIsPending, showSelectSessionModal, }) => { reduxHooks.useHasCourses.mockReturnValueOnce(hasCourses); - reduxHooks.useHasAvailableDashboards.mockReturnValueOnce(hasAvailableDashboards); reduxHooks.useRequestIsPending.mockReturnValueOnce(initIsPending); reduxHooks.useShowSelectSessionModal.mockReturnValueOnce(showSelectSessionModal); return shallow(); @@ -80,7 +77,7 @@ describe('Dashboard', () => { it(`renders ${contentName}`, () => { testContent(contentEl); }); - it(`${renderString(showEnterpriseModal)} dashbaord modal`, () => { + it(`${renderString(showEnterpriseModal)} dashboard modal`, () => { expect(wrapper.instance.findByType(DashboardModalSlot).length) .toEqual(showEnterpriseModal ? 1 : 0); }); @@ -92,7 +89,6 @@ describe('Dashboard', () => { testView({ props: { hasCourses: false, - hasAvailableDashboards: false, initIsPending: true, showSelectSessionModal: false, }, @@ -102,11 +98,10 @@ describe('Dashboard', () => { }); }); - describe('courses loaded, show select session modal, no available dashboards', () => { + describe('courses loaded, show select session modal', () => { testView({ props: { hasCourses: true, - hasAvailableDashboards: false, initIsPending: false, showSelectSessionModal: true, }, @@ -118,11 +113,10 @@ describe('Dashboard', () => { }); }); - describe('there are no courses, there ARE available dashboards', () => { + describe('there are no courses', () => { testView({ props: { hasCourses: false, - hasAvailableDashboards: true, initIsPending: false, showSelectSessionModal: false, }, diff --git a/src/plugin-slots/DashboardModalSlot/README.md b/src/plugin-slots/DashboardModalSlot/README.md index 1df0c343..d94312aa 100644 --- a/src/plugin-slots/DashboardModalSlot/README.md +++ b/src/plugin-slots/DashboardModalSlot/README.md @@ -4,12 +4,17 @@ ## Description -This slot is used for the modal on a dashboard that directs you to the enterprise dashboard if applicable. +This slot is used for the modal on a dashboard that appears on initial load. The following `env.config.jsx` will render the modal. +## Example + +Learner dashboard will show modal on initial load +![Screenshot of the dashboard modal](./images/widget_sidebar_slot.png) + ```js import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; -import { DashboardModal } from '@edx/frontend-plugin-learner-dashboard'; +import { ModalDialog } from '@openedx/paragon'; const config = { pluginSlots: { @@ -21,10 +26,8 @@ const config = { id: 'dashboard_modal', type: DIRECT_PLUGIN, priority: 60, - RenderWidget: DashboardModal, - content: { - store, - }, + RenderWidget: + , }, }, ], diff --git a/src/plugin-slots/DashboardModalSlot/images/widget_sidebar_slot.png b/src/plugin-slots/DashboardModalSlot/images/widget_sidebar_slot.png new file mode 100644 index 00000000..4e5ea4ba Binary files /dev/null and b/src/plugin-slots/DashboardModalSlot/images/widget_sidebar_slot.png differ