refactor(web): render menu and popover triggers through Button (#13042)

Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Fable 5 authored and GitHub committed 2026-09-22 12:22:20 -07:00
1 parent 4321aa24fd
commit 1c2f933892
9 files changed
+20 -14

No files matched your search

+2 -1
View File
@@ -672,7 +672,8 @@ export default function DiffPanel({
<div className="flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]">
<DropdownMenu>
<DropdownMenuTrigger
className="inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-accent px-2 text-xs font-medium text-accent-foreground outline-none transition-colors hover:bg-accent/80 focus-visible:ring-2 focus-visible:ring-ring"
render={<Button size="xs" variant="secondary" />}
className="max-w-full"
aria-label={`Diff scope: ${selectedScopeLabel}`}
>
<span className="truncate">{selectedScopeLabel}</span>
@@ -21,6 +21,7 @@ import {
ServerUpdateProgress,
ServerUpdatesAction,
} from "../ServerUpdateAction";
import { InlineButton } from "../ui/button";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
import type { ComposerBannerStackItem } from "./ComposerBannerStack";
import { ComposerServerUpdateIcon } from "./ComposerServerUpdateStatus";
@@ -95,7 +96,8 @@ export function useAutoBalanceUpdateBanner(
title: (
<Popover>
<PopoverTrigger
className="block max-w-full truncate rounded-sm text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"
render={<InlineButton />}
className="block max-w-full truncate"
aria-label={`${title}. View machines`}
>
{title}
@@ -1,5 +1,6 @@
import type { ReactNode } from "react";
import type { DeviceToolVersions as ToolVersions } from "@t3tools/contracts";
import { InlineButton } from "~/components/ui/button";
import { Popover, PopoverPopup, PopoverTitle, PopoverTrigger } from "~/components/ui/popover";
export function DeviceToolVersions({
@@ -32,7 +33,7 @@ export function DeviceToolVersions({
? `${label}: ${version ? `version ${version}` : selected ? "not installed" : "version unknown"}. Show details`
: undefined
}
className="rounded text-xs text-muted-foreground underline decoration-muted-foreground/40 underline-offset-4 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring"
render={<InlineButton tone="muted" />}
>
{kind
? version
@@ -1071,7 +1071,8 @@ function PullRequestCodeTab({
{orderedCommits.length > 0 ? (
<DropdownMenu>
<DropdownMenuTrigger
className="inline-flex h-6 min-w-0 max-w-64 items-center gap-1 rounded-md bg-accent px-2 text-xs font-medium text-accent-foreground outline-none transition-colors hover:bg-accent/80 focus-visible:ring-2 focus-visible:ring-ring"
render={<Button size="xs" variant="secondary" />}
className="min-w-0 max-w-64"
aria-label={`Diff scope: ${scopeLabel}`}
>
<span className="truncate">{scopeLabel}</span>
@@ -2,11 +2,11 @@ import { resolveEnvironmentMachineKind } from "@t3tools/contracts";
import { LayersIcon } from "lucide-react";
import type { ReactNode } from "react";
import { cn } from "../../lib/utils";
import type { SidebarProjectSnapshot } from "../../sidebarProjectGrouping";
import type { EnvironmentPresentation } from "../../state/environments";
import { EnvironmentMachineIcon } from "../EnvironmentMachineIcon";
import { ProjectFavicon } from "../ProjectFavicon";
import { InlineButton } from "../ui/button";
import {
Menu,
MenuPopup,
@@ -111,10 +111,8 @@ function ScopeMenu({
<Menu>
<MenuTrigger
aria-label={ariaLabel}
className={cn(
"inline-flex min-w-0 max-w-56 cursor-pointer items-center gap-1.5 rounded-sm text-left transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
narrowed ? "text-foreground" : "text-muted-foreground hover:text-foreground",
)}
render={<InlineButton tone={narrowed ? "default" : "muted"} />}
className="min-w-0 max-w-56 gap-1.5"
>
{icon}
<span className="min-w-0 truncate">{label}</span>
@@ -47,7 +47,7 @@ vi.mock("./usagePagePreferences", () => ({
readUsagePagePreferences: () => ({ metric: state.metric, windowDays: 30 }),
saveUsagePagePreferences: vi.fn(),
}));
vi.mock("../ui/button", () => ({ Button: "button" }));
vi.mock("../ui/button", () => ({ Button: "button", InlineButton: "button" }));
vi.mock("../ui/scroll-area", () => ({ ScrollArea: "div" }));
vi.mock("../ui/select", () => ({
Select: "select",
@@ -40,7 +40,7 @@ vi.mock("react", async (importOriginal) => {
vi.mock("../../env", () => ({ isElectron: false }));
vi.mock("../../state/usage", () => ({ useUsage: testState.useUsage }));
vi.mock("../ui/button", () => ({ Button: "button" }));
vi.mock("../ui/button", () => ({ Button: "button", InlineButton: "button" }));
vi.mock("../ui/scroll-area", () => ({ ScrollArea: "div" }));
vi.mock("../ui/select", () => ({
Select: "div",
+5 -2
View File
@@ -39,7 +39,7 @@ import {
formatUsd,
makeWindow,
} from "@t3tools/shared/usageFormat";
import { Button } from "../ui/button";
import { Button, InlineButton } from "../ui/button";
import {
Menu,
MenuCheckboxItem,
@@ -737,7 +737,10 @@ function UsageEnvironmentFilter({
return (
<>
<Menu>
<MenuTrigger className="group/usage-environment inline-flex min-w-0 max-w-full cursor-pointer items-center gap-1 rounded-sm text-left focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring">
<MenuTrigger
render={<InlineButton />}
className="group/usage-environment min-w-0 max-w-full gap-1"
>
<span className="min-w-0 truncate">{label}</span>
<span className="flex size-3.5 shrink-0 items-center justify-center text-muted-foreground">
{showUsageStatus && pendingCount > 0 ? (
+1 -1
View File
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
// migrate a file, and delete this script when the rule becomes an error.
export const RESTYLE_CEILING = 717;
export const RESTYLE_CEILING = 668;
const RULE = "shadcn(no-restyle)";