Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat(web): animate inbox unread counts
Gus0243b900cc27
diff --git a/src/web/src/app/globals.css b/src/web/src/app/globals.cssindex 5953f20e0..5a949a81b 100644--- a/src/web/src/app/globals.css+++ b/src/web/src/app/globals.css@@ -432,6 +432,8 @@ body.driver-active .community-ws-reconnect-overlay * {}:root {+ --inbox-unread: #ff9915;+ --inbox-unread-foreground: #171313;--app-safe-area-top: env(safe-area-inset-top, 0px);--app-safe-area-right: env(safe-area-inset-right, 0px);--app-safe-area-bottom: env(safe-area-inset-bottom, 0px);diff --git a/src/web/src/components/community/shell/inbox-unread-indicator.dom.test.ts b/src/web/src/components/community/shell/inbox-unread-indicator.dom.test.tsnew file mode 100644index 000000000..ad4ca42a6--- /dev/null+++ b/src/web/src/components/community/shell/inbox-unread-indicator.dom.test.ts@@ -0,0 +1,44 @@+import { createElement } from "react"+import { describe, expect, it, vi } from "vitest"+import { render } from "@/test/react-dom-harness"+import { InboxUnreadIndicator } from "./inbox-unread-indicator"++vi.mock("@/components/ui/number-ticker", () => ({ NumberTicker: ({ value }: { value: number }) => createElement("span", { "data-testid": "count" }, value) }))++describe("Inbox unread indicator", () => {+ it("retracts on open, re-enters on close, updates count, and retains the outgoing digit on clear", () => {+ const view = render(createElement(InboxUnreadIndicator, { count: 0, open: false }))+ const indicator = () => view.container.querySelector('[data-slot="inbox-unread-indicator"]')!+ expect(indicator()).toHaveAttribute("data-unread", "false")+ for (const count of [3, 8, 2]) {+ view.rerender(createElement(InboxUnreadIndicator, { count, open: false }))+ expect(indicator()).toHaveAttribute("data-unread", "true")+ expect(view.getByTestId("count")).toHaveTextContent(String(count))+ }+ view.rerender(createElement(InboxUnreadIndicator, { count: 2, open: true }))+ expect(indicator()).toHaveAttribute("data-unread", "false")+ view.rerender(createElement(InboxUnreadIndicator, { count: 2, open: false }))+ expect(indicator()).toHaveAttribute("data-unread", "true")+ view.rerender(createElement(InboxUnreadIndicator, { count: 0, open: false }))+ expect(indicator()).toHaveAttribute("data-unread", "false")+ expect(view.getByTestId("count")).toHaveTextContent("2")+ })++ it("shows an ellipsis for incomplete or overflowing counts and restores exact numbers", () => {+ const view = render(createElement(InboxUnreadIndicator, { count: 7, partial: true, open: false }))+ const ellipsis = () => view.container.querySelector('[data-slot="inbox-unread-ellipsis"]')+ expect(ellipsis()).not.toBeNull()+ expect(view.queryByTestId("count")).toBeNull()+ view.rerender(createElement(InboxUnreadIndicator, { count: 99, open: false }))+ expect(ellipsis()).toBeNull()+ expect(view.getByTestId("count")).toHaveTextContent("99")+ view.rerender(createElement(InboxUnreadIndicator, { count: 100, open: false }))+ expect(ellipsis()).not.toBeNull()+ expect(view.queryByTestId("count")).toBeNull()+ view.rerender(createElement(InboxUnreadIndicator, { count: 0, open: false }))+ expect(ellipsis()).not.toBeNull()+ view.rerender(createElement(InboxUnreadIndicator, { count: 12, open: false }))+ expect(ellipsis()).toBeNull()+ expect(view.getByTestId("count")).toHaveTextContent("12")+ })+})diff --git a/src/web/src/components/community/shell/inbox-unread-indicator.module.css b/src/web/src/components/community/shell/inbox-unread-indicator.module.cssnew file mode 100644index 000000000..29ecdf7a6--- /dev/null+++ b/src/web/src/components/community/shell/inbox-unread-indicator.module.css@@ -0,0 +1,61 @@+.indicator {+ position: relative;+ width: 28px;+ height: 28px;+ isolation: isolate;+ overflow: hidden;+}++.circle {+ position: absolute;+ top: 2px;+ left: 2px;+ display: flex;+ align-items: center;+ justify-content: center;+ width: 24px;+ height: 24px;+ border-radius: 50%;+ color: var(--inbox-unread-foreground);+ background: var(--inbox-unread);+ font-family: var(--font-mono);+ font-size: 14px;+ line-height: 1;+ font-weight: 400;+ font-variant-numeric: tabular-nums;+ opacity: 0;+ transform: translateY(-28px);+ transform-origin: center;+ transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;+}++.icon {+ position: absolute;+ top: 6px;+ left: 6px;+ display: grid;+ place-items: center;+ width: 16px;+ height: 16px;+ opacity: 1;+ transform: translateY(0);+ transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;+}++.indicator[data-unread="true"] .circle {+ opacity: 1;+ transform: translateY(0);+ transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;+}++.indicator[data-unread="true"] .icon {+ opacity: 0;+ transform: translateY(28px);+ transition-duration: 360ms;+}++@media (prefers-reduced-motion: reduce) {+ .circle, .icon, .indicator[data-unread="true"] .circle, .indicator[data-unread="true"] .icon {+ transition: opacity 100ms ease;+ }+}diff --git a/src/web/src/components/community/shell/inbox-unread-indicator.tsx b/src/web/src/components/community/shell/inbox-unread-indicator.tsxnew file mode 100644index 000000000..87c3e8a87--- /dev/null+++ b/src/web/src/components/community/shell/inbox-unread-indicator.tsx@@ -0,0 +1,29 @@+"use client"++import { useState } from "react"+import { Inbox } from "lucide-react"+import { NumberTicker } from "@/components/ui/number-ticker"+import styles from "./inbox-unread-indicator.module.css"++export function InboxUnreadIndicator({ count, partial = false, open, descriptionId }: {+ count: number+ partial?: boolean+ open: boolean+ descriptionId?: string+}) {+ const [lastCount, setLastCount] = useState(count)+ if (count > 0 && count !== lastCount) setLastCount(count)+ const displayCount = count > 0 ? count : lastCount+ const overflow = displayCount > 99 || partial+ return (+ <>+ <span id={descriptionId} className="sr-only">{count > 0 ? `${count}${partial ? "+" : ""} unread conversations or requests` : "No unread items"}</span>+ <span className={styles.indicator} data-unread={count > 0 && !open} data-count={count} data-partial={partial} aria-hidden="true" data-slot="inbox-unread-indicator">+ <span className={styles.circle} data-slot="inbox-unread-circle">+ {overflow ? <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" data-slot="inbox-unread-ellipsis"><circle cx="3" cy="8" r="1.5" /><circle cx="8" cy="8" r="1.5" /><circle cx="13" cy="8" r="1.5" /></svg> : <NumberTicker value={displayCount} duration={220} />}+ </span>+ <span className={styles.icon}><Inbox className="size-4" /></span>+ </span>+ </>+ )+}diff --git a/src/web/src/components/community/shell/shell-frame-view.tsx b/src/web/src/components/community/shell/shell-frame-view.tsxindex b29b1823e..d29f06a7a 100644--- a/src/web/src/components/community/shell/shell-frame-view.tsx+++ b/src/web/src/components/community/shell/shell-frame-view.tsx@@ -108,6 +108,8 @@ export function ShellFrameView({onEditProfile={profile.openUserSettings}inbox={inboxElement}hasUnread={inbox.hasUnread}+ unreadCount={inbox.unreadCount}+ unreadCountPartial={inbox.unreadCountPartial}inboxOpen={userBarExtension.active === "inbox"}onInboxOpenChange={onUserBarInboxOpenChange}extension={{diff --git a/src/web/src/components/community/shell/use-shell-inbox-controller.ts b/src/web/src/components/community/shell/use-shell-inbox-controller.tsindex e171633ee..42a214cb4 100644--- a/src/web/src/components/community/shell/use-shell-inbox-controller.ts+++ b/src/web/src/components/community/shell/use-shell-inbox-controller.ts@@ -1,6 +1,7 @@"use client"import { useCallback, useRef, useState, type ComponentProps } from "react"+import { inboxUnreadCount } from "@/lib/community/inbox-unread-count"import { communityKeys } from "@/lib/query-keys"import { channelHref } from "@/lib/community/community-route"import type { Marked, Mention, UnreadDm, UnreadServer } from "@/lib/community/models/inbox"@@ -320,6 +321,14 @@ export function useShellInboxController({return {popoverProps,+ unreadCount: inboxUnreadCount({+ servers: unreadFeed,+ dms: unreadDms,+ mentions: inboxMentions.mentions,+ friendRequestCount: friendRequestActions.items.length,+ pendingChannelIds: [...(inboxUnreads.pendingChannelIds ?? []), ...(inboxMentions.pendingChannelIds ?? [])],+ }),+ unreadCountPartial: Boolean(inboxUnreads.data?.truncated || inboxMentions.data?.truncated),hasUnread:inboxUnreads.hasProjectedUnread|| inboxMentions.hasProjectedMentiondiff --git a/src/web/src/components/community/shell/user-bar.tsx b/src/web/src/components/community/shell/user-bar.tsxindex 3ca563d9d..5209a02ff 100644--- a/src/web/src/components/community/shell/user-bar.tsx+++ b/src/web/src/components/community/shell/user-bar.tsx@@ -1,13 +1,15 @@"use client"import {+ useId,useRef,useState,type MutableRefObject,type ReactNode,type RefObject,} from "react"-import { CircleAlert, Download, Inbox, LoaderCircle, Settings } from "lucide-react"+import { CircleAlert, Download, LoaderCircle, Settings } from "lucide-react"+import { InboxUnreadIndicator } from "./inbox-unread-indicator"import { Avatar } from "../avatar"import { Skeleton } from "@/components/ui/skeleton"import type { MachineSummary } from "@/hooks/community/use-machines"@@ -37,13 +39,15 @@ type UserBarExtension = {onDismiss: () => void}-export function UserBar({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnread, inboxOpen, onInboxOpenChange, extension }: {+export function UserBar({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnread, unreadCount, unreadCountPartial, inboxOpen, onInboxOpenChange, extension }: {breakpoint: Breakpointuser: { id: string; name: string; avatar: string; presence?: Presence }onOpenProfile?: OpenProfileonEditProfile?: () => voidinbox?: ReactNodehasUnread: boolean+ unreadCount?: number+ unreadCountPartial?: booleaninboxOpen?: booleanonInboxOpenChange?: (open: boolean) => voidextension?: UserBarExtension@@ -124,6 +128,8 @@ export function UserBar({ breakpoint, user, onOpenProfile, onEditProfile, inbox,onEditProfile={onEditProfile}inbox={inbox}hasUnread={hasUnread}+ unreadCount={unreadCount}+ unreadCountPartial={unreadCountPartial}inboxOpen={inboxOpen}onInboxOpenChange={onInboxOpenChange}closeInboxForAction={closeInboxForAction}@@ -157,13 +163,15 @@ export function UserBarSkeleton() {)}-function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnread, inboxOpen, onInboxOpenChange, closeInboxForAction, profileTriggerRef, profileNameTriggerRef, lastProfileTriggerRef, inboxTriggerRef, updateBadgeRef, onRequestExtensionFocus, extension }: {+function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnread, unreadCount, unreadCountPartial, inboxOpen, onInboxOpenChange, closeInboxForAction, profileTriggerRef, profileNameTriggerRef, lastProfileTriggerRef, inboxTriggerRef, updateBadgeRef, onRequestExtensionFocus, extension }: {breakpoint: Breakpointuser: { id: string; name: string; avatar: string; presence?: Presence }onOpenProfile?: OpenProfileonEditProfile?: () => voidinbox?: ReactNodehasUnread: boolean+ unreadCount?: number+ unreadCountPartial?: booleaninboxOpen?: booleanonInboxOpenChange?: (open: boolean) => voidcloseInboxForAction: () => void@@ -175,6 +183,7 @@ function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnreaonRequestExtensionFocus: (extension: UserBarExtensionKind) => voidextension?: UserBarExtension}) {+ const inboxDescriptionId = useId()const mobile = breakpoint === "mobile"const updateBadgeLabel = extension?.updateBadgePhase === "retry"? "Retry machine update"@@ -239,6 +248,7 @@ function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnrea: "hover:bg-accent hover:text-foreground",)}aria-label={mobile ? (inboxOpen ? "Close Inbox" : "Open Inbox") : "Inbox"}+ aria-describedby={inboxDescriptionId}aria-expanded={inboxOpen}aria-pressed={mobile ? inboxOpen : undefined}aria-controls={inboxOpen && extension ? "community-user-bar-extension" : undefined}@@ -247,10 +257,12 @@ function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnreaonInboxOpenChange?.(!inboxOpen)}}>- <span className="relative grid size-4 place-items-center">- <Inbox className="size-4" />- {hasUnread && <span className="absolute -right-1 -top-1 size-2 rounded-full bg-primary" />}- </span>+ <InboxUnreadIndicator+ descriptionId={inboxDescriptionId}+ count={unreadCount ?? (hasUnread ? 1 : 0)}+ partial={unreadCountPartial ?? (unreadCount === undefined && hasUnread)}+ open={Boolean(inboxOpen)}+ /></button>) : null}<buttondiff --git a/src/web/src/components/ui/number-ticker.tsx b/src/web/src/components/ui/number-ticker.tsxindex 613765b5b..e23630082 100644--- a/src/web/src/components/ui/number-ticker.tsx+++ b/src/web/src/components/ui/number-ticker.tsx@@ -23,6 +23,7 @@ export function NumberTicker({decimals = 0,compact = false,className,+ duration,}: {value: Value/** Fixed number of fraction digits. Defaults to 0 (integer display). */@@ -30,10 +31,15 @@ export function NumberTicker({/** Compact notation — 1_500 → "1.5K", 1_200_000 → "1.2M". */compact?: booleanclassName?: string+ duration?: number}) {return (<NumberFlowvalue={value}+ {...(duration === undefined ? {} : {+ transformTiming: { duration, easing: "cubic-bezier(0.2, 0.8, 0.2, 1)" },+ opacityTiming: { duration: Math.min(duration, 160), easing: "ease-out" },+ })}format={{notation: compact ? "compact" : "standard",compactDisplay: "short",diff --git a/src/web/src/hooks/community/account-unread-projection.test.ts b/src/web/src/hooks/community/account-unread-projection.test.tsindex cc9b48b80..7a2703b06 100644--- a/src/web/src/hooks/community/account-unread-projection.test.ts+++ b/src/web/src/hooks/community/account-unread-projection.test.ts@@ -12,6 +12,19 @@ import {} from "./account-unread-projection"describe("AccountUnreadProjection", () => {+ it("enumerates distinct pending conversations using the same read fences as the badge", () => {+ const projection = new AccountUnreadProjection("u1")+ projection.recordArrival({ channelId: "dm", seq: 1 })+ projection.recordArrival({ channelId: "dm", seq: 2 })+ projection.recordArrival({ channelId: "other", seq: 1 })+ expect(projection.pendingChannelIds("inbox-unreads", "dms")).toEqual(["dm", "other"])+ projection.recordRead("dm", 2)+ expect(projection.pendingChannelIds("inbox-unreads", "dms")).toEqual(["other"])+ projection.recordRead("other", 1)+ expect(projection.pendingChannelIds("inbox-unreads", "dms")).toEqual([])+ expect(projection.hasPending("inbox-unreads", "dms")).toBe(false)+ })+it("is a per-query-client and account singleton", () => {const client = new QueryClient()expect(getAccountUnreadProjection(client, "u1"))diff --git a/src/web/src/hooks/community/account-unread-projection.ts b/src/web/src/hooks/community/account-unread-projection.tsindex 83101222a..ff567ac92 100644--- a/src/web/src/hooks/community/account-unread-projection.ts+++ b/src/web/src/hooks/community/account-unread-projection.ts@@ -1009,12 +1009,20 @@ export class AccountUnreadProjection {), 0)}- hasPending(+ hasPending(...args: Parameters<AccountUnreadProjection["pendingChannels"]>) {+ return !this.pendingChannels(...args).next().done+ }++ pendingChannelIds(...args: Parameters<AccountUnreadProjection["pendingChannels"]>) {+ return [...new Set(this.pendingChannels(...args))]+ }++ private *pendingChannels(family?: AccountUnreadFamily,domain?: AccountUnreadDomain,exclusion?: AccountUnreadPresentationExclusion | null,) {- if (this.disposed) return false+ if (this.disposed) returnfor (const arrival of this.exact.values()) {if (family && !arrival.families.has(family)) continueif (!this.scopeAllowed(arrival)) continue@@ -1034,7 +1042,7 @@ export class AccountUnreadProjection {(!fence || membershipOrdinal > fence.ordinal)&& this.policyAllows(arrival, facet, this.policy)&& (facet !== "attention" || !this.attentionDismissed(arrival))- ) return true+ ) yield arrival.channelId}for (const unknown of this.sticky.values()) {if (!this.scopeAllowed(unknown)) continue@@ -1048,10 +1056,9 @@ export class AccountUnreadProjection {if ((!fence || pending.ordinal > fence.ordinal)&& this.policyAllows(unknown, facet, this.policy)- ) return true+ ) yield unknown.channelId}}- return false}setNotificationPolicy(snapshot: AccountUnreadPolicySnapshot) {diff --git a/src/web/src/hooks/community/use-inbox.ts b/src/web/src/hooks/community/use-inbox.tsindex 52c73f2ae..d1b8c466f 100644--- a/src/web/src/hooks/community/use-inbox.ts+++ b/src/web/src/hooks/community/use-inbox.ts@@ -190,6 +190,7 @@ export function useInboxUnreads(): UseQueryResult<UnreadsResponse> & {friendRequests: InboxFriendRequest[]servers: UnreadServer[]dms: UnreadDm[]+ pendingChannelIds: string[]hasProjectedUnread: booleanhasOutstandingFriendRequest: boolean} {@@ -317,6 +318,10 @@ export function useInboxUnreads(): UseQueryResult<UnreadsResponse> & {friendRequests: query.data?.friendRequests ?? (EMPTY_FRIEND_REQUESTS as InboxFriendRequest[]),servers: projected.servers ?? (EMPTY_UNREADS as UnreadServer[]),dms: projected.dms ?? (EMPTY_DMS as UnreadDm[]),+ pendingChannelIds: [+ ...unreadProjection.pendingChannelIds("inbox-unreads", "channels", channelExclusion),+ ...unreadProjection.pendingChannelIds("inbox-unreads", "dms", dmExclusion),+ ],hasProjectedUnread:projected.servers.length > 0|| projected.dms.length > 0@@ -377,6 +382,7 @@ export const inboxMentionsProjectedQueryFn = (export function useInboxMentions(): UseQueryResult<MentionsResponse> & {mentions: Mention[]+ pendingChannelIds: string[]hasProjectedMention: boolean} {const queryClient = useQueryClient()@@ -453,6 +459,7 @@ export function useInboxMentions(): UseQueryResult<MentionsResponse> & {return {...query,mentions,+ pendingChannelIds: unreadProjection.pendingChannelIds("inbox-mentions", "mentions", mentionExclusion),hasProjectedMention:mentions.length > 0|| unreadProjection.hasPending(diff --git a/src/web/src/lib/community/inbox-unread-count.test.ts b/src/web/src/lib/community/inbox-unread-count.test.tsnew file mode 100644index 000000000..3286f132e--- /dev/null+++ b/src/web/src/lib/community/inbox-unread-count.test.ts@@ -0,0 +1,19 @@+import { describe, expect, it } from "vitest"+import { inboxUnreadCount } from "./inbox-unread-count"+import type { Mention, UnreadDm, UnreadServer } from "./models/inbox"++describe("inboxUnreadCount", () => {+ it("deduplicates mentions and pending arrivals without counting grouping parents", () => {+ const servers = [{ serverId: "s", serverName: "S", channels: [+ { channelId: "parent", hasDirectUnread: false, children: [{ channelId: "thread" }] },+ { channelId: "direct", children: [] },+ ] }] as UnreadServer[]+ const mentions = [{ id: "m1", channelId: "thread" }, { id: "m2", channelId: "thread" }, { id: "m3", channelId: "mention-only" }] as Mention[]+ expect(inboxUnreadCount({ servers, dms: [], mentions, pendingChannelIds: ["direct", "pending", "pending"], friendRequestCount: 2 })).toBe(6)+ })++ it("counts DMs, legacy mentions and clears when projected feeds clear", () => {+ expect(inboxUnreadCount({ servers: [], dms: [{ channelId: "dm" }] as UnreadDm[], mentions: [{ id: "legacy" }] as Mention[], friendRequestCount: 1 })).toBe(3)+ expect(inboxUnreadCount({ servers: [], dms: [], mentions: [], friendRequestCount: 0 })).toBe(0)+ })+})diff --git a/src/web/src/lib/community/inbox-unread-count.ts b/src/web/src/lib/community/inbox-unread-count.tsnew file mode 100644index 000000000..a6519d7d1--- /dev/null+++ b/src/web/src/lib/community/inbox-unread-count.ts@@ -0,0 +1,20 @@+import type { Mention, UnreadDm, UnreadServer } from "./models/inbox"++export function inboxUnreadCount({ servers, dms, mentions, friendRequestCount, pendingChannelIds = [] }: {+ servers: UnreadServer[]+ dms: UnreadDm[]+ mentions: Mention[]+ friendRequestCount: number+ pendingChannelIds?: string[]+}) {+ const conversations = new Set(pendingChannelIds)+ for (const server of servers) {+ for (const channel of server.channels) {+ if (channel.hasDirectUnread !== false) conversations.add(channel.channelId)+ for (const child of channel.children) conversations.add(child.channelId)+ }+ }+ for (const dm of dms) conversations.add(dm.channelId)+ for (const mention of mentions) conversations.add(mention.channelId ?? `mention:${mention.id}`)+ return conversations.size + friendRequestCount+}diff --git a/src/web/src/test/e2e-ui/41-account-unread-projection.spec.ts b/src/web/src/test/e2e-ui/41-account-unread-projection.spec.tsindex 12be29b6a..8cef65867 100644--- a/src/web/src/test/e2e-ui/41-account-unread-projection.spec.ts+++ b/src/web/src/test/e2e-ui/41-account-unread-projection.spec.ts@@ -97,6 +97,7 @@ function hasCorrelatedBundle(}async function expectUnreadDot(row: ReturnType<Page["getByTestId"]>) {+ await expect(row).toBeVisible({ timeout: 30_000 })await expect(row.locator("span.rounded-full.bg-primary")).toHaveCount(1)}@@ -270,7 +271,7 @@ test.describe.serial("account unread projection", () => {}, { timeout: 20_000 }).toBe(true)const inboxTrigger = bob.page.getByTestId(tid.inboxTrigger)- await expect(inboxTrigger.locator("span.bg-primary")).toHaveCount(1)+ await expect(inboxTrigger.locator('[data-slot="inbox-unread-indicator"]')).toHaveAttribute("data-unread", "true")await inboxTrigger.click()await expect(bob.page.getByTestId(tid.inboxUnreadChannel(channelId))).toBeVisible()await bob.page.getByRole("tab", { name: "Mentions" }).click()@@ -282,7 +283,7 @@ test.describe.serial("account unread projection", () => {await expect(bob.page).toHaveURL(`/c/channels/${serverId}/${channelId}`)await expect(bob.page.getByText(mentionText, { exact: false })).toBeVisible({ timeout: 20_000 })await expect.poll(observerGate.pending).toBeGreaterThan(0)- await expect(inboxTrigger.locator("span.bg-primary")).toHaveCount(0)+ await expect(inboxTrigger.locator('[data-slot="inbox-unread-indicator"]')).toHaveAttribute("data-count", "0")await expectNoUnreadDot(bob.page.getByTestId(tid.channelRow(channelId)))await expect.poll(async () => bob.page.getByTestId(tid.serverRailIndicator(serverId))@@ -395,7 +396,7 @@ test.describe.serial("account unread projection", () => {await expect(page.getByTestId(tid.inboxUnreadChannel(unreadChannel))).toHaveCount(0)await expect(page.getByTestId(tid.inboxUnreadChild(forumChild))).toBeVisible()await expect(page.getByTestId(tid.inboxUnreadDm(dmId))).toBeVisible()- await expectUnreadDot(page.getByTestId(tid.inboxTrigger))+ await expect(page.getByTestId(tid.inboxTrigger).locator('[data-slot="inbox-unread-indicator"]')).not.toHaveAttribute("data-count", "0")await page.getByTestId(tid.inboxTrigger).click()expect(targetPuts).toEqual([])diff --git a/src/web/src/test/e2e-ui/56-inbox-friend-requests.spec.ts b/src/web/src/test/e2e-ui/56-inbox-friend-requests.spec.tsindex e2b1bc3b9..923a7ef82 100644--- a/src/web/src/test/e2e-ui/56-inbox-friend-requests.spec.ts+++ b/src/web/src/test/e2e-ui/56-inbox-friend-requests.spec.ts@@ -13,12 +13,12 @@ import {} from "./_fixtures/seed"import { tid } from "./_fixtures/testids"-async function expectInboxDot(page: Page) {- await expect(page.getByTestId(tid.inboxTrigger).locator("span.bg-primary")).toHaveCount(1)+async function expectInboxUnreadCount(page: Page) {+ await expect(page.getByTestId(tid.inboxTrigger).locator('[data-slot="inbox-unread-indicator"]')).not.toHaveAttribute("data-count", "0")}-async function expectNoInboxDot(page: Page) {- await expect(page.getByTestId(tid.inboxTrigger).locator("span.bg-primary")).toHaveCount(0)+async function expectNoInboxUnreadCount(page: Page) {+ await expect(page.getByTestId(tid.inboxTrigger).locator('[data-slot="inbox-unread-indicator"]')).toHaveAttribute("data-count", "0")}async function clearMessageInbox(page: Page) {@@ -92,10 +92,27 @@ test.describe.serial("actionable Inbox friend requests", () => {try {await expect(bob.page.getByTestId(tid.friendsShortcutBadge)).toHaveText("1")await expect(bob.page.getByTestId(tid.friendsNewBadge)).toHaveText("1")- await expectInboxDot(bob.page)+ await expectInboxUnreadCount(bob.page)const trigger = bob.page.getByTestId(tid.inboxTrigger)+ const indicator = trigger.locator('[data-slot="inbox-unread-indicator"]')+ await expect(indicator).toHaveAttribute("data-unread", "true")+ const circle = indicator.locator('[data-slot="inbox-unread-circle"]')+ await waitForElementMotion(circle)+ const beforeColor = await circle.evaluate((node) => getComputedStyle(node).backgroundColor)+ await bob.page.emulateMedia({ reducedMotion: "reduce" })+ await expect.poll(() => circle.evaluate((node) => getComputedStyle(node).backgroundColor)).toBe(beforeColor)+ const circleBox = await circle.boundingBox()+ const buttonBox = await trigger.boundingBox()+ const settingsBox = await bob.page.getByTestId(tid.userSettingsOpen).boundingBox()+ expect(circleBox).not.toBeNull()+ expect(buttonBox).not.toBeNull()+ expect(settingsBox).not.toBeNull()+ expect(Math.abs(circleBox!.x + circleBox!.width / 2 - buttonBox!.x - buttonBox!.width / 2)).toBeLessThan(0.5)+ expect(Math.abs(circleBox!.y + circleBox!.height / 2 - settingsBox!.y - settingsBox!.height / 2)).toBeLessThan(0.5)+ await bob.page.emulateMedia({ reducedMotion: "no-preference" })await trigger.click()+ await expect(indicator).toHaveAttribute("data-unread", "false")const row = bob.page.getByTestId(tid.inboxFriendRequest(friendshipId))await expect(row).toBeVisible()await expect(bob.page.getByText("Friend requests — 1", { exact: true })).toBeVisible()@@ -103,7 +120,7 @@ test.describe.serial("actionable Inbox friend requests", () => {await expect(bob.page.getByRole("button", { name: "Mark all read" })).toBeDisabled()await trigger.click()- await expectInboxDot(bob.page)+ await expectInboxUnreadCount(bob.page)await trigger.click()await expect(row).toBeVisible()@@ -140,7 +157,7 @@ test.describe.serial("actionable Inbox friend requests", () => {await seedMessage("alice", channelId, `Friend request channel unread ${stamp}`)await seedDmMessage("alice", dmId, `Friend request DM unread ${stamp}`)- await expectInboxDot(bob.page)+ await expectInboxUnreadCount(bob.page)await bob.page.getByTestId(tid.inboxTrigger).click()const requestRow = bob.page.getByTestId(tid.inboxFriendRequest(friendshipId))const dmRow = bob.page.getByTestId(tid.inboxUnreadDm(dmId))@@ -165,7 +182,7 @@ test.describe.serial("actionable Inbox friend requests", () => {await expect(dmRow).toHaveCount(0)await expect(serverRow).toHaveCount(0)await expect(bob.page.getByRole("button", { name: "Mark all read" })).toBeDisabled()- await expectInboxDot(bob.page)+ await expectInboxUnreadCount(bob.page)} finally {await seedCancelFriendRequest("carol", friendshipId)}@@ -227,7 +244,7 @@ test.describe.serial("actionable Inbox friend requests", () => {await expect(secondRow).toHaveCount(0)await expect(bob.page.getByTestId(tid.friendsShortcutBadge)).toHaveCount(0)await expect(bob.page.getByTestId(tid.friendsNewBadge)).toHaveCount(0)- await expectNoInboxDot(bob.page)+ await expectNoInboxUnreadCount(bob.page)await bob.page.getByTestId(tid.inboxTrigger).click()await bob.page.getByRole("button", { name: "Friends", exact: true }).click()