openedx / openedx/frontend-base

Verify plugin examples from slot `README`s are valid

Open
#270 0 comments 0 reactions 0 assignees View on GitHub

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

Image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.