Skip to content

refactor(web-ui): migrate exclusive switchers, menus, toolbar, and tooltips onto @bitfun/ui - #2608

Open
kev1n77 wants to merge 8 commits into
GCWing:1.0.0-explorefrom
kev1n77:fmy/ui-sys
Open

refactor(web-ui): migrate exclusive switchers, menus, toolbar, and tooltips onto @bitfun/ui#2608
kev1n77 wants to merge 8 commits into
GCWing:1.0.0-explorefrom
kev1n77:fmy/ui-sys

Conversation

@kev1n77

@kev1n77 kev1n77 commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adopt the remaining high-value @bitfun/ui primitives in Web UI chrome, and add the missing Tooltip primitive to the design system.

  • Replace custom exclusive switchers with SegmentedControl (Git diff type, Markdown editor view mode, font-size presets).
  • Replace hand-rolled dropdowns with Menu / MenuItem / MenuSection / MenuSeparator (market account, workspace item, assistant-session create, MiniApp gallery import, nav footer settings, MainNav workspace switcher, ShellNav workspace switcher).
  • Rebuild the image-viewer header on Toolbar / ToolbarGroup / ToolbarSeparator.
  • Add ActionItem tone="danger" so destructive menu rows share the status-danger tokens.
  • Add @bitfun/ui Tooltip + TooltipProvider (placement flip, follow-cursor, interactive persistence, overlay.tooltip tokens) and switch product surfaces outside flow_chat to it.

Retire the corresponding appearance parts and migrate persisted appearance packages. flow_chat and leftover legacy Tooltip internals are intentionally unchanged.

Fixes #

Type and Areas

Type:

Feature / UI/UX / refactor

Areas:

web UI, design system (@bitfun/ui, @bitfun/design-tokens, Design Lab), appearance migration

Motivation / Impact

Product chrome still mixed design-system primitives with one-off buttons, popovers, and the legacy @/component-library Tooltip. That duplicated overlay chrome, appearance parts, and styling, and left Menu / Toolbar / Tooltip unused in the places they were built for.

After this change:

  • Exclusive two/three-option switchers, nav/settings/workspace dropdowns, the image-viewer toolbar, and most product tooltips render from @bitfun/ui.
  • Destructive menu rows (close / delete / reset) use a shared danger tone instead of ad-hoc red styles.
  • Older appearance packages that still reference retired parts (levelGroup, modeToggle, footerMenu, workspaceMenu, image-viewer toolbar parts, etc.) migrate automatically.
  • Design Lab can preview Tooltip placements.

No change to Agent Runtime, remote workspace, peer-device, or detached-dispatch behavior. flow_chat still uses the legacy Tooltip.

Verification

pnpm run design-system:build
pnpm run design-system:test
pnpm run design-system:check
pnpm -w run type-check:web
pnpm exec vitest run
pnpm -w run check:web
pnpm run theme:color-audit:all

pnpm exec vitest run was run from src/web-ui and passed 568 files / 4110 tests.

Local-only UI chrome. Not exercised in remote workspace, remote control, Peer Device Mode, or Detached Dispatch.

Manual checks in desktop:dev:

  • Git DiffView Working Tree / Staged switcher
  • Markdown editor source / preview toggle
  • Appearance font size presets
  • Nav footer settings menu, MainNav workspace menu, workspace-item menus, MiniApp import menu
  • Image viewer zoom / rotate / close toolbar
  • Hover tooltips on nav, settings, and SSH dialogs (not flow_chat)

Reviewer Notes

  • Commits are already split by primitive: SegmentedControl, Menu (3 batches), Toolbar, ActionItem tone, then Tooltip (design system + web-ui).
  • Overlay contract: portals that render @bitfun/ui Menu, Modal, or ConfirmDialog own their chrome. overlay-surfaces.contract.test.ts accepts that instead of requiring floating-surface or dialog-surface mixins.
  • Tooltip portals go through TooltipProvider with portalContainer={getAppearanceOverlayHost} in App.tsx, matching Modal.
  • Custom tooltip width overrides now target [data-bf-part='content'] and clear max-inline-size where the 280px cap would clip Agent capability / Create Agent copy.
  • Do not delete the legacy Tooltip yet. flow_chat and a few component-library internals still import it.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

Replace the custom two-option diff type switcher (GitDiffView), the markdown editor view-mode button pairs, and the font size preset button group (FontPreferencePanel) with the design-system SegmentedControl. Retire the corresponding appearance parts and migrate persisted appearance packages that still reference them.
Replace the hand-rolled menu surface and menu item in MarketAccountControls with Menu/MenuItem, keep only positioning overrides in SCSS, retire the menu/menuItem appearance parts, and migrate persisted appearance packages.
Compose the image viewer header from Toolbar/ToolbarGroup/ToolbarSeparator with IconButton and Button controls, drop the bespoke toolbar button styles, retire the toolbar/controls/action appearance parts, and migrate persisted appearance packages.
…nu rows

Destructive actions such as close/delete/reset need a semantic danger treatment inside Menu lists. Expose tone=neutral|danger on ActionItem (inherited by MenuItem), style it with the shared status danger tokens, and cover the contract in tests.
Replace the custom popover markup of the workspace item menus, the assistant session create menu, and the miniapp gallery import menu with Menu/MenuItem/MenuSeparator from @bitfun/ui, keeping only positioning overrides in SCSS. Retire the corresponding appearance parts, migrate persisted appearance packages, and teach the overlay-surface portal contract that design-system surface components own their chrome.
…gn-system Menu

Replace the custom menu markup in PersistentFooterActions (settings footer menu), MainNav (workspace switcher menu), NotificationButton (menu-item form), and ShellNavWorkspaceSwitcher with @bitfun/ui Menu, MenuItem, MenuSection, and MenuSeparator. Local SCSS keeps positioning and animation only; retire the corresponding nav-panel and notification-button appearance parts and migrate persisted appearance packages.
…ab preview

Introduce @bitfun/ui Tooltip with TooltipProvider, placement flipping, follow-cursor and interactive persistence, backed by new overlay.tooltip dimension tokens. Register it in the component registry and expose placement previews in Design Lab.
Switch Tooltip imports from the legacy component library to @bitfun/ui outside flow_chat, mount TooltipProvider with the appearance overlay host, retarget custom tooltip width overrides to data-bf parts, and align test mocks. The legacy Tooltip stays for flow_chat and internal legacy components.
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