Skip to content

Add a notification center and stop clipping long toasts - #2882

Merged
andrewkchan merged 1 commit into
get-bb:mainfrom
andrewkchan:notification-center
Sep 2, 2026
Merged

andrewkchan merged 1 commit into
get-bb:mainfrom
andrewkchan:notification-center

Conversation

@andrewkchan

@andrewkchan andrewkchan commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

This adds a notification center where you can see the full contents of all the notifications you got in 1 place. Currently it's needed cuz the notifications are actually clamped so you can't even see the full contents of a single notification without copy-pasting.

Screen.Recording.2026-09-01.at.6.02.23.PM.mov

Notification center can be accessed via command palette or just pressing "show more" on one of the longer notifications.

What was wrong

Long toast text was unreadable and unrecoverable, for two independent reasons. First, sonner 1.7.4 forces a collapsed non-front toast to the front toast's height — [data-expanded="false"][data-front="false"] { height: var(--front-toast-height) } — and apps/app/src/app.css:594 adds overflow: hidden on that same node so our custom card is clipped rather than overflowing. The moment a second, shorter toast arrived, a long one was cut off; hovering sets data-expanded="true" and restores it, which is why the text was present but unreachable. Second, nothing recorded toasts, so a message that auto-dismissed after its four-second duration was gone for good. Together these made a long plugin install failure impossible to read — the reported symptom was a Could not resolve "@radix-ui/react-tabs" esbuild error that could only be recovered by copy-pasting it elsewhere.

What changed

  • apps/app/src/lib/notifications/notification-store.ts (new): in-memory store recording every toast for the session, capped at 200. Reusing a toast id updates the entry in place, so a loading toast replaced by its result stays one row; transient loading toasts are not recorded.
  • apps/app/src/components/ui/app-toast.tsx: descriptions clamp to four lines and measure real overflow (scrollHeight > clientHeight). When clipped, the toast grows a Show more action that dismisses it and opens the center scrolled to that entry. Clamping also keeps toasts short, so the stacking bug cannot reproduce.
  • apps/app/src/components/notifications/NotificationCenter.tsx (new): bottom-right tray built on shared-ui's Popover, which already falls back to ResponsiveDrawerShell on compact viewports per the AGENTS.md drawer rule. Untruncated text, per-row copy and dismiss, "Clear all". Opening it dismisses the toast stack so the two do not overlap.
  • apps/app/src/components/sidebar/SidebarNotificationsButton.tsx (new) plus AppSidebar: sidebar bell badging the count raised since the center was last opened.
  • packages/domain/src/app-keybindings.ts, apps/server/src/services/system/app-keybindings.ts, apps/app/src/lib/app-command-metadata.ts: new notifications.open command, surfaced in the quick palette as "Show all notifications". It ships unbound rather than claiming a chord; Settings → Keyboard can assign one.
  • apps/app/src/lib/notifications/plugin-toast-recording.ts (new) and plugin-frontend.ts: plugins receive the raw sonner namespace from installPluginRuntime, bypassing appToast, so its toast export is wrapped to record plugin toasts too.
  • apps/app/src/components/sidebar/PluginThreadList.tsx: the only place in the app calling sonner directly; moved to appToast.
  • packages/shared-ui: new Bell icon (Notification03Icon).
  • docs/configuration.md: new Notifications section. apps/app/src/components/ui/sonner.stories.tsx: long-build-error case so the clamp is reviewable in the Ladle catalog.

No wire changes: this is app-layer state plus one AppCommandId enum addition, and nothing crosses the server/daemon boundary, so HOST_DAEMON_PROTOCOL_VERSION is untouched.

How you verified

26 new tests across the store, the plugin-toast wrapper, the toast clamp, and the tray. The clamp and Show-more tests fail before this change because neither the clamp class nor the action exists.

  • pnpm exec turbo run test --filter=@bb/app — 448 files, 3532 passed, 3 skipped
  • pnpm exec turbo run test --filter=@bb/server — 2072 passed
  • pnpm exec turbo run test --filter=@bb/domain --filter=@bb/shared-ui — passing
  • pnpm exec turbo run typecheck --filter=@bb/app --filter=@bb/domain --filter=@bb/server --filter=@bb/shared-ui — clean

