Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions docs/system-specs/modules/app-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,25 @@ macOS Notification Center-style card under the top bar for a **live**
notification. The card body is `NotificationCard.tsx`, the ONE rendering the
bell popover's mac rows and the banner both use (kind-tinted 26 px icon square,
one-line title, two-line body, relative time with the unread dot, hover-reveal
close, quiet capsule actions); its `elevation` prop is the only difference —
`popover` (72 % card tint, the theme's `--shadow-md`) versus `banner` (88 %
tint, `--shadow-lg`); shadows are theme tokens, never literal alphas. The
close, quiet capsule actions). The card IS a Liquid Glass pane
(`components/Glass.tsx`, the `panel` recipe, `CARD_RADIUS` 16 px) — the same
material as the composer dock — so it carries no tint, blur, border or shadow
classes of its own: the pane's layers are the material, `glass-shadow` the
rest shadow. The card does not know which surface it is on: the pane reads
correctly over the sheet's scrim and over page content alike, so there is no
elevation prop and both surfaces are one glass.
State is a tint step on the host, never an edge: `glass-accent` for the feed's
selected row, `glass-hover` while a pressable card is hovered, and
`glass-faded` (the tint thinned to 55 %) for a silenced row, a collapsed
stack's edges and the banner's deck shells — recession is a tint step, never
an `opacity` on a glass host, because opacity < 1 makes the host a backdrop
root and voids the pane's own blur. The banner's blank deck
shells, its "+N more in your inbox" pill and the feed's controls card, stack
edges and first-note-from-a-channel prompt (its own accent-tinted pane under
the row, since a pane has one radius) are the same primitive. Every pane also
carries `notif-material`, the index.css hook that solidifies it to the card
color where backdrop-filter is unsupported and the selector the sheet's
background-press verdict keys on. The
card's `body` prop replaces the two-line clamp: the feed passes the full
read-only approval render for every approval row, because the popover card
keeps one-click Approve/Reject and a clamped excerpt hides the tail of the
Expand Down Expand Up @@ -345,8 +361,8 @@ retires every pending card.
### Stack

