Open Bug 1951023 Opened 21 days ago Updated 3 days ago

Allow Review Checker to notify sidebar when a badge should be rendered on RC icon

Categories

(Firefox :: Shopping, task, P2)

task
Points:
5

Tracking

()

ASSIGNED

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);
  },
  1. Try to find an icon with [view=commandID]
  2. If not found, do nothing
  3. 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");
  },
  1. Try to find an icon with [view=commandID]
  2. If not found, do nothing
  3. 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");
  },
  1. Try to find an icon with [view=commandID]
  2. Return if icon has attribute attention, or false if icon could not be found
Severity: -- → N/A
Points: --- → 5
Priority: -- → P2
Whiteboard: [fidefe-RCSidebar]
Assignee: nobody → kpatenio
Status: NEW → ASSIGNED
Attachment #9471558 - Attachment description: WIP: Bug 1951023 - render a badge on RC sidebar icon for PDPs → WIP: Bug 1951023 - allow Review Checker and SidebarController to badge RC sidebar icon.
Attachment #9471558 - Attachment description: WIP: Bug 1951023 - allow Review Checker and SidebarController to badge RC sidebar icon. → Bug 1951023 - allow Review Checker and SidebarController to badge RC sidebar icon.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: