Skip to content

[OP-19459] Use Primer Counter in notifications menu, fixing clipped counts - #23558

Merged
myabc merged 3 commits into
devfrom
bug/OP-19459-notifications-center-clipped-count-badges
Jun 13, 2026
Merged

[OP-19459] Use Primer Counter in notifications menu, fixing clipped counts#23558
myabc merged 3 commits into
devfrom
bug/OP-19459-notifications-center-clipped-count-badges

Conversation

@myabc

@myabc myabc commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/OP-19459

What are you trying to accomplish?

Fix clipped notification count badges by replacing the legacy bubble styling with Primer counters in the notification menu and notification center entries.

Screenshots

Before After
Screenshot 2026-06-07 at 23 48 55 Screenshot 2026-06-07 at 23 48 19

What approach did you choose and why?

Use Primer::Beta::Counter for server-rendered submenu counts and add a small standalone Angular counter component for in-app notification entries, matching the Primer counter API for the options needed here.

This implementation currently only uses the primary (dark grey) counter variant for the Inbox - with the secondary variant used elsewhere. This is a personal preference - but is open for discussion!

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@myabc myabc added the bugfix label Jun 4, 2026
@myabc myabc added this to the 17.5.x milestone Jun 4, 2026
@myabc
myabc requested a review from Copilot June 4, 2026 12:02
@myabc myabc changed the title OP-19459] Use Primer Counter in notifications menu, fixing clipped counts [OP-19459] Use Primer Counter in notifications menu, fixing clipped counts Jun 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces the existing “bubble” count rendering in notification-related UI with Primer counters to avoid clipped counts and align styling with Primer components.

Changes:

  • Added a new Angular PrimerCounterLabelComponent (with unit tests) and exported it via OpSharedModule.
  • Updated in-app notification entry UI to render counts using the new Primer counter component (and removed the old bubble mixin styling).
  • Switched the Rails submenu item count bubble to Primer::Beta::Counter.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
frontend/src/app/shared/shared.module.ts Exports the new Primer counter component for reuse across the frontend.
frontend/src/app/shared/components/primer/counter-label.component.ts Introduces the Angular Primer counter label implementation (value/title logic, limiting, schemes).
frontend/src/app/shared/components/primer/counter-label.component.html Renders a Primer-styled .Counter span with scheme modifiers and bindings.
frontend/src/app/shared/components/primer/counter-label.component.spec.ts Adds unit tests for counter rendering, limiting, schemes, null/infinity, and hide-if-zero behavior.
frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html Replaces the plain count bubble with <primer-counter-label> in the notifications list and loading state.
frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass Removes the old indicator-bubble mixin usage for the notification count.
app/components/open_project/common/submenu_component.html.erb Replaces submenu count bubble spans with Primer::Beta::Counter components.

Comment thread frontend/src/app/shared/components/primer/counter.component.ts
Comment thread frontend/src/app/shared/components/primer/counter-label.component.ts Outdated
Comment thread frontend/src/app/shared/components/primer/counter-label.component.ts Outdated
Comment thread frontend/src/app/shared/components/primer/counter-label.component.ts Outdated
Comment thread frontend/src/app/shared/components/primer/counter-label.component.ts Outdated
@myabc
myabc force-pushed the bug/OP-19459-notifications-center-clipped-count-badges branch from 0751058 to 072fc6c Compare June 7, 2026 22:47
@myabc myabc added needs review javascript Pull requests that update Javascript code ruby Pull requests that update Ruby code styling labels Jun 7, 2026
@myabc
myabc marked this pull request as ready for review June 7, 2026 22:51
@myabc
myabc requested a review from HDinger June 8, 2026 09:10
@HDinger

HDinger commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

I did not look at it yet, but I'd vote for changing the base to dev.

@myabc
myabc changed the base branch from release/17.5 to dev June 8, 2026 13:57
@myabc myabc modified the milestones: 17.5.x, 17.6.x Jun 8, 2026
Comment on lines +68 to +70
if (count === Infinity || count === -Infinity) {
return '∞';
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am no fan of this.. When will we ever want to display the infinity sign? Is this supported by the Primer component?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Primer::Beta::Counter does support this — it renders for Float::INFINITY (with Infinity title attribute). I don't think we're currently rendering infinity anywhere in OP (in JS or Ruby), but kept this for API parity.

Comment thread app/components/open_project/common/submenu_component.html.erb
Comment thread frontend/src/app/shared/components/primer/counter-label.component.ts Outdated
@myabc
myabc force-pushed the bug/OP-19459-notifications-center-clipped-count-badges branch from 072fc6c to f603f8d Compare June 11, 2026 15:46
myabc added 3 commits June 11, 2026 16:53
Switches from custom CSS implementation to `Primer::Beta::Counter` for
rendering counters in menu on Notifications page. Fixes clipping of
larger notification numbers (≥ 3 digits), including applying rounding
of very large numbers (e.g. `4k+`).

https://community.openproject.org/wp/OP-19459
Ports a simplified `Primer::Beta::Counter` to Angular as
`PrimerCounterLabelComponent` so the `.Counter` badge can be used from
Angular templates. Supports `count`, `scheme`, `limit`, and
`hideIfZero`; the Ruby `text` and `round` options are omitted.
Aligns the look and behaviour of counters on the Notifications page by
rendering the aggregated-notification count badge with the new
`primer-counter-label` component in place of the bespoke
`indicator-bubble` span, so IAN entries inherit the shared limit and
delimiting behaviour.
@myabc
myabc force-pushed the bug/OP-19459-notifications-center-clipped-count-badges branch from f603f8d to 6c1dc64 Compare June 11, 2026 15:53
@myabc
myabc requested a review from HDinger June 11, 2026 15:53
@myabc
myabc merged commit a8a9f2a into dev Jun 13, 2026
18 of 20 checks passed
@myabc
myabc deleted the bug/OP-19459-notifications-center-clipped-count-badges branch June 13, 2026 12:10
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bugfix javascript Pull requests that update Javascript code needs review ruby Pull requests that update Ruby code styling

Development

Successfully merging this pull request may close these issues.

3 participants