show mention counts in channel notifications (#6696)

**Category:** fix
**User Impact:** Stream and forum channels now show an accessible
numeric badge for unread mentions while mention chips remain clear in
every theme.

**Problem:** Mention notifications contributed to the app and Dock
badge, but inactive stream and forum rows only became bold, making it
difficult to see where multiple mentions were waiting. Mention styling
and generic destructive colors could also lose contrast or visual
meaning in some themes.

**Solution:** Use the same app-badge projection for non-DM channel
mention counts, while preserving regular unread bolding, thread activity
dots, DM counts, and manual unread behavior. Dedicated notification and
opaque mention-highlight tokens keep the new treatments stable and
readable across syntax themes.

<details>
<summary>File changes</summary>

**desktop/src/features/channels/useUnreadChannels.ts**
Projects app-badge-eligible mention and broadcast counts into stream and
forum channel rows while retaining DM-specific counting and
manual-unread semantics.

**desktop/src/features/sidebar/ui/SidebarSection.tsx**
Renders an accessible numeric notification pill on inactive non-DM
channels and preserves the thread activity dot fallback.

**desktop/src/shared/styles/globals/markdown.css**
Applies the shared opaque yellow highlight to human and agent mention
chips, including hover treatment.

**desktop/src/shared/styles/globals/theme.css**
Adds fixed notification and mention-highlight tokens with
theme-independent contrast.

**desktop/tailwind.config.js**
Exposes the notification token pair through semantic Tailwind utilities.

**desktop/tests/e2e/badge.spec.ts**
Covers aggregated mention counts, broadcasts, unchanged unread tiers,
exact accessible text, and badge contrast under an adversarial theme.

**desktop/tests/e2e/mentions.spec.ts**
Covers human and agent mention styling, hover behavior, dark mode, and
WCAG text contrast.

</details>

## Reproduction steps

1. Open a stream or forum channel, then navigate to another channel.
2. Receive two messages that mention you in the inactive channel.
3. Confirm the inactive row is bold and shows a red `2` pill matching
the two notifications added to the app or Dock badge.
4. Receive a regular channel message and confirm the row only becomes
bold, without a numeric pill.
5. Receive a reply in an interested thread and confirm the channel
retains its activity dot instead of a mention count.
6. Switch between light and dark themes and confirm human and agent
mention chips remain yellow with near-black readable text, including on
hover.

## Screenshots

Screenshots are posted in the PR discussion using immutable
repository-hosted image URLs.

Signed-off-by: tulsi <tulsi@block.xyz>
This commit is contained in:
tulsi
2026-08-24 11:48:48 -04:00
committed by GitHub
parent 2f13e30e88
commit 0e69b3fd7c
7 changed files with 149 additions and 24 deletions

View File

@@ -302,6 +302,21 @@
color: hsl(var(--primary) / 0.9);
}
/* @mentions use an opaque highlighter-yellow treatment so they scan
differently from channel links while retaining AA contrast on every theme.
Shared by human and agent chips in both timeline and composer. */
.message-markdown .mention-chip.inline-chip-icon-human,
.message-markdown .mention-chip.inline-chip-icon-agent {
background: hsl(var(--mention-highlight));
color: hsl(var(--buzz-content-dark));
}
.message-markdown .mention-chip-hover.inline-chip-icon-human:hover,
.message-markdown .mention-chip-hover.inline-chip-icon-agent:hover {
background: hsl(var(--mention-highlight-hover));
color: hsl(var(--buzz-content-dark));
}
.message-markdown .mention-prefix-hidden {
display: inline-block;
width: 0;

View File

@@ -28,6 +28,14 @@
--accent-foreground: 234 16.02% 35.49%;
--destructive: 347 86.67% 44.12%;
--destructive-foreground: 220 23.08% 94.9%;
/* Notification attention colors are fixed across syntax themes. Unlike
destructive, these must stay recognizably red with AA label contrast. */
--notification: 348 65% 48%;
--notification-foreground: 350 100% 98%;
/* Opaque highlighter colors keep near-black mention text readable on every
message surface instead of depending on the active theme underneath. */
--mention-highlight: 48 96% 70%;
--mention-highlight-hover: 48 96% 62%;
--border: 225 13.56% 76.86%;
--input: 225 13.56% 76.86%;
--ring: 234 16.02% 35.49%;