Not yet verified visually: the clamp's visual balance and the popover's placement against the toast stack have not been eyeballed in a running app or in iOS Simulator Safari. Worth a look before merge.

AGENT GENERATED

@andrewkchan
andrewkchan force-pushed the notification-center branch 4 times, most recently from e4483a8 to 05f9199 Compare September 2, 2026 01:13
Toasts auto-dismiss after four seconds and nothing recorded them, so a
message you missed was gone for good. Toast titles and descriptions are
also truncated to a single line, so a long one — a plugin install failure
carrying an esbuild error, say — could not be read at all without
copy-pasting it somewhere else.

Add an in-memory store that records every toast for the life of the
session. Reusing a toast id updates the entry in place, so a loading
toast replaced by its result stays one row; transient loading toasts are
not recorded.

Measure whether a toast description actually overflows its single line
and, when it does, offer a "Show more" action beside the toast's other
actions. It opens the notification center scrolled to that entry.

Add NotificationCenter, anchored bottom-right on top of shared-ui's
Popover, which already falls back to ResponsiveDrawerShell on compact
viewports. It shows untruncated text with per-row copy and dismiss, and
two header actions that name themselves on hover: "Clear all" and "Hide
notifications". Opening it dismisses the toast stack so the two do not
overlap.

The only entry point is "Show all notifications" in the quick palette.
The `notifications.open` command ships unbound so Settings → Keyboard can
assign a chord, and it toggles, so it hides the tray too.

PopoverContent auto-focuses its first tabbable child, which would be the
destructive "Clear all" action; that both focuses the wrong thing and
opened its tooltip on mount, whose Escape handler then swallowed the
Escape that should have closed the tray. Prevent the open auto-focus.
onOpenAutoFocus is already stripped on the compact drawer path by
stripRadixContentProps, so this is desktop-only.

Plugin toasts bypass appToast because plugins get the raw sonner
namespace from installPluginRuntime, so wrap its `toast` export to record
them too. PluginThreadList was the only place in the app calling sonner
directly; move it to appToast.

Verified: four tests covering the mechanisms that can actually break —
the toast-id collapse, the plugin sonner wrapper preserving its
un-wrapped methods, and the overflow measurement driving Show more.
Typecheck clean for @bb/app, @bb/shared-ui, @bb/domain and @bb/server.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@andrewkchan
andrewkchan merged commit 88ee0d0 into get-bb:main Sep 2, 2026
13 checks passed
ymichael added a commit that referenced this pull request Sep 4, 2026
## Human comments

## What was wrong

The global React Query mutation handler already owned generic error
toasts when [PR #1582](#1582) added
marketplace and plugin mutations with their own specific `onError`
toasts but no global-handler opt-out. One failed action therefore had
two toast owners; [PR #2882](#2882)
made both alerts durable in notification history and separately missed a
raw Sonner toast in the sidebar plugin-crash fallback.

## What changed

All 12 current first-party mutations with bespoke local error toasts now
opt out of the global mutation error toast, establishing one error-toast
owner per mutation without content-deduplicating distinct events.
`SidebarNavigationRegion` now routes its plugin-crash alert through the
recorded `appToast` helper. Focused regression coverage verifies that a
failed plugin update and a failed marketplace action each retain one
alert, and that the sidebar crash alert is retained. There are no wire,
CLI, guide, or documentation contract changes.

## How you verified

The new plugin-update assertion failed before the fix with two retained
notifications and passed after the fix with one contextual notification.
The rebased focused suite passed 16/16 tests with `pnpm exec turbo run
test --filter=@bb/app --force -- --run
src/components/plugin/management/UpdatePluginDialog.test.tsx
src/components/settings/MarketplacesSettingsSection.test.tsx
src/components/sidebar/SidebarNavigationRegion.test.tsx`. `pnpm exec
turbo run typecheck --filter=@bb/app --force` also passed. Earlier
DevBrowser verification reproduced the marketplace flow changing from
two visible/two retained alerts to one visible/one retained alert, and
the sidebar crash from zero retained alerts to one.

Fixes: no issue — post-merge follow-up

> AGENT GENERATED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant