fix(chat): one seen popover for every stack: always titled, anchored to the faces, flips below

Merged
RA
1d ago
+193-11

What

Every faces stack under a message opens the same seen popover:

  • It always has the "Visto por" title, with Pessoas/Agents groups and each row's status (leu, leu em parte, recebeu, parou, terminou).
  • It's anchored to the faces: right edge on the stack's, as wide as its rows (240–320px, never wider than the screen), 8px off.
  • It opens above the faces, and below them when there's no room above.

Why

Valls, in production ("isso aqui tĆ” zoadasso"): one agent's face opened a popover with only "Rafael Valls's claude Ā· delivered", no title, sitting on the message text and stretched left across it.

What was wrong in web/features/chat/MessageFooter.svelte. It's the same component as the seen popover; there's no second popover. MessageActions only hides the toolbar while the popover is open.

  • No title: the title showed only when someone had read the message ({#if seenBy}). An agent that only received it got a bare row, and so did agents that finished or stopped (#674).
  • Too wide: a fixed w-72 (288px) from the stack's right edge, so a one-row popover ran far left across the message.
  • Always above: it opened above, onto the text, even when there was no room there.

Fix:

  • The title is always there.
  • w-max min-w-60 max-w-[min(20rem,calc(100vw-2rem))], anchored right-0 on the faces' group.
  • On open it measures the room above (the scrolling list's top, or the window's) against its own height, and sets top-full pt-2 instead of bottom-full pb-2 when that room is shorter. The 8px padding stays the hover bridge.

This builds on the faces under the message (#675), which merged first; this branch is rebased on it.

Checks run

  • bun run check: pass (on main with #675)
  • bun test --conditions=browser scripts/ui-panels.test.ts: 181 pass. New test: the one-agent delivered case (title, row, "recebeu"), the 240–320px bounds and the right anchor, above by default, and the flip below with no room above.
  • bun test scripts/chat.test.ts scripts/read-receipts.test.ts: pass
  • bun run test:design-system: pass (gallery and inbox)
  • bun run screens -- --receipts: pass. New: an agent-only stack that only received the message, agents that finished and stopped, and a tap on the faces at 390px; the run fails if a popover has no "Visto por". Faces are now counted only when visible, because the phone and desktop stacks are both in the DOM. "Before" ran the same steps on #675's footer; its log notes the missing titles.

Router bench

not touched

Deliberate decisions

none

Screens

One agent that only received it, the production case. Before:
before
After:
after

Agents that finished and stopped (#674). Before:
before
After: no room above in this short room, so it opens below.
after

A person and an agent. Before:
before
After:
after

Many (6 people + 6 agents). Before:
before
After:
after

Only people (after):
after

Phone, one agent. Before:
before
After:
after

Phone, many. Before:
before
After:
after

On a phone, the busy stack's "+11" doesn't fit #675's 16px circle and reads "+1". That's from the faces-below design, not this change; I left it for a follow-up.

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes the seen popover under a message so that a single agent's face opens the same titled, anchored popover as any other stack.

The title "Visto por" now shows even when nobody has read the message; the popover is sized to its rows (240–320px, never wider than the screen) and anchored to the faces' right edge; and it opens above the faces, flipping below when there's not enough room above. Previously the title only appeared when someone had read the message, the popover was a fixed 288px wide, and it always opened above onto the message text.