fix(web): align thread details panel controls and menus (#3606)

This commit is contained in:
maria authored and GitHub committed 2026-06-30 09:38:04 -07:00
1 parent 2f774f8e80
commit 7bf0a2ce15
11 files changed
+81 -19

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "@effect/vitest";
import { ProviderInstanceId, type ModelSelection } from "@t3tools/contracts";
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "@effect/vitest";
import {
type ModelSelection,
@@ -31,6 +31,7 @@ import { cn } from "../lib/utils";
import {
THREAD_DETAILS_PANEL_CHEVRON_CLASS,
THREAD_DETAILS_PANEL_ICON_CLASS,
THREAD_DETAILS_PANEL_ROW_POPUP_CLASS,
THREAD_DETAILS_PANEL_ROW_CLASS,
} from "./chat/threadDetailsPanelStyles";
import { parsePullRequestReference } from "../pullRequestReference";
@@ -730,7 +731,10 @@ export function BranchToolbarBranchSelector({
<ComboboxPopup
align={displayMode === "panel" ? "start" : "end"}
side={displayMode === "panel" ? "bottom" : "top"}
className="flex w-80 flex-col"
className={cn(
"flex flex-col",
displayMode === "panel" ? THREAD_DETAILS_PANEL_ROW_POPUP_CLASS : "w-80",
)}
>
<div className="shrink-0 px-3 pt-2.5">
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
@@ -4,7 +4,8 @@ import { cn } from "../lib/utils";
import {
THREAD_DETAILS_PANEL_ICON_CLASS,
THREAD_DETAILS_PANEL_LOCKED_ROW_CLASS,
THREAD_DETAILS_PANEL_ROW_CLASS,
THREAD_DETAILS_PANEL_ROW_POPUP_CLASS,
THREAD_DETAILS_PANEL_SELECT_ROW_CLASS,
} from "./chat/threadDetailsPanelStyles";
import {
@@ -109,7 +110,7 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe
size={displayMode === "panel" ? "default" : "xs"}
className={cn(
"font-medium",
displayMode === "panel" && THREAD_DETAILS_PANEL_ROW_CLASS,
displayMode === "panel" && THREAD_DETAILS_PANEL_SELECT_ROW_CLASS,
)}
aria-label="Workspace"
/>
@@ -137,7 +138,14 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe
</TooltipTrigger>
{workspacePath ? <TooltipPopup side="left">{workspacePath}</TooltipPopup> : null}
</Tooltip>
<SelectPopup>
<SelectPopup
{...(displayMode === "panel"
? {
alignItemWithTrigger: false,
popupClassName: THREAD_DETAILS_PANEL_ROW_POPUP_CLASS,
}
: {})}
>
<SelectGroup>
<SelectGroupLabel>Workspace</SelectGroupLabel>
<SelectItem value="local">
@@ -7,7 +7,8 @@ import { cn } from "../lib/utils";
import {
THREAD_DETAILS_PANEL_ICON_CLASS,
THREAD_DETAILS_PANEL_LOCKED_ROW_CLASS,
THREAD_DETAILS_PANEL_ROW_CLASS,
THREAD_DETAILS_PANEL_ROW_POPUP_CLASS,
THREAD_DETAILS_PANEL_SELECT_ROW_CLASS,
} from "./chat/threadDetailsPanelStyles";
import {
Select,
@@ -79,7 +80,10 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
<SelectTrigger
variant="ghost"
size={displayMode === "panel" ? "default" : "xs"}
className={cn("font-medium", displayMode === "panel" && THREAD_DETAILS_PANEL_ROW_CLASS)}
className={cn(
"font-medium",
displayMode === "panel" && THREAD_DETAILS_PANEL_SELECT_ROW_CLASS,
)}
aria-label="Run on"
>
{activeEnvironment?.isPrimary ? (
@@ -93,7 +97,14 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
)}
<SelectValue />
</SelectTrigger>
<SelectPopup>
<SelectPopup
{...(displayMode === "panel"
? {
alignItemWithTrigger: false,
popupClassName: THREAD_DETAILS_PANEL_ROW_POPUP_CLASS,
}
: {})}
>
<SelectGroup>
<SelectGroupLabel>Run on</SelectGroupLabel>
{availableEnvironments.map((env) => (
@@ -91,6 +91,7 @@ import { readLocalApi } from "~/localApi";
import {
THREAD_DETAILS_PANEL_CHEVRON_CLASS,
THREAD_DETAILS_PANEL_ICON_CLASS,
THREAD_DETAILS_PANEL_ROW_POPUP_CLASS,
THREAD_DETAILS_PANEL_ROW_CLASS,
THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS,
THREAD_DETAILS_PANEL_SPLIT_PRIMARY_CLASS,
@@ -989,6 +990,7 @@ export default function GitActionsControl({
}: GitActionsControlProps) {
const isPanel = displayMode === "panel";
const ActionGroup = isPanel ? "div" : Group;
const panelAnchorRef = useRef<HTMLDivElement | null>(null);
const updateThreadMetadata = useAtomCommand(
threadEnvironment.updateMetadata,
"thread branch metadata update",
@@ -1706,6 +1708,7 @@ export default function GitActionsControl({
<ActionGroup
role="group"
aria-label="Git actions"
{...(isPanel ? { ref: panelAnchorRef } : {})}
className={cn("shrink-0", isPanel && THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS)}
>
{quickActionDisabledReason ? (
@@ -1793,7 +1796,11 @@ export default function GitActionsControl({
className={isPanel ? THREAD_DETAILS_PANEL_CHEVRON_CLASS : "size-4"}
/>
</MenuTrigger>
<MenuPopup align="end" className="w-full">
<MenuPopup
align="end"
{...(isPanel ? { anchor: panelAnchorRef } : {})}
className={isPanel ? THREAD_DETAILS_PANEL_ROW_POPUP_CLASS : "w-full"}
>
{gitActionMenuItems.map((item) => {
const disabledReason = getMenuActionDisabledReason({
item,
@@ -63,6 +63,7 @@ import { cn } from "~/lib/utils";
import {
THREAD_DETAILS_PANEL_CHEVRON_CLASS,
THREAD_DETAILS_PANEL_ICON_CLASS,
THREAD_DETAILS_PANEL_ROW_POPUP_CLASS,
THREAD_DETAILS_PANEL_ROW_CLASS,
THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS,
THREAD_DETAILS_PANEL_SPLIT_PRIMARY_CLASS,
@@ -134,6 +135,7 @@ export default function ProjectScriptsControl({
}: ProjectScriptsControlProps) {
const isPanel = displayMode === "panel";
const ActionGroup = isPanel ? "div" : Group;
const panelAnchorRef = React.useRef<HTMLDivElement | null>(null);
const addScriptFormId = React.useId();
const [editingScriptId, setEditingScriptId] = useState<string | null>(null);
const [dialogOpen, setDialogOpen] = useState(false);
@@ -267,7 +269,9 @@ export default function ProjectScriptsControl({
<ActionGroup
role="group"
aria-label="Project scripts"
{...(isPanel ? { className: THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS } : {})}
{...(isPanel
? { className: THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS, ref: panelAnchorRef }
: {})}
>
<Tooltip>
<TooltipTrigger
@@ -316,7 +320,11 @@ export default function ProjectScriptsControl({
className={isPanel ? THREAD_DETAILS_PANEL_CHEVRON_CLASS : "size-4"}
/>
</MenuTrigger>
<MenuPopup align="end">
<MenuPopup
align="end"
{...(isPanel ? { anchor: panelAnchorRef } : {})}
className={isPanel ? THREAD_DETAILS_PANEL_ROW_POPUP_CLASS : undefined}
>
{scripts.map((script) => {
const shortcutLabel = shortcutLabelForCommand(
keybindings,
+11 -3
View File
@@ -1,5 +1,5 @@
import { EditorId, type EnvironmentId, type ResolvedKeybindingsConfig } from "@t3tools/contracts";
import { memo, useCallback, useMemo } from "react";
import { memo, useCallback, useMemo, useRef } from "react";
import { shortcutLabelForCommand } from "../../keybindings";
import { usePreferredEditor } from "../../editorPreferences";
import { ChevronDownIcon, FolderClosedIcon } from "lucide-react";
@@ -37,6 +37,7 @@ import { useAtomCommand } from "~/state/use-atom-command";
import {
THREAD_DETAILS_PANEL_CHEVRON_CLASS,
THREAD_DETAILS_PANEL_ICON_CLASS,
THREAD_DETAILS_PANEL_ROW_POPUP_CLASS,
THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS,
THREAD_DETAILS_PANEL_SPLIT_PRIMARY_CLASS,
THREAD_DETAILS_PANEL_SPLIT_SECONDARY_CLASS,
@@ -176,6 +177,7 @@ export const OpenInPicker = memo(function OpenInPicker({
}) {
const isPanel = displayMode === "panel";
const ActionGroup = isPanel ? "div" : Group;
const panelAnchorRef = useRef<HTMLDivElement | null>(null);
const openInEditorMutation = useAtomCommand(shellEnvironment.openInEditor, "open in editor");
const [preferredEditor, setPreferredEditor] = usePreferredEditor(availableEditors);
const options = useMemo(
@@ -212,7 +214,9 @@ export const OpenInPicker = memo(function OpenInPicker({
<ActionGroup
aria-label="Open in editor"
role="group"
{...(isPanel ? { className: THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS } : {})}
{...(isPanel
? { className: THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS, ref: panelAnchorRef }
: {})}
>
<Button
aria-label={compact ? "Open file in preferred editor" : primaryLabel}
@@ -260,7 +264,11 @@ export const OpenInPicker = memo(function OpenInPicker({
className={isPanel ? THREAD_DETAILS_PANEL_CHEVRON_CLASS : "size-4"}
/>
</MenuTrigger>
<MenuPopup align="end">
<MenuPopup
align="end"
{...(isPanel ? { anchor: panelAnchorRef } : {})}
className={isPanel ? THREAD_DETAILS_PANEL_ROW_POPUP_CLASS : undefined}
>
{options.length === 0 && <MenuItem disabled>No installed editors found</MenuItem>}
{options.map(({ label, Icon, value }) => (
<MenuItem key={value} onClick={() => openInEditor(value)}>
@@ -30,15 +30,17 @@ import { Button } from "../ui/button";
import { Menu, MenuItem, MenuPopup, MenuTrigger } from "../ui/menu";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
import {
THREAD_DETAILS_PANEL_ICON_CLASS,
THREAD_DETAILS_PANEL_ICON_ACTION_CLASS,
THREAD_DETAILS_PANEL_LINK_ROW_CLASS,
THREAD_DETAILS_PANEL_LINK_SPLIT_GROUP_CLASS,
THREAD_DETAILS_PANEL_LINK_SPLIT_PRIMARY_CLASS,
THREAD_DETAILS_PANEL_LINK_SPLIT_SECONDARY_CLASS,
THREAD_DETAILS_PANEL_MENU_POPUP_CLASS,
THREAD_DETAILS_PANEL_SPLIT_SEPARATOR_CLASS,
} from "./threadDetailsPanelStyles";
const THREAD_RELATIONSHIP_ICON_CLASS = "size-4 shrink-0 text-muted-foreground";
function relationshipLabel(edge: ThreadRelationshipEdge, currentThreadId: ThreadId) {
if (edge.kind === "transfer") return "Context transfer";
if (edge.kind === "subagent") {
@@ -190,7 +192,7 @@ export function ThreadRelationshipsPanel(props: {
>
<MoreHorizontalIcon className="size-3.5" />
</MenuTrigger>
<MenuPopup align="end">
<MenuPopup align="end" className={THREAD_DETAILS_PANEL_MENU_POPUP_CLASS}>
<MenuItem onClick={() => void detach()}>
<UnplugIcon className="size-3.5" />
Disconnect agent session
@@ -221,7 +223,7 @@ export function ThreadRelationshipsPanel(props: {
const relationshipContent = (
<>
<span className="relative -mx-0.5 grid size-4 shrink-0 place-items-center">
<RelationshipIcon className={THREAD_DETAILS_PANEL_ICON_CLASS} />
<RelationshipIcon className={THREAD_RELATIONSHIP_ICON_CLASS} />
<span
className={cn(
"absolute -bottom-1 -right-1 size-2 rounded-full border-2 border-card",
@@ -0,0 +1,6 @@
export const CHAT_GLASS_POPUP_SURFACE_CLASS =
"floating-glass-surface !bg-[color-mix(in_srgb,var(--card)_20%,transparent)] dark:!bg-[color-mix(in_srgb,var(--card)_45%,transparent)]";
export const CHAT_GLASS_ROW_POPUP_CLASS = `${CHAT_GLASS_POPUP_SURFACE_CLASS} w-(--anchor-width)`;
export const CHAT_GLASS_MENU_POPUP_CLASS = `${CHAT_GLASS_POPUP_SURFACE_CLASS} min-w-60 max-w-(--available-width)`;
@@ -1,3 +1,5 @@
import { CHAT_GLASS_MENU_POPUP_CLASS, CHAT_GLASS_ROW_POPUP_CLASS } from "./glassPopupStyles";
/**
* Visual primitives shared by controls when they are rendered in the thread details panel.
*
@@ -19,6 +21,8 @@ const THREAD_DETAILS_PANEL_SPLIT_BUTTON_SURFACE_CLASS = `${THREAD_DETAILS_PANEL_
export const THREAD_DETAILS_PANEL_ROW_CLASS = `h-9 w-full justify-start gap-2.5 rounded-lg border-transparent bg-transparent px-2.5 text-[13px] font-medium text-foreground/80 sm:h-9 sm:text-[13px] ${THREAD_DETAILS_PANEL_ROW_SURFACE_CLASS}`;
export const THREAD_DETAILS_PANEL_SELECT_ROW_CLASS = `${THREAD_DETAILS_PANEL_ROW_CLASS} pe-0 before:pointer-events-none before:absolute before:inset-0 [&_[data-slot=select-icon]]:-me-px [&_[data-slot=select-icon]]:relative [&_[data-slot=select-icon]]:flex [&_[data-slot=select-icon]]:h-full [&_[data-slot=select-icon]]:w-8 [&_[data-slot=select-icon]]:shrink-0 [&_[data-slot=select-icon]]:items-center [&_[data-slot=select-icon]]:justify-center [&_[data-slot=select-icon]]:before:absolute [&_[data-slot=select-icon]]:before:-left-px [&_[data-slot=select-icon]]:before:top-1/2 [&_[data-slot=select-icon]]:before:h-4 [&_[data-slot=select-icon]]:before:w-px [&_[data-slot=select-icon]]:before:-translate-y-1/2 [&_[data-slot=select-icon]]:before:bg-border/65 [&_[data-slot=select-icon]>svg]:me-0 [&_[data-slot=select-icon]>svg]:size-4 [&_[data-slot=select-icon]>svg]:text-muted-foreground [&_[data-slot=select-icon]>svg]:opacity-100`;
export const THREAD_DETAILS_PANEL_LINK_ROW_CLASS = `flex h-9 min-w-0 flex-1 cursor-pointer items-center justify-start gap-2.5 rounded-lg border border-transparent bg-transparent px-2.5 text-left text-[13px] font-medium text-foreground/80 disabled:cursor-not-allowed disabled:opacity-55 sm:h-9 sm:text-[13px] ${THREAD_DETAILS_PANEL_ROW_SURFACE_CLASS}`;
export const THREAD_DETAILS_PANEL_LINK_SPLIT_GROUP_CLASS = `group/thread-details-link flex w-full items-center rounded-lg transition-colors ${THREAD_DETAILS_PANEL_HOVER_SURFACE_CLASS}`;
@@ -30,7 +34,7 @@ export const THREAD_DETAILS_PANEL_LINK_SPLIT_SECONDARY_CLASS = `h-9 w-8 shrink-0
export const THREAD_DETAILS_PANEL_LOCKED_ROW_CLASS =
"h-9 w-full justify-start gap-2.5 rounded-lg border border-transparent px-2.5 text-[13px] font-medium text-foreground/80 sm:h-9 sm:text-[13px]";
export const THREAD_DETAILS_PANEL_ICON_CLASS = "size-4 shrink-0 text-muted-foreground";
export const THREAD_DETAILS_PANEL_ICON_CLASS = "-mx-0.5 size-4 shrink-0 text-muted-foreground";
export const THREAD_DETAILS_PANEL_CHEVRON_CLASS = "size-4 shrink-0 text-muted-foreground";
@@ -43,3 +47,7 @@ export const THREAD_DETAILS_PANEL_SPLIT_PRIMARY_CLASS = `h-9 min-w-0 flex-1 just
export const THREAD_DETAILS_PANEL_SPLIT_SECONDARY_CLASS = `h-9 w-8 rounded-s-none border-transparent bg-transparent px-0 sm:h-9 sm:w-8 ${THREAD_DETAILS_PANEL_SPLIT_BUTTON_SURFACE_CLASS}`;
export const THREAD_DETAILS_PANEL_SPLIT_SEPARATOR_CLASS = "h-4 w-px shrink-0 bg-border/65";
export const THREAD_DETAILS_PANEL_ROW_POPUP_CLASS = CHAT_GLASS_ROW_POPUP_CLASS;
export const THREAD_DETAILS_PANEL_MENU_POPUP_CLASS = CHAT_GLASS_MENU_POPUP_CLASS;