The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): give queued toasts bounded card depth
brooklyn!ca6bfe2b6c60
diff --git a/apps/desktop/DESIGN.md b/apps/desktop/DESIGN.mdindex a5994459e9b..54c241f3b3c 100644--- a/apps/desktop/DESIGN.md+++ b/apps/desktop/DESIGN.md@@ -86,6 +86,13 @@ Menus and popovers use their own shared `shadow-md` +dashed targets and local blur. These are semantic surface classes, not licensesfor call-site shadow or border inventions.+**Queued cards:** `CardStack` (`src/components/ui/card-stack.tsx`) shows one+interactive front card and at most two inert, inset back edges. Queue length+changes the count, not the pile height. Approvals rise above the composer;+top-center toasts stack downward and bottom-right toasts upward. Pass the+existing surface tokens/radius; the primitive owns only depth. Hidden cards+have no live controls. Toasts may explicitly expand to the full list.+## Window glassGlass defaults to **29% Tint, Sidebar only** in both light and dark appearances.diff --git a/apps/desktop/src/components/notifications.test.tsx b/apps/desktop/src/components/notifications.test.tsxindex 9a0a6823f51..81d4a8a160c 100644--- a/apps/desktop/src/components/notifications.test.tsx+++ b/apps/desktop/src/components/notifications.test.tsx@@ -32,6 +32,20 @@ describe('toast titles', () => {expect(className).toMatch(/\boverflow-y-auto\b/)})+ it.each(['default', 'bottom-right'] as const)('caps the %s toast stack at two back edges and keeps older notifications reachable', placement => {+ for (let index = 0; index < 7; index++) {+ notify({ id: `notice-${index}`, message: `Notice ${index}`, placement, durationMs: 0 })+ }+ render(<NotificationStack />)+ expect(screen.getAllByRole('status')).toHaveLength(1)+ expect(document.querySelectorAll('[data-slot="card-stack-edge"]')).toHaveLength(2)+ fireEvent.click(screen.getByRole('button', { name: /Show.*6/ }))+ expect(screen.getByText('Notice 0')).toBeTruthy()+ expect(screen.getAllByRole('status')).toHaveLength(7)+ fireEvent.click(screen.getAllByRole('button', { name: /Dismiss/ })[0])+ expect(screen.queryByText('Notice 6')).toBeNull()+ })+it('renders the full title and body instead of truncating them', () => {notify({ kind: 'error', title: LONG_TITLE, message: DETAIL })diff --git a/apps/desktop/src/components/notifications.tsx b/apps/desktop/src/components/notifications.tsxindex 267ad31f551..8daa92596b6 100644--- a/apps/desktop/src/components/notifications.tsx+++ b/apps/desktop/src/components/notifications.tsx@@ -4,6 +4,7 @@ import { createPortal } from 'react-dom'import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'import { Button } from '@/components/ui/button'+import { CardStack } from '@/components/ui/card-stack'import { Codicon } from '@/components/ui/codicon'import { CopyButton } from '@/components/ui/copy-button'import { useI18n } from '@/i18n'@@ -119,14 +120,16 @@ function TopCenterStack({aria-label={copy.region}className={cn(REGION_BASE,- 'left-1/2 top-[calc(var(--titlebar-height,34px)+0.75rem)] w-[min(40rem,calc(100%-2rem))] -translate-x-1/2 flex-col'+ 'left-1/2 top-[calc(var(--titlebar-height,34px)+0.75rem)] w-[min(40rem,calc(100%-2rem))] -translate-x-1/2 flex-col max-h-[70vh] overflow-y-auto overscroll-contain p-1')}role="region">- <NotificationItem notification={latest} />+ <CardStack count={expanded ? 1 : notifications.length} backClassName="rounded-lg border border-(--stroke-nous) bg-popover shadow-nous">+ <NotificationItem notification={latest} />+ </CardStack>{expanded && older.map(n => <NotificationItem key={n.id} notification={n} />)}{older.length > 0 && (- <div className={cn(STACK_SURFACE, 'flex min-h-8 items-center justify-between rounded-lg px-3 text-xs')}>+ <div className="pointer-events-auto flex min-h-8 items-center justify-between px-3 text-xs"><Button className="-ml-2" onClick={onToggleExpanded} size="xs" type="button" variant="text">{expanded ? copy.hide : copy.show} {copy.more(older.length)}</Button>@@ -140,8 +143,7 @@ function TopCenterStack({)}-// Ambient stack: bottom-right, every toast shown at once (routine confirmations-// rarely queue up), newest on top, no expand/clear-all chrome.+// Ambient confirmations use the same bounded depth, rising from the corner.function BottomRightStack({copy,notifications@@ -149,15 +151,35 @@ function BottomRightStack({copy: ReturnType<typeof useI18n>['t']['notifications']notifications: AppNotification[]}) {+ const [expanded, setExpanded] = useState(false)+ const [latest, ...older] = notifications++ useEffect(() => {+ if (!older.length) {+ setExpanded(false)+ }+ }, [older.length])+return createPortal(<divaria-label={copy.region}- className={cn(REGION_BASE, 'right-4 bottom-4 w-[min(24rem,calc(100%-2rem))] flex-col-reverse')}+ className={cn(REGION_BASE, 'right-4 bottom-4 w-[min(24rem,calc(100%-2rem))] flex-col-reverse max-h-[70vh] overflow-y-auto overscroll-contain p-1')}role="region">- {notifications.map(n => (- <NotificationItem key={n.id} notification={n} />- ))}+ {older.length > 0 && (+ <div className="pointer-events-auto flex items-center justify-between px-2 text-xs">+ <Button onClick={() => setExpanded(value => !value)} size="xs" variant="text">+ {expanded ? copy.hide : copy.show} {copy.more(older.length)}+ </Button>+ <Button onClick={() => notifications.forEach(notification => dismissNotification(notification.id))} size="xs" variant="text">+ {copy.clearAll}+ </Button>+ </div>+ )}+ <CardStack count={expanded ? 1 : notifications.length} direction="up" backClassName="rounded-lg border border-(--stroke-nous) bg-popover shadow-nous">+ <NotificationItem notification={latest} />+ </CardStack>+ {expanded && older.map(notification => <NotificationItem key={notification.id} notification={notification} />)}</div>,document.body)diff --git a/apps/desktop/src/components/ui/card-stack.tsx b/apps/desktop/src/components/ui/card-stack.tsxnew file mode 100644index 00000000000..d4e136c7ba8--- /dev/null+++ b/apps/desktop/src/components/ui/card-stack.tsx@@ -0,0 +1,44 @@+import type { ReactNode } from 'react'++import { cn } from '@/lib/utils'++interface CardStackProps {+ children: ReactNode+ count: number+ /** Match the existing surface: this primitive owns depth, never its palette. */+ backClassName: string+ direction?: 'up' | 'down'+}++/** One live card and at most two inert card edges, regardless of queue length. */+export function CardStack({ children, count, backClassName, direction = 'down' }: CardStackProps) {+ const depth = Math.min(2, Math.max(0, count - 1))++ return (+ <div+ className="relative isolate min-w-0"+ data-slot="card-stack"+ style={{ paddingTop: direction === 'up' ? depth * 6 : 0, paddingBottom: direction === 'down' ? depth * 6 : 0 }}+ >+ {Array.from({ length: depth }, (_, index) => {+ const layer = index + 1++ return (+ <div+ aria-hidden="true"+ className={cn('pointer-events-none absolute', backClassName)}+ data-slot="card-stack-edge"+ key={layer}+ style={{+ insetInline: layer * 6,+ top: direction === 'up' ? (depth - layer) * 6 : layer * 6,+ bottom: direction === 'up' ? layer * 6 : (depth - layer) * 6,+ zIndex: -layer+ }}+ />+ )+ })}+ <div className="relative">{children}</div>+ </div>+ )+}diff --git a/apps/desktop/src/store/notifications.ts b/apps/desktop/src/store/notifications.tsindex f741cf228f3..57d2fda740a 100644--- a/apps/desktop/src/store/notifications.ts+++ b/apps/desktop/src/store/notifications.ts@@ -232,7 +232,8 @@ export function notify(input: NotificationInput): string {window.clearTimeout(timers.get(id))timers.delete(id)- $notifications.set([notification, ...$notifications.get().filter(item => item.id !== id)].slice(0, 4))+ // Visual depth is capped by CardStack, not by discarding queued notifications.+ $notifications.set([notification, ...$notifications.get().filter(item => item.id !== id)])const duration = input.durationMs ?? defaultDuration(kind)