From 2f9e410f8983b7a8d2d05bd75f71342e64904754 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Fri, 3 May 2024 15:06:16 -0400 Subject: [PATCH] feat!: organize plugin slots as components, add footer slot BREAKING CHANGE: slot ids have been changed for consistency * `sequence_container_plugin` -> `sequence_container_slot` * `unit_title_plugin` -> `unit_title_slot` --- README.rst | 6 +++ src/courseware/course/sequence/Sequence.jsx | 10 +--- src/courseware/course/sequence/Unit/index.jsx | 10 +--- src/generic/CourseAccessErrorPage.jsx | 6 +-- src/plugin-slots/FooterSlot/README.md | 44 ++++++++++++++++++ .../FooterSlot/images/custom_footer.png | Bin 0 -> 5801 bytes .../FooterSlot/images/default_footer.png | Bin 0 -> 6289 bytes src/plugin-slots/FooterSlot/index.jsx | 10 ++++ src/plugin-slots/README.md | 5 ++ .../SequenceContainerSlot/README.md | 41 ++++++++++++++++ .../images/post_sequence_container.png | Bin 0 -> 40762 bytes .../SequenceContainerSlot/index.jsx | 23 +++++++++ src/plugin-slots/UnitTitleSlot/README.md | 41 ++++++++++++++++ .../UnitTitleSlot/images/post_unit_title.png | Bin 0 -> 48624 bytes src/plugin-slots/UnitTitleSlot/index.jsx | 19 ++++++++ src/tab-page/TabPage.jsx | 4 +- 16 files changed, 198 insertions(+), 21 deletions(-) create mode 100644 src/plugin-slots/FooterSlot/README.md create mode 100644 src/plugin-slots/FooterSlot/images/custom_footer.png create mode 100644 src/plugin-slots/FooterSlot/images/default_footer.png create mode 100644 src/plugin-slots/FooterSlot/index.jsx create mode 100644 src/plugin-slots/README.md create mode 100644 src/plugin-slots/SequenceContainerSlot/README.md create mode 100644 src/plugin-slots/SequenceContainerSlot/images/post_sequence_container.png create mode 100644 src/plugin-slots/SequenceContainerSlot/index.jsx create mode 100644 src/plugin-slots/UnitTitleSlot/README.md create mode 100644 src/plugin-slots/UnitTitleSlot/images/post_unit_title.png create mode 100644 src/plugin-slots/UnitTitleSlot/index.jsx diff --git a/README.rst b/README.rst index 6357e55302..33e1fd9762 100644 --- a/README.rst +++ b/README.rst @@ -100,6 +100,12 @@ The Learning MFE is similar to all the other Open edX MFEs. Read the Open edX Developer Guide's section on `MFE applications `_. +Plugins +======= +This MFE can be customized using `Frontend Plugin Framework `_. + +The parts of this MFE that can be customized in that manner are documented `here `_. + Environment Variables ====================== diff --git a/src/courseware/course/sequence/Sequence.jsx b/src/courseware/course/sequence/Sequence.jsx index 949a77f668..f2e7fc84fd 100644 --- a/src/courseware/course/sequence/Sequence.jsx +++ b/src/courseware/course/sequence/Sequence.jsx @@ -13,7 +13,7 @@ import { useIntl } from '@edx/frontend-platform/i18n'; import { useSelector } from 'react-redux'; import SequenceExamWrapper from '@edx/frontend-lib-special-exams'; import { breakpoints, useWindowSize } from '@openedx/paragon'; -import { PluginSlot } from '@openedx/frontend-plugin-framework'; +import SequenceContainerSlot from '../../../plugin-slots/SequenceContainerSlot'; import PageLoading from '../../../generic/PageLoading'; import { useModel } from '../../../generic/model-store'; @@ -200,13 +200,7 @@ const Sequence = ({ {isNewDiscussionSidebarViewEnabled ? : } - + ); diff --git a/src/courseware/course/sequence/Unit/index.jsx b/src/courseware/course/sequence/Unit/index.jsx index 99b114850d..e9769917bc 100644 --- a/src/courseware/course/sequence/Unit/index.jsx +++ b/src/courseware/course/sequence/Unit/index.jsx @@ -7,7 +7,6 @@ import { useIntl } from '@edx/frontend-platform/i18n'; import { useModel } from '@src/generic/model-store'; import { usePluginsCallback } from '@src/generic/plugin-store'; -import { PluginSlot } from '@openedx/frontend-plugin-framework'; import BookmarkButton from '../../bookmark/BookmarkButton'; import messages from '../messages'; import ContentIFrame from './ContentIFrame'; @@ -15,6 +14,7 @@ import UnitSuspense from './UnitSuspense'; import { modelKeys, views } from './constants'; import { useExamAccess, useShouldDisplayHonorCode } from './hooks'; import { getIFrameUrl } from './urls'; +import UnitTitleSlot from '../../../../plugin-slots/UnitTitleSlot'; const Unit = ({ courseId, @@ -43,13 +43,7 @@ const Unit = ({

{unit.title}

- +

{formatMessage(messages.headerPlaceholder)}

{ -