Skip to content

Conversation

@farhaanbukhsh
Copy link
Member

@farhaanbukhsh farhaanbukhsh commented Sep 30, 2025

This PR is turned obsolete with #644, we have kept this PR up for sandbox provisioning and will close this soon

Addition of the NotificationTray slot, this slot is used to add a notification tray to the learner dashboard, studio, and learning MFE. This in turn helps to add the same slot to other MFEs as well since all of them use the same header.

Private Refs:
https://tasks.opencraft.com/browse/BB-10062
https://tasks.opencraft.com/browse/BB-10060

Discussions: Link to any public dicussions about this PR or the design/architecture. Otherwise omit this.

Dependencies: None

Screenshots:

studio_heaser_notification learner_dashboard_notification learner_header_notification

Sandbox URL: TBD - sandbox is being provisioned.

Merge deadline: "None" if there's no rush, "ASAP" if it's critical, or provide a specific date if there is one.

Testing instructions:

  1. Clone this repo and change to this branch. Run npm ci && npm run build
  2. Let's checkout the learner dashboard to have the notification tray slot.
  3. If you have a tutor devstack already running, stop the learner dashboard, tutor dev stop learner-dashboard
  4. Make sure learner-dashboard is already mounted you can check tutor mount lists if is is not mounted you can add tutor mounts add /path_to/edx-devstack/frontend-app-learner-dashboard and build the image tutor images build openedx-dev
  5. Now we need to copy the dist/ folder under frontend-component-header. cp -r /path_to/edx-devstack/frontend-component-header/dist /path_to/edx-devstack/frontend-app-learner-dashboard/node_modules/@edx/frontend-component-header. This copies the built codebase to the frontend-component-header
  6. Add env.config.jsx in /path_to/edx-devstack/frontend-app-learner-dashboard with the content,
import { PLUGIN_OPERATIONS, DIRECT_PLUGIN } from '@openedx/frontend-plugin-framework';
import { NotificationsTray, useAppNotifications, Notifications } from '@edx/frontend-plugin-notifications';
// Load environment variables from .env file
const config = {
  pluginSlots: {
    "org.openedx.frontend.layout.notification_tray.v1": {
      keepDefault: false,
      plugins: [
        {
          op: PLUGIN_OPERATIONS.Insert,
          widget: {
            id: 'custom_notification_tray',
            type: DIRECT_PLUGIN,
            RenderWidget: () => (
              <NotificationsTray />
            ),
          },
        },
      ],
    },
  },
};

export default config;
  1. We need to install the notification plugin in learner dashboard i.e /path_to/edx-devstack/frontend-app-learner-dashboard npm i @edx/frontend-plugin-notifications
  2. Now we can run npm run dev, after this if we see learner dashboard we should see notification icon button.

@openedx-webhooks
Copy link

Thanks for the pull request, @farhaanbukhsh!

This repository is currently maintained by @openedx/committers-frontend.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Sep 30, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Sep 30, 2025
@arbrandes arbrandes self-requested a review October 1, 2025 12:33
Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this might still be a draft. There are a couple of CI failures, and there's no documentation for the slot.

