openedx / openedx/frontend-base
Verify plugin examples from slot `README`s are valid
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4
- Forks
- 13
- Avg merge
- 3h 21m
- Merged PRs (30d)
- 10
Description
I tried using the example code from https://github.com/openedx/frontend-app-learner-dashboard/tree/frontend-base/src/slots/CourseBannerSlot by updating site.config.dev.tsx to be
-import { EnvironmentTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';
+import { EnvironmentTypes, WidgetOperationTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';
import { learnerDashboardApp } from './src';
+import { Alert } from '@openedx/paragon';
+
import '@openedx/frontend-base/shell/style';
+const myComponent = ({ cardId }) => (
+ <Alert variant="info" className="mb-0">
+ Course banner for course with {cardId}
+ </Alert>
+)
+
const siteConfig: SiteConfig = {
siteId: 'learner-dashboard-dev',
siteName: 'Learner Dashboard Dev',
@@ -17,7 +25,17 @@ const siteConfig: SiteConfig = {
shellApp,
headerApp,
footerApp,
- learnerDashboardApp
+ {
+ ...learnerDashboardApp,
+ slots: [
+ {
+ slotId: 'org.openedx.frontend.slot.learnerDashboard.courseCardBanner.v1',
+ id: 'my.widget',
+ op: WidgetOperationTypes.REPLACE,
+ component: myComponent
+ },
+ ]
+ },
],
externalRoutes: [
{
and got
adding relatedId: 'defaultContent', fixes the error. I'm not sure if that is supposed to be required for using WidgetOperationTypes.REPLACE or not
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the CourseBannerSlot README example with the shown site.config.dev.tsx setup, focusing on WidgetOperationTypes.REPLACE and the relatedId value. Reproduce the reported error, determine whether relatedId is required, and verify that the README example and its expected result are valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100