The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(ui): remove unused ButtonGroup and HoverCard components
Steven Enamakeldf023d8e8f28
diff --git a/app/src/components/ui/ButtonGroup.test.tsx b/app/src/components/ui/ButtonGroup.test.tsxdeleted file mode 100644index 18405e8534..0000000000--- a/app/src/components/ui/ButtonGroup.test.tsx+++ /dev/null@@ -1,136 +0,0 @@-import { render, screen } from '@testing-library/react';-import userEvent from '@testing-library/user-event';-import { createRef } from 'react';-import { describe, expect, it, vi } from 'vitest';--import ButtonGroupRoot, { ButtonGroupItem } from './ButtonGroup';--/**- * Raw palette utilities are the failure this suite exists to catch: they look- * correct in the default theme and silently ignore a custom one.- */-const RAW_PALETTE = /\b(bg|text|border|ring)-(neutral|stone|slate|canvas|white|black)\b/;--describe('ButtonGroup', () => {- it('renders a group of buttons with the slot contract', () => {- render(- <ButtonGroupRoot data-testid="group">- <ButtonGroupItem>Day</ButtonGroupItem>- <ButtonGroupItem>Week</ButtonGroupItem>- </ButtonGroupRoot>- );-- const group = screen.getByTestId('group');- expect(group).toHaveAttribute('data-slot', 'button-group');- expect(group).toHaveAttribute('role', 'group');- expect(group).toHaveAttribute('data-orientation', 'horizontal');- expect(group).toHaveAttribute('data-size', 'md');-- const day = screen.getByRole('button', { name: 'Day' });- expect(day).toHaveAttribute('data-slot', 'button-group-item');- expect(day).toHaveAttribute('data-variant', 'secondary');- expect(day).toHaveAttribute('data-size', 'md');- });-- it('passes the root size and tone down to items, and lets an item override', () => {- render(- <ButtonGroupRoot size="sm" tone="danger">- <ButtonGroupItem>Delete</ButtonGroupItem>- <ButtonGroupItem size="lg" tone="default">- Keep- </ButtonGroupItem>- </ButtonGroupRoot>- );-- const del = screen.getByRole('button', { name: 'Delete' });- expect(del).toHaveAttribute('data-size', 'sm');- expect(del).toHaveAttribute('data-tone', 'danger');-- const keep = screen.getByRole('button', { name: 'Keep' });- expect(keep).toHaveAttribute('data-size', 'lg');- expect(keep).toHaveAttribute('data-tone', 'default');- });-- it('joins the children horizontally and stacks them when vertical', () => {- const { rerender } = render(- <ButtonGroupRoot data-testid="group">- <ButtonGroupItem>One</ButtonGroupItem>- </ButtonGroupRoot>- );- expect(screen.getByTestId('group').className).toMatch(/\[&>\*:not\(:first-child\)\]:-ml-px/);-- rerender(- <ButtonGroupRoot data-testid="group" orientation="vertical">- <ButtonGroupItem>One</ButtonGroupItem>- </ButtonGroupRoot>- );- const group = screen.getByTestId('group');- expect(group).toHaveAttribute('data-orientation', 'vertical');- expect(group.className).toMatch(/flex-col/);- expect(group.className).toMatch(/\[&>\*:not\(:first-child\)\]:-mt-px/);- });-- it('forwards ref, className and arbitrary rest props onto the DOM node', () => {- const ref = createRef<HTMLDivElement>();- render(- <ButtonGroupRoot- ref={ref}- data-testid="group"- aria-label="View range"- id="range-group"- className="mt-4">- <ButtonGroupItem data-testid="first">One</ButtonGroupItem>- </ButtonGroupRoot>- );-- const group = screen.getByTestId('group');- expect(ref.current).toBe(group);- expect(group).toHaveAttribute('aria-label', 'View range');- expect(group).toHaveAttribute('id', 'range-group');- expect(group.className).toMatch(/mt-4/);- expect(screen.getByTestId('first')).toBeInTheDocument();- });-- it('preserves analytics ids and keeps items keyboard reachable', async () => {- const user = userEvent.setup();- const onFirst = vi.fn();- const onSecond = vi.fn();-- render(- <ButtonGroupRoot>- <ButtonGroupItem analyticsId="range-day" onClick={onFirst}>- Day- </ButtonGroupItem>- <ButtonGroupItem onClick={onSecond}>Week</ButtonGroupItem>- </ButtonGroupRoot>- );-- expect(screen.getByRole('button', { name: 'Day' })).toHaveAttribute(- 'data-analytics-id',- 'range-day'- );-- // Independent actions, so each button is its own tab stop (unlike- // ToggleGroup's single roving one).- await user.tab();- expect(screen.getByRole('button', { name: 'Day' })).toHaveFocus();- await user.keyboard('{Enter}');- expect(onFirst).toHaveBeenCalledTimes(1);-- await user.tab();- expect(screen.getByRole('button', { name: 'Week' })).toHaveFocus();- await user.keyboard(' ');- expect(onSecond).toHaveBeenCalledTimes(1);- });-- it('uses only themeable tokens — no raw palette utilities', () => {- render(- <ButtonGroupRoot data-testid="group" tone="danger">- <ButtonGroupItem data-testid="item">One</ButtonGroupItem>- </ButtonGroupRoot>- );-- expect(screen.getByTestId('group').className).not.toMatch(RAW_PALETTE);- expect(screen.getByTestId('item').className).not.toMatch(RAW_PALETTE);- });-});diff --git a/app/src/components/ui/ButtonGroup.tsx b/app/src/components/ui/ButtonGroup.tsxdeleted file mode 100644index 98ee781104..0000000000--- a/app/src/components/ui/ButtonGroup.tsx+++ /dev/null@@ -1,119 +0,0 @@-import { type VariantProps } from 'class-variance-authority';-import {- createContext,- forwardRef,- type HTMLAttributes,- useContext,- useMemo,-} from 'react';--import { cn } from '../../lib/cn';-import Button, { type ButtonProps, type buttonVariants } from './Button';--/**- * A segmented row (or column) of `Button`s that reads as one control: the- * borders are joined, only the outer corners are rounded, and neighbouring- * borders overlap by a pixel instead of doubling up.- *- * There is no Radix primitive here and deliberately so — this is layout, not- * behaviour. If you need a *selection* control (one shared roving tab stop,- * pressed state, single/multiple), reach for `ToggleGroup` instead; this is for- * a row of independent actions (Save / Save as / …, or a split button).- *- * The joining is done with child selectors on the root rather than by asking- * each item to know its own position, so a mapped list, a conditional item or- * a wrapped `Tooltip` trigger all keep working. Items still need to be direct- * children for `:first-child` / `:last-child` to mean what it looks like.- *- * `size` / `variant` / `tone` on the root are defaults for `ButtonGroupItem`,- * passed through context — they are `Button`'s own axes verbatim, so a group- * lines up with a standalone `Button` of the same size. An item may still- * override any of them.- */-type ButtonGroupContextValue = Pick<VariantProps<typeof buttonVariants>, 'variant' | 'tone' | 'size'>;--const ButtonGroupContext = createContext<ButtonGroupContextValue>({- variant: 'secondary',- tone: 'default',- size: 'md',-});--export type ButtonGroupOrientation = 'horizontal' | 'vertical';--export interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement>, ButtonGroupContextValue {- orientation?: ButtonGroupOrientation;-}--/**- * `-ml-px` collapses the shared border; `focus-within:z-10` on the children- * lifts the focused button so its ring is not clipped by the neighbour that- * overlaps it.- */-const JOIN: Record<ButtonGroupOrientation, string> = {- horizontal:- 'flex-row [&>*:not(:first-child)]:rounded-l-none [&>*:not(:last-child)]:rounded-r-none ' +- '[&>*:not(:first-child)]:-ml-px',- vertical:- 'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:last-child)]:rounded-b-none ' +- '[&>*:not(:first-child)]:-mt-px',-};--export const ButtonGroupRoot = forwardRef<HTMLDivElement, ButtonGroupProps>((props, ref) => {- const {- variant = 'secondary',- tone = 'default',- size = 'md',- orientation = 'horizontal',- className,- children,- role,- ...rest- } = props;-- const context = useMemo(() => ({ variant, tone, size }), [variant, tone, size]);-- return (- <ButtonGroupContext.Provider value={context}>- <div- ref={ref}- role={role ?? 'group'}- data-slot="button-group"- data-variant={variant ?? undefined}- data-tone={tone ?? undefined}- data-size={size ?? undefined}- data-orientation={orientation}- className={cn(- 'inline-flex items-stretch [&>*]:relative [&>*]:focus-within:z-10',- JOIN[orientation],- className- )}- {...rest}>- {children}- </div>- </ButtonGroupContext.Provider>- );-});-ButtonGroupRoot.displayName = 'ButtonGroupRoot';--export type ButtonGroupItemProps = ButtonProps;--/** A `Button` that inherits the group's variant/tone/size unless it overrides them. */-export const ButtonGroupItem = forwardRef<HTMLButtonElement, ButtonGroupItemProps>(- ({ variant, tone, size, className, ...rest }, ref) => {- const group = useContext(ButtonGroupContext);- return (- <Button- ref={ref}- variant={variant ?? group.variant ?? undefined}- tone={tone ?? group.tone ?? undefined}- size={size ?? group.size ?? undefined}- data-slot="button-group-item"- className={cn('focus-visible:z-10', className)}- {...rest}- />- );- }-);-ButtonGroupItem.displayName = 'ButtonGroupItem';--export default ButtonGroupRoot;diff --git a/app/src/components/ui/HoverCard.test.tsx b/app/src/components/ui/HoverCard.test.tsxdeleted file mode 100644index e1d14272e8..0000000000--- a/app/src/components/ui/HoverCard.test.tsx+++ /dev/null@@ -1,83 +0,0 @@-import { fireEvent, render, screen, waitFor } from '@testing-library/react';-import { describe, expect, it } from 'vitest';--import { HoverCardContent, HoverCardRoot, HoverCardTrigger } from './HoverCard';--const RAW_PALETTE = /\b(?:bg|text|border|ring)-(?:neutral|stone|slate|canvas|white|black)\b/;--const renderHoverCard = (contentProps?: Record<string, unknown>) =>- render(- <HoverCardRoot openDelay={0} closeDelay={0}>- <HoverCardTrigger data-testid="trigger" href="#profile">- @ada- </HoverCardTrigger>- <HoverCardContent data-testid="content" {...contentProps}>- Ada Lovelace- </HoverCardContent>- </HoverCardRoot>- );--describe('HoverCard', () => {- it('stays closed until the trigger is engaged', () => {- renderHoverCard();-- expect(screen.getByTestId('trigger')).toBeInTheDocument();- expect(screen.queryByTestId('content')).toBeNull();- });-- it('opens on keyboard focus and closes on blur', async () => {- renderHoverCard();- const trigger = screen.getByTestId('trigger');-- fireEvent.focus(trigger);- await waitFor(() => expect(screen.getByTestId('content')).toHaveTextContent('Ada Lovelace'));-- fireEvent.blur(trigger);- await waitFor(() => expect(screen.queryByTestId('content')).toBeNull());- });-- it('opens on pointer hover', async () => {- renderHoverCard();-- fireEvent.pointerEnter(screen.getByTestId('trigger'), { pointerType: 'mouse' });- await waitFor(() => expect(screen.getByTestId('content')).toBeInTheDocument());- });-- it('marks the open trigger with data-state', async () => {- renderHoverCard();- const trigger = screen.getByTestId('trigger');-- fireEvent.focus(trigger);- await waitFor(() => expect(trigger).toHaveAttribute('data-state', 'open'));- });-- it('forwards rest props and a data-slot onto the content node', async () => {- renderHoverCard({ id: 'profile-card', 'aria-label': 'Profile' });-- fireEvent.focus(screen.getByTestId('trigger'));- const content = await screen.findByTestId('content');-- expect(content).toHaveAttribute('data-slot', 'hover-card-content');- expect(content).toHaveAttribute('id', 'profile-card');- expect(content).toHaveAttribute('aria-label', 'Profile');- });-- it('lets a caller className win over the defaults', async () => {- renderHoverCard({ className: 'rounded-none' });-- fireEvent.focus(screen.getByTestId('trigger'));- const content = await screen.findByTestId('content');-- expect(content.className).toContain('rounded-none');- expect(content.className).not.toContain('rounded-xl');- });-- it('resolves content styling to design tokens, never a raw palette class', async () => {- renderHoverCard();-- fireEvent.focus(screen.getByTestId('trigger'));- const content = await screen.findByTestId('content');-- expect(content.className).not.toMatch(RAW_PALETTE);- });-});diff --git a/app/src/components/ui/HoverCard.tsx b/app/src/components/ui/HoverCard.tsxdeleted file mode 100644index 181b3aade5..0000000000--- a/app/src/components/ui/HoverCard.tsx+++ /dev/null@@ -1,67 +0,0 @@-import { HoverCard as HoverCardPrimitive } from 'radix-ui';-import { type ComponentPropsWithRef } from 'react';--import { cn } from '../../lib/cn';--/**- * Radix `HoverCard` — a preview surface that opens on pointer hover *and* on- * keyboard focus, which is the whole reason to prefer it over a hand-rolled- * `onMouseEnter` popover: the hover-only version is unreachable from the- * keyboard, and Radix wires focus, escape-to-dismiss and viewport collision- * for free.- *- * Visually it mirrors `Popover.tsx` (same border/surface/shadow/radius) — a- * hover card and a click popover reading differently would be noise, not- * signal. The distinction lives in the interaction, not the chrome.- *- * ANIMATION: only the keyframes in `tailwind.config.js`; `tailwindcss-animate`- * is not installed, so `animate-in`/`fade-in-0` do not exist here. Content- * mounts on open, so `animate-fade-in` is the transition that runs.- *- * NOT a tooltip. A hover card is a rich, non-essential preview; a label for an- * icon button belongs in `Tooltip`.- */-export const HoverCardRoot = HoverCardPrimitive.Root;-export const HoverCardTrigger = HoverCardPrimitive.Trigger;--export interface HoverCardContentProps extends ComponentPropsWithRef<- typeof HoverCardPrimitive.Content-> {- /** Portal target; defaults to `document.body`. */- container?: HTMLElement | null;-}--export const HoverCardContent = ({- className,- align = 'center',- sideOffset = 6,- container,- ...rest-}: HoverCardContentProps) => (- <HoverCardPrimitive.Portal container={container ?? undefined}>- <HoverCardPrimitive.Content- data-slot="hover-card-content"- align={align}- sideOffset={sideOffset}- className={cn(- 'z-50 w-64 rounded-xl border border-line bg-surface p-3 text-sm text-content shadow-large',- 'animate-fade-in focus:outline-none',- className- )}- {...rest}- />- </HoverCardPrimitive.Portal>-);--export const HoverCardArrow = ({- className,- ...rest-}: ComponentPropsWithRef<typeof HoverCardPrimitive.Arrow>) => (- <HoverCardPrimitive.Arrow- data-slot="hover-card-arrow"- className={cn('fill-surface', className)}- {...rest}- />-);--export default HoverCardRoot;diff --git a/app/src/components/ui/index.ts b/app/src/components/ui/index.tsindex 335c1a8389..1c213b16e8 100644--- a/app/src/components/ui/index.ts+++ b/app/src/components/ui/index.ts@@ -5,17 +5,39 @@* reason 491 raw `<button>` elements grew alongside 591 `<Button>` ones: the* barrel did not offer one. Everything is exported here now; if a primitive* exists, import it from `components/ui` rather than reaching into the file.+ *+ * WHAT IS NOT HERE, AND WHY. `ButtonGroup` and `HoverCard` were built, tested,+ * exported and then imported by nothing. That state is worse than absence: a+ * primitive with no consumers reads as "already migrated" in every audit while+ * the hand-rolled markup it was meant to replace stays in place, and its+ * passing tests give false confidence about code no user reaches. Both were+ * checked against this app's real surfaces and deleted rather than+ * force-fitted:+ *+ * - `ButtonGroup` — a segmented row of joined buttons. An app-wide search for+ * the markup it replaces (`rounded-l-none`, `rounded-r-none`,+ * `first:rounded-l`, `last:rounded-r`, `-ml-px`) returns ZERO hits outside+ * this directory. The one near-miss, `settings/panels/NotificationRoutingPanel`,+ * is a `grid grid-cols-3 divide-x` stat readout — three text pairs, no+ * buttons. The segmented-SELECTION case it might otherwise serve already+ * belongs to `ToggleGroup`, which has real consumers.+ *+ * - `HoverCard` — a rich preview surface opening on hover and focus. The three+ * `group-hover:` panels it was meant to replace are not hover cards:+ * `chat/SuperContextToggle` is `role="tooltip"`, a label for a control, which+ * is `Tooltip`'s job (HoverCard's own doc comment said "NOT a tooltip");+ * `skills/SkillsExplorerTab` is a reveal-on-hover Disconnect BUTTON, not a+ * preview; and `intelligence/MemoryGraph` hovers an SVG `<circle>` inside a+ * pan/zoom transform and renders a DOCKED status bar at the panel's foot, not+ * an anchored floating panel — Radix HoverCard anchors to a trigger element,+ * so adopting it there would change the layout, not just the implementation.+ *+ * Do not re-port either without a concrete consumer to adopt it in the same+ * change.*/// Actionsexport { default as Button, buttonVariants, type ButtonProps } from './Button';-export {- ButtonGroupItem,- ButtonGroupRoot,- type ButtonGroupItemProps,- type ButtonGroupOrientation,- type ButtonGroupProps,-} from './ButtonGroup';// Form controlsexport { default as Input, type InputProps } from './Input';@@ -163,13 +185,6 @@ export {PopoverTrigger,type PopoverContentProps,} from './Popover';-export {- HoverCardArrow,- HoverCardContent,- HoverCardRoot,- HoverCardTrigger,- type HoverCardContentProps,-} from './HoverCard';export {DropdownMenuContent,DropdownMenuGroup,