-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Version 2 Created the plugin slot for UpgradeToCompleteAlert #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Banner Dates Upgrade Slot | ||
|
|
||
| ### Slot ID: `org.openedx.frontend.learning.banner_dates_upgrade.v1` | ||
|
|
||
|
Comment on lines
+1
to
+4
|
||
| ### Slot ID Aliases | ||
|
|
||
| - `dates_upgrade_banner_slot` | ||
|
|
||
| ## Description | ||
|
|
||
| This slot is used for rendering upgrade messaging in the dates tab banner area. | ||
|
|
||
| By default, the slot renders `UpgradeToCompleteAlert`. You can disable the default and fully replace it with a custom plugin experience using `keepDefault: false`. | ||
|
|
||
| ## Props | ||
|
|
||
| - `courseId` - The course ID (string) | ||
| - `logUpgradeLinkClick` - Callback used for upgrade-click analytics | ||
|
|
||
| ## Screenshots | ||
|
|
||
| Default banner screenshot: | ||
|
|
||
|  | ||
|
|
||
|
|
||
|
|
||
| ## Example | ||
|
|
||
| The following `env.config.jsx` example replaces the default banner experience with a custom plugin widget: | ||
|
|
||
| ```js | ||
| import { | ||
| DIRECT_PLUGIN, | ||
| PLUGIN_OPERATIONS, | ||
| } from '@openedx/frontend-plugin-framework'; | ||
|
|
||
| const config = { | ||
| pluginSlots: { | ||
| dates_upgrade_banner_slot: { | ||
| keepDefault: false, | ||
| plugins: [ | ||
| { | ||
| op: PLUGIN_OPERATIONS.Insert, | ||
| widget: { | ||
| id: 'org.openedx.frontend.learning.banner_dates_upgrade.v1', | ||
| type: DIRECT_PLUGIN, | ||
| priority: 50, | ||
| RenderWidget: (pluginProps) => ( | ||
| <div> | ||
| Replacement Banner | ||
| <button>Upgrade here</button> | ||
| </div> | ||
| ), | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { PluginSlot } from '@openedx/frontend-plugin-framework'; | ||
| import UpgradeToCompleteAlert from '../../course-home/suggested-schedule-messaging/UpgradeToCompleteAlert'; | ||
|
|
||
| export const BannerDatesUpgradeSlot = ({ | ||
| courseId, | ||
| logUpgradeLinkClick, | ||
| }: BannerDatesUpgradeSlotProps) => ( | ||
| <PluginSlot | ||
| id="org.openedx.frontend.learning.banner_dates_upgrade.v1" | ||
| idAliases={['dates_upgrade_banner_slot']} | ||
| pluginProps={{ | ||
| courseId, | ||
| logUpgradeLinkClick, | ||
| }} | ||
| > | ||
| <UpgradeToCompleteAlert logUpgradeLinkClick={logUpgradeLinkClick} /> | ||
| </PluginSlot> | ||
| ); | ||
|
|
||
| interface BannerDatesUpgradeSlotProps { | ||
| courseId: string; | ||
| logUpgradeLinkClick: () => void; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add screenshots to the README. See this file as an example: https://github.com/edx/frontend-app-learner-dashboard/blob/release-ulmo/src/plugin-slots/WidgetSidebarSlot/README.md