Allow Review Checker to notify sidebar when a badge should be rendered on RC icon
Categories
(Firefox :: Shopping, task, P2)
Tracking
()
People
(Reporter: kpatenio, Assigned: kpatenio)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fidefe-RCSidebar])
Attachments
(1 file)
Copying from https://bugzilla.mozilla.org/show_bug.cgi?id=1916018#c2:
We need an API for sidebar tools to call when they want to show an notification like SidebarController.setNotifications(sidebarToolID, true) (or if we want to be like the toolbar pass a int?)
Then the controller will badge the tools moz-button if the sidebar is currently open but on a different panel and will also badge the sidebar toolbarbutton if the sidebar is closed.
- On SidebarController.show(sidebarToolID) it will clear the notification.
- It may also need to override the last opened sidebar to the one that has the most recent notification.
A couple weeks back, I wrote notes on how the sidebar layer could look (assuming we make our changes in browser-sidebar.js.
TBD:
showIconBadge(commandID)
Shows the badge on the targeted sidebar tool’s icon. One possible implementation:
showIconBadge(commandID) {
let iconButton = this.sidebarContainer.querySelector("sidebar-main").shadowRoot.querySelector(`[view=${commandID}]`);
if (!iconButton) {
return;
}
iconButton.setAttribute("attention", true);
},
- Try to find an icon with [view=commandID]
- If not found, do nothing
- Else, set attribute attention to true for that button
hideIconBadge(commandID)
Shows the badge on the targeted sidebar tool’s icon. One possible implementation:
hideIconBadge(commandID) {
let iconButton = this.sidebarContainer.querySelector("sidebar-main").shadowRoot.querySelector(`[view=${commandID}]`);
if (!iconButton) {
return;
}
iconButton.removeAttribute("attention");
},
- Try to find an icon with [view=commandID]
- If not found, do nothing
- Else, remove attribute attention for that button
hasIconBadge(commandID)
Checks if the targeted sidebar tool’s icon has a notification already. One possible implementation is:
hasIconBadge(commandID) {
let iconButton = this.sidebarContainer.querySelector("sidebar-main").shadowRoot.querySelector(`[view=${commandID}]`);
return !!iconButton?.hasAttribute("attention");
},
- Try to find an icon with [view=commandID]
- Return if icon has attribute attention, or false if icon could not be found
Updated•21 days ago
|
Updated•8 days ago
|
Updated•3 days ago
|
Description
•