Newest on top. Beyond the top card, up to `BANNER_DECK_DEPTH` (2) older cards
peek as a deck of BLANK shells (card material only, no text, icon or time;
4/8 px offset, .98/.96 scale, .8/.55 opacity), so nothing prints through the
peek as a deck of BLANK shells (the card's glass only, no text, icon or time;
4/8 px offset, .98/.96 scale, the `glass-faded` tint step), so nothing prints through the
translucent top card. Each shell and the "Show N more" pill on the top card's
corner are the same control (`Show N more notifications`) that expands to a
vertical list of at most `BANNER_EXPANDED_MAX` (4) cards plus a "+N more in your
Expand Down
85 changes: 85 additions & 0 deletions website/scripts/capture-notification-banner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
* write threw: row stays, notice under it
* popover-approval-row the bell popover holding a critical approval row
* (Approve / Reject capsules, danger dot, no edge)
* popover-states the popover with every row state at once: a
* SELECTED row (accent tint step), a SILENCED row
* (faded pane, muted title), a collapsed STACK of
* three (count badge, two glass edges peeking below)
* and a plain unread row
* popover-channel-prompt a first note from an app channel the user has not
* decided on: the Keep / Mute prompt pane under it
*
* Recordings (dark, mp4 + gif when ffmpeg is present):
* rec-default-autohide slide-in, hover pause, then the travel into the bell
Expand Down Expand Up @@ -119,6 +126,10 @@ async function openPage({ theme = 'dark', viewport = DESKTOP, permission = 'gran
}
await page.goto(base + '/')
await page.locator('button:has(svg.lucide-bell)').waitFor({ state: 'visible', timeout: 20000 })
// Boot redirects `/` to the first chat route; the bell's sheet closes on any
// pathname change, so a sheet opened before the redirect lands is torn down
// a frame later. Let the route settle first.
await page.waitForURL(u => u.pathname !== '/', { timeout: 10000 }).catch(() => {})
// The socket binds during boot; without it no frame can reach the banner.
for (let i = 0; i < 50 && !ws; i++) await page.waitForTimeout(100)
if (!ws) throw new Error('websocket route never bound')
Expand All @@ -128,6 +139,20 @@ async function openPage({ theme = 'dark', viewport = DESKTOP, permission = 'gran
}

const card = page => page.getByTestId('notification-banner-card')
/** Open the bell sheet and make sure it STAYS open: a sheet opened while boot
* is still settling (a late route change, a store replay) is torn down a few
* frames later, so the phase is re-read after a beat and the bell pressed
* again when that happened. */
async function openSheet(page) {
for (let attempt = 0; attempt < 3; attempt++) {
await page.locator('button:has(svg.lucide-bell)').click()
await page.waitForTimeout(900)
const phase = await page.locator('[data-nc-phase]').getAttribute('data-nc-phase').catch(() => null)
if (phase === 'open') return
await page.waitForTimeout(400)
}
throw new Error('bell sheet did not stay open')
}
const shoot = (page, name) => page.screenshot({ path: join(OUT, `${name}.png`) })

// ---- stills -----------------------------------------------------------------
Expand Down Expand Up @@ -270,6 +295,66 @@ for (const theme of ['dark', 'light']) {
console.log(`popover-approval-row-${theme}: Approve/Reject capsules`)
await context.close()
}
{
// Every restyled row state in one frame. Rows are grouped by day, so all
// four are seeded with the same day (`ts` a few seconds apart); the stack is
// three notes sharing a group_key, the silenced note is what a muted channel
// delivers (silenced + passive), and the selection is a click on the plain
// row (which the popover also acks, so the frame shows an acked+selected
// row exactly as a user sees it after opening a note). Silenced rows hide
// behind the controls card's muted disclosure, so it is opened first.
const seeded = [
note({ kind: 'agent', title: 'Weekly cost report is ready', body: 'Spend is down 12% week over week.' }),
note({ kind: 'cron', title: 'Backup completed', body: 'Snapshot 2026-09-21 stored.', group_key: 'backup' }),
note({ kind: 'cron', title: 'Backup completed', body: 'Snapshot 2026-09-20 stored.', group_key: 'backup' }),
note({ kind: 'cron', title: 'Backup completed', body: 'Snapshot 2026-09-19 stored.', group_key: 'backup' }),
note({ kind: 'hook', title: 'Noisy webhook fired', body: 'Muted channel: still in history.', silenced: true, priority: 'passive', source: 'github', channel: 'github.noisy' }),
note({ kind: 'subagent', title: 'Research subagent finished', body: 'Summary attached to the session.' }),
]
const { context, page } = await openPage({ theme, seeded })
// The silenced note's channel must not prompt: a prompt is its own frame below.
await page.evaluate(() => localStorage.setItem('mc:notif:seenChannels', JSON.stringify(['github.noisy'])))
await openSheet(page)
await page.getByText('Weekly cost report is ready').waitFor({ timeout: 5000 })
// Silenced rows sit behind the muted disclosure in the controls card.
await page.getByRole('button', { name: 'Show muted (1)' }).click()
await page.getByText('Noisy webhook fired').waitFor({ timeout: 5000 })
await page.getByRole('button', { name: /Weekly cost report is ready/ }).first().click()
await page.waitForTimeout(700)
const rows = page.locator('[data-notif-row]')
if ((await rows.count()) !== 4) throw new Error(`expected 4 rows (plain, stack head, silenced, plain), got ${await rows.count()}`)
// The selected row is the accent tint step, the silenced row a faded pane; neither is an edge.
const selected = await page.locator('[data-notif-row].glass-accent').count()
if (selected !== 1) throw new Error(`expected exactly 1 selected (glass-accent) row, got ${selected}`)
const faded = await page.locator('[data-notif-row].glass-faded').count()
if (faded !== 1) throw new Error(`expected exactly 1 silenced (glass-faded) row, got ${faded}`)
if ((await page.locator('[data-notif-row].border-dashed, [data-notif-row].border-accent').count()) !== 0) throw new Error('a row still carries a border state')
// The collapsed stack: one head row with the count badge and two edges under it.
if ((await page.getByText('Backup completed').count()) !== 1) throw new Error('stack did not collapse to one head row')
await shoot(page, `popover-states-${theme}`)
console.log(`popover-states-${theme}: selected + silenced + collapsed stack`)
await context.close()
}
{
const seeded = [
note({ kind: 'agent', title: 'Deploy finished on staging', body: 'ci-bot: build 4821 is live.', source: 'ci-bot', channel: 'ci-bot.deploys' }),
note({ title: 'Nightly digest finished' }),
]
const { context, page } = await openPage({ theme, seeded })
await openSheet(page)
await page.getByText('Deploy finished on staging').waitFor({ timeout: 5000 })
await page.getByRole('button', { name: 'Keep' }).waitFor({ timeout: 5000 })
await page.waitForTimeout(700)
// The prompt is its own glass pane on the accent tint step under the row,
// not a strip glued to the card.
const promptPane = page.locator('.liquid-glass.glass-accent:has(button)').filter({ hasText: 'Keep' })
await promptPane.first().waitFor({ timeout: 5000 })
const promptPanes = await promptPane.count()
if (promptPanes !== 1) throw new Error(`expected the Keep / Mute prompt inside exactly 1 accent glass pane, got ${promptPanes}`)
await shoot(page, `popover-channel-prompt-${theme}`)
console.log(`popover-channel-prompt-${theme}: Keep / Mute pane`)
await context.close()
}
{
const seeded = [note({ title: 'Nightly digest finished' }), note({ kind: 'agent', title: 'Agent note' })]
const { context, page } = await openPage({ theme, permission: 'default', seeded })
Expand Down
6 changes: 4 additions & 2 deletions website/src/components/Glass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
*
* Every surface that floats over the transcript in the composer dock (the
* composer itself, an approval bar, the follow-up chips, a tip or suggestion
* card, the queue, the memory chip, the jump-to-bottom button) and the mobile
* Settings search capsule wear the SAME material, from the SAME primitive:
* card, the queue, the memory chip, the jump-to-bottom button), the mobile
* Settings search capsule and the notification panes (the in-app banner, the
* bell popover's rows and controls card) wear the SAME material, from the SAME
* primitive:
* `--glass-tint` over a blurred backdrop, an even top/bottom light band in
* `--glass-band`, a 1px `--glass-edge` line down each side and a half-pixel
* `--glass-hairline` just outside the top and bottom edges. No ring: the
Expand Down
34 changes: 22 additions & 12 deletions website/src/components/notifications/NotificationBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ackNotification } from '../../store/notificationsSlice'
import { useIsMobile } from '../../hooks/useIsMobile'
import { useGuardedLeave } from '../NavigationLeaveGuard'
import Clickable from '../Clickable'
import Glass from '../Glass'
import ErrorNotice from '../ErrorNotice'
import { MC_LIVE_NOTIFICATION_EVENT, type McLiveNotificationDetail } from '../../hooks/notificationEvent'
import { isWindowAway } from '../../hooks/windowAway'
Expand All @@ -16,7 +17,7 @@ import {
} from '../../hooks/notificationBanner'
import type { Notification } from '../../types'
import { notePriority, safeInternalUrl } from './notifMeta'
import NotificationCard, { CARD_MATERIAL, type NotificationCardAction } from './NotificationCard'
import NotificationCard, { CARD_RADIUS, type NotificationCardAction } from './NotificationCard'

/** Where a leaving card travels: the vector from its own top-right corner to
* the bell's centre, so with `transform-origin: top right` the card shrinks
Expand All @@ -42,10 +43,12 @@ export function exitTarget(delta: ExitDelta | undefined, reduced: boolean): Targ
}
}

/** Deck geometry per depth behind the top card: offset, scale, opacity. */
/** Deck geometry per depth behind the top card: offset and scale. Recession
* is the shell's own `glass-faded` tint step, never an opacity on this
* wrapper: opacity < 1 would make it a backdrop root and void the glass
* pane's blur, so page content would print through the shell unblurred. */
const DECK_Y = [0, 4, 8]
const DECK_SCALE = [1, 0.98, 0.96]
const DECK_OPACITY = [1, 0.8, 0.55]

type ExitDeltas = Record<string, ExitDelta | undefined>

Expand Down Expand Up @@ -369,11 +372,11 @@ export default function NotificationBanner({ bellRef, popoverOpen, onOpenNote }:
layout={!reduced}
initial={enterInitial}
animate={reduced
? { opacity: DECK_OPACITY[deck ? idx : 0] }
? { opacity: 1 }
// Deck cards shrink about the top centre so both side edges
// recede evenly; the exit re-anchors to the top-right corner
// the travel vector was measured from.
: { x: 0, y: deck ? DECK_Y[idx] : 0, scale: deck ? DECK_SCALE[idx] : 1, opacity: DECK_OPACITY[deck ? idx : 0], originX: deck ? 0.5 : 1, originY: 0 }}
: { x: 0, y: deck ? DECK_Y[idx] : 0, scale: deck ? DECK_SCALE[idx] : 1, opacity: 1, originX: deck ? 0.5 : 1, originY: 0 }}
variants={variants}
exit="exit"
transition={{ duration: 0.22, ease: 'easeOut' }}
Expand All @@ -386,20 +389,23 @@ export default function NotificationBanner({ bellRef, popoverOpen, onOpenNote }:
className="rounded-2xl"
>
{deck ? (
// A peeking deck card is a BLANK shell -- the card material
// A peeking deck card is a BLANK shell -- the card's glass
// and nothing else, as in the chosen mockup -- so no text,
// icon or time can print through the translucent top card.
// It is one control: "show me the rest".
<Clickable
<Glass
as="button"
type="button"
variant="panel"
radius={CARD_RADIUS}
aria-label={moreLabel}
data-testid="notification-banner-deck-shell"
className={`notif-material h-full cursor-pointer rounded-2xl ${CARD_MATERIAL.banner}`}
className="notif-material glass-shadow glass-faded block w-full h-full cursor-pointer"
onClick={() => setExpanded(true)}
/>
) : (
<NotificationCard
n={n}
elevation="banner"
onOpen={() => openNote(n)}
openLabel={i18nT('components.notifications.notificationBanner.open_notification', { title: n.title })}
onDismiss={() => removeNotes([n.ts])}
Expand Down Expand Up @@ -428,10 +434,14 @@ export default function NotificationBanner({ bellRef, popoverOpen, onOpenNote }:
})}
</AnimatePresence>
{overflow > 0 && (
<Clickable
className={`notif-material rounded-xl ${CARD_MATERIAL.banner} px-3 py-1.5 text-[12px] text-accent text-center cursor-pointer`}
<Glass
as="button"
type="button"
variant="chip"
radius={12}
className="notif-material glass-shadow glass-hover px-3 py-1.5 text-[12px] text-accent text-center cursor-pointer font-body"
onClick={openInbox}
>{i18nT('components.notifications.notificationBanner.more_in_inbox_count', { count: overflow })}</Clickable>
>{i18nT('components.notifications.notificationBanner.more_in_inbox_count', { count: overflow })}</Glass>
)}
{deckHidden > 0 && (
// The deck's peeking edges are a few pixels tall, so the "N more"
Expand Down
Loading
Loading