From 91b2e77ee3dc3f0748c50a703f189e8b7a0ee241 Mon Sep 17 00:00:00 2001 From: Kira Miller Date: Wed, 12 Feb 2025 20:15:01 +0000 Subject: [PATCH] fix: renaming slot --- .../Dashboard/__snapshots__/index.test.jsx.snap | 2 +- src/containers/Dashboard/index.jsx | 4 ++-- src/containers/Dashboard/index.test.jsx | 6 +++--- .../hooks.js | 0 .../hooks.test.js | 0 .../README.md | 8 ++++---- src/plugin-slots/DashboardModalSlot/index.jsx | 8 ++++++++ .../EnterpriseDashboardModalSlot/index.jsx | 8 -------- src/plugin-slots/README.md | 2 +- src/tracking/constants.js | 12 ++++++------ src/tracking/trackers/enterpriseDashboard.js | 6 +++--- src/tracking/trackers/enterpriseDashboard.test.js | 6 +++--- 12 files changed, 31 insertions(+), 31 deletions(-) rename src/containers/{EnterpriseDashboardModal => DashboardModal}/hooks.js (100%) rename src/containers/{EnterpriseDashboardModal => DashboardModal}/hooks.test.js (100%) rename src/plugin-slots/{EnterpriseDashboardModalSlot => DashboardModalSlot}/README.md (72%) create mode 100644 src/plugin-slots/DashboardModalSlot/index.jsx delete mode 100644 src/plugin-slots/EnterpriseDashboardModalSlot/index.jsx diff --git a/src/containers/Dashboard/__snapshots__/index.test.jsx.snap b/src/containers/Dashboard/__snapshots__/index.test.jsx.snap index 36570580..1f6b0985 100644 --- a/src/containers/Dashboard/__snapshots__/index.test.jsx.snap +++ b/src/containers/Dashboard/__snapshots__/index.test.jsx.snap @@ -54,7 +54,7 @@ exports[`Dashboard snapshots there are no courses, there ARE available dashboard test-page-title - +
{

{pageTitle}

{!initIsPending && ( <> - {hasAvailableDashboards && } + {hasAvailableDashboards && } {(hasCourses && showSelectSessionModal) && } )} diff --git a/src/containers/Dashboard/index.test.jsx b/src/containers/Dashboard/index.test.jsx index 86886ba0..6080dd3a 100644 --- a/src/containers/Dashboard/index.test.jsx +++ b/src/containers/Dashboard/index.test.jsx @@ -4,7 +4,7 @@ import { reduxHooks } from 'hooks'; import SelectSessionModal from 'containers/SelectSessionModal'; import CoursesPanel from 'containers/CoursesPanel'; -import EnterpriseDashboardModalSlot from 'plugin-slots/EnterpriseDashboardModalSlot'; +import DashboardModalSlot from 'plugin-slots/DashboardModalSlot'; import DashboardLayout from './DashboardLayout'; import LoadingView from './LoadingView'; @@ -20,7 +20,7 @@ jest.mock('hooks', () => ({ }, })); -jest.mock('plugin-slots/EnterpriseDashboardModalSlot', () => 'EnterpriseDashboardModalSlot'); +jest.mock('plugin-slots/DashboardModalSlot', () => 'DashboardModalSlot'); jest.mock('containers/CoursesPanel', () => 'CoursesPanel'); jest.mock('./LoadingView', () => 'LoadingView'); jest.mock('./DashboardLayout', () => 'DashboardLayout'); @@ -81,7 +81,7 @@ describe('Dashboard', () => { testContent(contentEl); }); it(`${renderString(showEnterpriseModal)} dashbaord modal`, () => { - expect(wrapper.instance.findByType(EnterpriseDashboardModalSlot).length) + expect(wrapper.instance.findByType(DashboardModalSlot).length) .toEqual(showEnterpriseModal ? 1 : 0); }); it(`${renderString(showSelectSessionModal)} select session modal`, () => { diff --git a/src/containers/EnterpriseDashboardModal/hooks.js b/src/containers/DashboardModal/hooks.js similarity index 100% rename from src/containers/EnterpriseDashboardModal/hooks.js rename to src/containers/DashboardModal/hooks.js diff --git a/src/containers/EnterpriseDashboardModal/hooks.test.js b/src/containers/DashboardModal/hooks.test.js similarity index 100% rename from src/containers/EnterpriseDashboardModal/hooks.test.js rename to src/containers/DashboardModal/hooks.test.js diff --git a/src/plugin-slots/EnterpriseDashboardModalSlot/README.md b/src/plugin-slots/DashboardModalSlot/README.md similarity index 72% rename from src/plugin-slots/EnterpriseDashboardModalSlot/README.md rename to src/plugin-slots/DashboardModalSlot/README.md index f2a7e70b..9477accd 100644 --- a/src/plugin-slots/EnterpriseDashboardModalSlot/README.md +++ b/src/plugin-slots/DashboardModalSlot/README.md @@ -1,6 +1,6 @@ # Course Card Action Slot -### Slot ID: `enterprise_dashboard_modal_slot` +### Slot ID: `dashboard_modal_slot` ## Description @@ -9,11 +9,11 @@ The following `env.config.jsx` will render the modal. ```js import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; -import { EnterpriseDashboardModal } from '@edx/frontend-plugin-learner-dashboard'; +import { DashboardModal } from '@edx/frontend-plugin-learner-dashboard'; const config = { pluginSlots: { - enterprise_dashboard_modal_slot: { + dashboard_modal_slot: { plugins: [ { op: PLUGIN_OPERATIONS.Insert, @@ -21,7 +21,7 @@ const config = { id: 'dashboard_modal', type: DIRECT_PLUGIN, priority: 60, - RenderWidget: EnterpriseDashboardModal, + RenderWidget: DashboardModal, }, }, ], diff --git a/src/plugin-slots/DashboardModalSlot/index.jsx b/src/plugin-slots/DashboardModalSlot/index.jsx new file mode 100644 index 00000000..8926eeb9 --- /dev/null +++ b/src/plugin-slots/DashboardModalSlot/index.jsx @@ -0,0 +1,8 @@ +import React from 'react'; +import { PluginSlot } from '@openedx/frontend-plugin-framework'; + +const DashboardModal = () => ( + +); + +export default DashboardModal; diff --git a/src/plugin-slots/EnterpriseDashboardModalSlot/index.jsx b/src/plugin-slots/EnterpriseDashboardModalSlot/index.jsx deleted file mode 100644 index 288939ad..00000000 --- a/src/plugin-slots/EnterpriseDashboardModalSlot/index.jsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import { PluginSlot } from '@openedx/frontend-plugin-framework'; - -const EnterpriseDashboardModal = () => ( - -); - -export default EnterpriseDashboardModal; diff --git a/src/plugin-slots/README.md b/src/plugin-slots/README.md index 7a44f7e5..9adff41c 100644 --- a/src/plugin-slots/README.md +++ b/src/plugin-slots/README.md @@ -5,4 +5,4 @@ * [`widget_sidebar_slot`](./WidgetSidebarSlot/) * [`course_list_slot`](./CourseListSlot/) * [`no_courses_view_slot`](./NoCoursesViewSlot/) -* [`enterprise_dashboard_modal_slot](./EnterpriseDashboardModalSlot) \ No newline at end of file +* [`dashboard_modal_slot](./DashboardModalSlot) \ No newline at end of file diff --git a/src/tracking/constants.js b/src/tracking/constants.js index 4683019c..cc51a48d 100644 --- a/src/tracking/constants.js +++ b/src/tracking/constants.js @@ -20,9 +20,9 @@ export const events = StrictDict({ leaveSession: 'leaveSession', unenrollReason: 'unenrollReason', entitlementUnenrollReason: 'entitlementUnenrollReason', - enterpriseDashboardModalOpened: 'enterpriseDashboardModalOpened', - enterpriseDashboardModalCTAClicked: 'enterpriseDashboardModalCTAClicked', - enterpriseDashboardModalClosed: 'enterpriseDashboardModalClosed', + dashboardModalOpened: 'dashboardModalOpened', + dashboardModalCTAClicked: 'dashboardModalCTAClicked', + dashboardModalClosed: 'dashboardModalClosed', }); const learnerPortal = 'edx.ui.enterprise.lms.dashboard.learner_portal_modal'; @@ -39,9 +39,9 @@ export const eventNames = StrictDict({ leaveSession: 'course-dashboard.leave-session', unenrollReason: 'unenrollment_reason.selected', entitlementUnenrollReason: 'entitlement_unenrollment_reason.selected', - enterpriseDashboardModalOpened: `${learnerPortal}.opened`, - enterpriseDashboardModalCTAClicked: `${learnerPortal}.dashboard_cta.clicked`, - enterpriseDashboardModalClosed: `${learnerPortal}.closed`, + dashboardModalOpened: `${learnerPortal}.opened`, + dashboardModalCTAClicked: `${learnerPortal}.dashboard_cta.clicked`, + dashboardModalClosed: `${learnerPortal}.closed`, findCoursesClicked: 'edx.bi.dashboard.find_courses_button.clicked', purchaseCredit: 'edx.bi.credit.clicked_purchase_credit', filterClicked: 'course-dashboard.filter.clicked', diff --git a/src/tracking/trackers/enterpriseDashboard.js b/src/tracking/trackers/enterpriseDashboard.js index 26a3bd93..6707d168 100644 --- a/src/tracking/trackers/enterpriseDashboard.js +++ b/src/tracking/trackers/enterpriseDashboard.js @@ -8,7 +8,7 @@ import { eventNames } from '../constants'; * @return {func} - Callback that tracks the event when fired. */ export const modalOpened = (enterpriseUUID) => () => createEventTracker( - eventNames.enterpriseDashboardModalOpened, + eventNames.dashboardModalOpened, { enterpriseUUID }, ); @@ -20,7 +20,7 @@ export const modalOpened = (enterpriseUUID) => () => createEventTracker( */ export const modalCTAClicked = (enterpriseUUID, href) => createLinkTracker( createEventTracker( - eventNames.enterpriseDashboardModalCTAClicked, + eventNames.dashboardModalCTAClicked, { enterpriseUUID }, ), href, @@ -33,7 +33,7 @@ export const modalCTAClicked = (enterpriseUUID, href) => createLinkTracker( * @return {func} - Callback that tracks the event when fired. */ export const modalClosed = (enterpriseUUID, source) => createEventTracker( - eventNames.enterpriseDashboardModalClosed, + eventNames.dashboardModalClosed, { enterpriseUUID, source }, ); diff --git a/src/tracking/trackers/enterpriseDashboard.test.js b/src/tracking/trackers/enterpriseDashboard.test.js index cf47da5c..efbb62bc 100644 --- a/src/tracking/trackers/enterpriseDashboard.test.js +++ b/src/tracking/trackers/enterpriseDashboard.test.js @@ -15,7 +15,7 @@ describe('enterpriseDashboard trackers', () => { it('creates event tracker for dashboard modal opened event', () => { expect(trackers.modalOpened(enterpriseUUID, source)()).toEqual( createEventTracker( - eventNames.enterpriseDashboardModalOpened, + eventNames.dashboardModalOpened, { enterpriseUUID, source }, ), ); @@ -28,7 +28,7 @@ describe('enterpriseDashboard trackers', () => { expect(href).toEqual(testHref); expect(cb).toEqual( createEventTracker( - eventNames.enterpriseDashboardModalCTAClicked, + eventNames.dashboardModalCTAClicked, { enterpriseUUID, source }, ), ); @@ -38,7 +38,7 @@ describe('enterpriseDashboard trackers', () => { it('creates event tracker for dashboard modal closed event with close source', () => { expect(trackers.modalClosed(enterpriseUUID, source)).toEqual( createEventTracker( - eventNames.enterpriseDashboardModalClosed, + eventNames.dashboardModalClosed, { enterpriseUUID, source }, ), );