-
Notifications
You must be signed in to change notification settings - Fork 173
Adding new slots for Notification Tray integration #644
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
Adding new slots for Notification Tray integration #644
Conversation
|
Thanks for the pull request, @farhaanbukhsh! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #644 +/- ##
==========================================
+ Coverage 72.11% 72.22% +0.11%
==========================================
Files 55 56 +1
Lines 502 504 +2
Branches 108 108
==========================================
+ Hits 362 364 +2
Misses 137 137
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f255ff6 to
e60fac3
Compare
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.
@farhaanbukhsh Great work on handling the multiple scenarios here. Thanks for the detailed testing instructions. I followed them and they mostly worked except for the <NotificationsTray /> component never showing up. I change to simple span like the ones from the README and that worked just fine.
I have left inline comments. I want to note a couple of things that I noticed here:
Missing priority in the widget definitions
When I inpect the component tree in React Dev tools, I have this error on the slot, for all the slots
the insert operation config is invalid for widget id: mobile_notification_tray undefined
this error goes away only when the priority key is added to the widget object. So, all the code examples in the README file will need to be updated to include this property.
JSX key spread warning
There is also another error in the component tree with an ErrorBoundary
Warning: A props object containing a "key" prop is being spread into JSX: let props = {key: someKey, id: ...}; <RenderWidget {...props} /> React keys must be passed directly to JSX without using spread: let props = {id: ...}; <RenderWidget key={someKey} {...props} /> at PluginContainerDirect (webpack-internal:///./node_modules/@openedx/frontend-plugin-framework/dist/plugins/PluginContainerDirect.js:25:7) at ErrorBoundary (webpack-internal:///./node_modules/@edx/frontend-platform/react/ErrorBoundary.js:104:5) at PluginContainer (webpack-internal:///./node_modules/@openedx/frontend-plugin-framework/dist/plugins/PluginContainer.js:27:7) at BasePluginSlot (webpack-internal:///./node_modules/@openedx/frontend-plugin-framework/dist/plugins/PluginSlot.js:31:7) at MobileHeaderItemSlot at button at MenuTrigger (webpack-internal:///./node_modules/@edx/frontend-component-header/dist/Menu/Menu.js:146:18) at nav at Menu (webpack-internal:///./node_modules/@edx/frontend-component-header/dist/Menu/Menu.js:196:5) at div at header at MobileHeader (webpack-internal:///./node_modules/@edx/frontend-component-header/dist/mobile-header/MobileHeader.js:82:23) at BasePluginSlot (webpack-internal:///./node_modules/@openedx/frontend-plugin-framework/dist/plugins/PluginSlot.js:31:7) at MobileHeaderSlot (webpack-internal:///./node_modules/@edx/frontend-component-header/dist/plugin-slots/MobileHeaderSlot/index.js:13:20) at MediaQuery (webpack-internal:///./node_modules/react-responsive/dist/react-responsive.js:868:33) at Header (webpack-internal:///./node_modules/@edx/frontend-component-header/dist/Header.js:77:28) at LearnerDashboardHeader (webpack-internal:///./src/containers/LearnerDashboardHeader/index.jsx:36:52) at AppWrapper (webpack-internal:///./src/containers/AppWrapper/index.jsx:15:5) at div at App (webpack-internal:///./src/App.jsx:64:52) at PageWrap (webpack-internal:///./node_modules/@edx/frontend-platform/react/PageWrap.js:25:23) at RenderedRoute (webpack-internal:///./node_modules/react-router/dist/index.js:579:5) at Routes (webpack-internal:///./node_modules/react-router/dist/index.js:1313:5) at div at NoticesWrapper (webpack-internal:///./src/components/NoticesWrapper/index.jsx:30:5) at div at Router (webpack-internal:///./node_modules/react-router/dist/index.js:1247:15) at BrowserRouter (webpack-internal:///./node_modules/react-router-dom/dist/index.js:704:5) at div at Provider (webpack-internal:///./node_modules/react-redux/es/components/Provider.js:19:20) at OptionalReduxProvider (webpack-internal:///./node_modules/@edx/frontend-platform/react/OptionalReduxProvider.js:19:25) at ErrorBoundary (webpack-internal:///./node_modules/@edx/frontend-platform/react/ErrorBoundary.js:104:5) at IntlProvider (webpack-internal:///./node_modules/react-intl/lib/src/components/provider.js:42:47) at AppProvider (webpack-internal:///./node_modules/@edx/frontend-platform/react/AppProvider.js:117:25)
I am NOT certain about the reason for this error, but I suspect it's probably connected to not defining any properties in the slots. Thus, making the plugin-slots library's implementation do something that React doesn't like.
src/plugin-slots/DesktopHeaderItemSlot/images/learner_dashboard_notification.png
Outdated
Show resolved
Hide resolved
src/plugin-slots/LearningHeaderItemSlot/images/learner_header_notification.png
Outdated
Show resolved
Hide resolved
npm i @edx/frontend-plugin-notifications@^2.0.3 should solve it possibly the npm directly pulled from github and didn't run a build on it.
Great I will add the priority to the readme.md @tecoholic
I don't see this on the sandbox that we have setup so I am assuming it wouldn't be a big thing and it should be handled on the building step and is a problem for dev build. |
|
@tecoholic @arbrandes @xitij2000 The sandbox https://axim-notification.do.opencraft.hosting/ has these changes so that you can test them. The configuration is passed through openedx/tutor-contrib-platform-notifications#5 |
31b5286 to
ffa337b
Compare
tecoholic
left a comment
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.
@farhaanbukhsh 👍 Thank you for addressing all the comments. LGTM.
- I tested this: Tested all the slots and verified that they are placed in the right places and function as intended.
- I read through the code
- I checked for accessibility issues
- Includes documentation
brian-smith-tcril
left a comment
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.
I don't think we should add the slots that are currently in this PR.
I left some comments with more details, but overall:
- I don't see how
DesktopHeaderItemSlotandLearningHeaderItemSlotare adding anything that can't be accomplished with existing slots MobileHeaderItemSlotandStudioHeaderItemSlotare adding new functionality, but in "serves one specific use case" ways. I left suggestions about ways to add the functionality in more versatile ways.
4642e0b to
47cfc6f
Compare
brian-smith-tcril
left a comment
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.
Architecturally this is great! Very glad to see that you were able to utilize existing slots, and I'm glad to see wrapping the search button works for your purposes as well!
The only changes I'd like to see here are naming related. I'm open to other thoughts/suggestions, but considering this is a slot that wraps the search button, I think it makes sense to call it the search button slot. While not explicitly mentioned in the plugin slot naming and life cycle ADR, the general pattern has been to name slots that are wrapping something based on what they are wrapping.
So this would mean:
StudioHeaderItemSlot->StudioHeaderSearchButtonSlotorg.openedx.frontend.layout.studio_header_item_slot.v1->org.openedx.frontend.layout.studio_header_search_button_slot.v1
Thank you so much for working through the review process with me on this PR!
1edfa42 to
bfb921e
Compare
|
@brian-smith-tcril thanks a lot for a such a quick review, I have made the changes you have asked for, please have a lot when you get a chance. Thanks again for such great reviews. |
brian-smith-tcril
left a comment
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.
LGTM!
One tiny suggestion in the readme description but I don't want to block this PR on that.
Thank you so much for putting all of this together!
|
|
||
| ## Description | ||
|
|
||
| This slot is used to replace/modify/hide the action items in the studio header. |
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.
| This slot is used to replace/modify/hide the action items in the studio header. | |
| This slot is used to replace/modify/hide the search button in the studio header. |
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.
@brian-smith-tcril thank you for the review and done! :)
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.
Please merge it if you have the access and if everything looks oka @brian-smith-tcril , thanks a lot again for the work and effort.
Signed-off-by: Farhaan Bukhsh <[email protected]>
bfb921e to
b4dd7e0
Compare


Addition of the Header Item slot, this slot is created with the intention to add Notitification 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.
JIRA tickets: None
Discussions: Link to any public dicussions about this PR or the design/architecture. Otherwise omit this.
Dependencies: None
Screenshots:
Included in the Readme.md
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:
npm ci && npm run buildtutor dev stop learner-dashboardtutor mount listsif is is not mounted you can addtutor mounts add /path_to/edx-devstack/frontend-app-learner-dashboardand build the imagetutor images build openedx-devcp -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-headernpm i @edx/frontend-plugin-notifications@^2.0.3npm run dev, after this if we see learner dashboard we should see notification icon button.Private Refs:
https://tasks.opencraft.com/browse/BB-10062
https://tasks.opencraft.com/browse/BB-10060