feat: convert right sidebar notification CTA to frontend plugin - #49
feat: convert right sidebar notification CTA to frontend plugin#49naincy128 wants to merge 4 commits into
Conversation
| const sidebarKey = `sidebar.${courseId}`; | ||
|
|
||
| // Config-driven panel list — upsell disabled by default per LP-591 | ||
| const enabledPanels = useMemo(() => { |
There was a problem hiding this comment.
It looks like RIGHT_SIDEBAR_PANELS is only used by the new sidebar. The old sidebar still has Notifications and Discussions hard-coded.
Is LP-591 meant to cover only the new sidebar controlled by isNewDiscussionSidebarViewEnabled?
If yes, could we mention that clearly in the PR description? Otherwise, the old sidebar may still show the panel by default.
| import Sidebar from '../../courseware/course/sidebar/Sidebar'; | ||
| import NewSidebar from '../../courseware/course/new-sidebar/Sidebar'; | ||
|
|
||
| export const RightSidebarSlot: React.FC<{ courseId: string }> = ({ courseId }) => { |
There was a problem hiding this comment.
Why was RightSidebarSlot added if the app still renders NotificationsDiscussionsSidebarSlot?
There was a problem hiding this comment.
I initially added a new RightSidebarSlot, but it wasn't being used because Sequence.jsx still referenced NotificationsDiscussionsSidebarSlot. I updated the existing slot with the new right_sidebar.v1 ID, kept the old IDs as aliases for backward compatibility, and removed the unused RightSidebarSlot file.
Description
Scope: New sidebar only (
isNewDiscussionSidebarViewEnabled = true). The legacy sidebar is untouched — its behavior is unchanged, and it never readsRIGHT_SIDEBAR_PANELS. No risk of the old sidebar showing or hiding panels differently.This PR refactors the Learning MFE right sidebar from a single monolithic
DiscussionsNotificationsSidebarinto two independent, config-driven panels — Discussions and Upsell.Changes
Sidebar Split
DiscussionsNotificationsSidebar.tsxanddiscussions-notifications/index.tssidebars/discussions/—DiscussionsSidebar.tsx,DiscussionsTrigger.tsx(renders onlyDiscussionsWidget)sidebars/upsell/—UpsellSidebar.tsx,UpsellTrigger.tsx(renders onlyNotificationsWidget/ upgrade CTA)DiscussionsNotificationsTrigger.tsx→UpsellTrigger.tsx, extracted discussions-specific logic (topic dispatch, edxProvider check) intoDiscussionsTrigger.tsxConfig-Driven Panel Visibility
enabledPanelsinSidebarContextProvider.tsx— readsRIGHT_SIDEBAR_PANELSfromenv.config.js['DISCUSSIONS']— Upsell is disabled by default and opt-inSidebar.tsxchecksenabledPanels.includes(sidebarEntry.panelId)before renderingSidebarTriggers.tsxfiltersSIDEBAR_ORDERbyenabledPanelsbefore rendering trigger buttonsSidebar Registry
sidebars/index.ts: replaced singleDISCUSSIONS_NOTIFICATIONSentry with separateDISCUSSIONSandUPSELLentries, each with apanelIdfor config matchingDISCUSSIONS_NOTIFICATIONS→DISCUSSIONSPlugin Slot Updates (in-place, no new slot files)
NotificationsDiscussionsSidebarSlot: primary ID updated toorg.openedx.frontend.learning.right_sidebar.v1, old IDs preserved asidAliasesNotificationsDiscussionsSidebarTriggerSlot: primary ID updated toorg.openedx.frontend.learning.right_sidebar_trigger.v1, old IDs preserved asidAliasesSequence.jsximport unchangedConstants & i18n
WIDGETS.NOTIFICATIONS→WIDGETS.UPSELL(deprecated aliasNOTIFICATIONS: 'UPSELL'preserved)rightSidebarTraymessage, deprecateddiscussionNotificationTraynotificationTitle→upsellTitle(default: "Upgrade")Config
RIGHT_SIDEBAR_PANELSvalue['DISCUSSIONS']['DISCUSSIONS', 'UPSELL']['UPSELL']Impact
env.config.jsidAliasesTicket
LP-591