<div className={`container-fluid ${logoClasses}`}>
<div className="nav-container position-relative d-flex align-items-center">
<LogoSlot {...logoProps} />
{/* <LogoSlot {...logoProps} /> */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not actually removing the LogoSlot, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just testing few things

Signed-off-by: Farhaan Bukhsh <farhaan@opencraft.com>
@farhaanbukhsh farhaanbukhsh force-pushed the farhaan/adding-more-slots branch from 5de8cd5 to 87faedc Compare October 2, 2025 11:21
@codecov
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.59%. Comparing base (dbec796) to head (505fa43).
⚠️ Report is 17 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #638      +/-   ##
==========================================
+ Coverage   73.01%   73.59%   +0.57%     
==========================================
  Files          55       56       +1     
  Lines         504      515      +11     
  Branches      100      100              
==========================================
+ Hits          368      379      +11     
  Misses        133      133              
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@farhaanbukhsh
Copy link
Member Author

@xitij2000 @arbrandes, you both can review this while I update testing instructions for it.

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Oct 2, 2025
@xitij2000
Copy link

@farhaanbukhsh My concern here is that this slot is just not needed. I don't think it's adding anything.

If notifications were a core feature, wrapping it in a slot would make sense since you could then override a platform feature, however it's part of a plugin, so you can simply not install it.

Any component that needs to be added can simply be added to the LearningHelpSlot and it will end up in exactly the same space.

So here is my suggestion, if we have to add this slot, we should not call this the NotificationTraySlot but name it after its location, i.e. LearningHeaderToolbarSlot or similar. Naming it after something that doesn't even exist in core doesn't make sense to me.


Additionally, the slot for mobile and studio should have a different name.

@farhaanbukhsh
Copy link
Member Author

@farhaanbukhsh My concern here is that this slot is just not needed. I don't think it's adding anything.

If notifications were a core feature, wrapping it in a slot would make sense since you could then override a platform feature, however it's part of a plugin, so you can simply not install it.

Any component that needs to be added can simply be added to the LearningHelpSlot and it will end up in exactly the same space.

So here is my suggestion, if we have to add this slot, we should not call this the NotificationTraySlot but name it after its location, i.e. LearningHeaderToolbarSlot or similar. Naming it after something that doesn't even exist in core doesn't make sense to me.

Additionally, the slot for mobile and studio should have a different name.

Thanks a lot for the comment @xitij2000 , FWIW, the discussion is to make notifications a core plugin and going forward, it would have an even more permanent addition to the platform in terms of thinking, product proposal or code.

We have had a discussion about the slots, and since the notification tray was implemented as a plugin slot widget, this is the path of least resistance to integrate with the platform; hence, we are keeping the slot in. Hope it is clearer to you now. :)

@xitij2000
Copy link

@farhaanbukhsh Adding a plugin slot for it is okay; however, it shouldn't be called NotificationTraySlot, but something like HeaderActionItemSlot or similar.

Maybe there can be some conventions around this, but from what I see a slot should either be about after the component its wrapping, or its location on the page.

@farhaanbukhsh
Copy link
Member Author

@farhaanbukhsh Adding a plugin slot for it is okay; however, it shouldn't be called NotificationTraySlot, but something like HeaderActionItemSlot or similar.

Maybe there can be some conventions around this, but from what I see a slot should either be about after the component its wrapping, or its location on the page.

If you see this slot it is being added with an intention to be used @xitij2000 so I feel for now it's okay to go with NotificationTraySlot and if we get use it in a more generic sense then we can rename it later. Hence, I think have a specific name makes more sense, what do you think?

@xitij2000
Copy link

@farhaanbukhsh Adding a plugin slot for it is okay; however, it shouldn't be called NotificationTraySlot, but something like HeaderActionItemSlot or similar.
Maybe there can be some conventions around this, but from what I see a slot should either be about after the component its wrapping, or its location on the page.

If you see this slot it is being added with an intention to be used @xitij2000 so I feel for now it's okay to go with NotificationTraySlot and if we get use it in a more generic sense then we can rename it later. Hence, I think have a specific name makes more sense, what do you think?

I don't feel intention is a good reason. Because then you can end up with a dozen slots in the same place by different people because they all want different features in the same place, whereas they could all put what they want in the same slot. Also because the whole point of slots is that they allow control over the UI. So someone might want to put the notification icon in a different place, which is the benefit that slots provide.

Additionally, as I mentioned above, you should create separate slots for mobile, studio, learner, etc., instead of using the same slot in each place.

CC: @bradenmacdonald Could you give your input here as well? The TLDR is, the we're adding a new slot called NotificationTraySlot to the header. I'm opposed to this since I feel that a black slot should not be named after the feature it's for but for the location it exists in so that any compatible plugin can be added there. With NotificationTraySlot it sounds like it's only for the notification tray whereas you can add anything. A generic name sounds more appropriate.

@farhaanbukhsh
Copy link
Member Author

@xitij2000, now that I think about it, it does make more sense to rename the plugin so that we have a clear distinction and generic names of slots. Let me rename them, and then you can have a look. Thank you for your patience.

const NotificationTraySlot = () => (
<PluginSlot
id="org.openedx.frontend.layout.notification_tray.v1"
idAliases={['notification_tray_plugin']}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed for a new slot.

@farhaanbukhsh
Copy link
Member Author

@arbrandes @xitij2000 you can have a look at #644 and please provide your review on it.

@farhaanbukhsh
Copy link
Member Author

closing this in favour of #644

@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Contributions Oct 15, 2025
@farhaanbukhsh farhaanbukhsh deleted the farhaan/adding-more-slots branch October 15, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants