Skip to content

Verify plugin examples from slot READMEs are valid #270

@brian-smith-tcril

Description

@brian-smith-tcril

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions