fix(web): 33 web UI fixes (#4700)

This commit is contained in:
Max Katz authored and GitHub committed 2026-07-27 21:43:49 -07:00
1 parent c13a021e43
commit dd5ea32488
25 files changed
+546 -434

No files matched your search

@@ -41,7 +41,7 @@ export function CommandPaletteResults(props: CommandPaletteResultsProps) {
<CommandList>
{props.groups.map((group) => (
<CommandGroup items={group.items} key={group.value}>
<CommandGroupLabel>{group.label}</CommandGroupLabel>
<CommandGroupLabel className="ps-[9px]">{group.label}</CommandGroupLabel>
<CommandCollection>
{(item) =>
item.disabled ? (
@@ -133,13 +133,13 @@ function CommandPaletteResultRow(props: {
)}
{props.item.titleTrailingContent}
{props.item.timestamp ? (
<span className="min-w-12 shrink-0 text-right text-[10px] tabular-nums text-muted-foreground/70">
<span className="min-w-12 shrink-0 text-right text-xs tabular-nums text-muted-foreground/70">
{props.item.timestamp}
</span>
) : null}
{shortcutLabel ? <CommandShortcut>{shortcutLabel}</CommandShortcut> : null}
{props.item.kind === "submenu" ? (
<ChevronRightIcon className="ml-auto size-4 shrink-0 text-muted-foreground/50" />
<ChevronRightIcon className="-me-0.5 ms-auto size-4 shrink-0 text-muted-foreground/70" />
) : null}
</CommandItem>
);
+7 -2
View File
@@ -4,6 +4,7 @@ import { FolderIcon } from "lucide-react";
import type { ComponentType } from "react";
import { useState } from "react";
import { useAssetUrl } from "../assets/assetUrls";
import { cn } from "~/lib/utils";
const loadedProjectFaviconSrcs = new Set<string>();
@@ -40,7 +41,7 @@ function ProjectFaviconFallback({
readonly className?: string | undefined;
readonly icon: ComponentType<{ className?: string }>;
}) {
return <Icon className={`size-3.5 shrink-0 text-muted-foreground/50 ${className ?? ""}`} />;
return <Icon className={cn("size-3.5 shrink-0 text-muted-foreground/50", className)} />;
}
function ProjectFaviconImage({
@@ -64,7 +65,11 @@ function ProjectFaviconImage({
<img
src={src}
alt=""
className={`size-3.5 shrink-0 rounded-sm object-contain ${status === "loaded" ? "" : "hidden"} ${className ?? ""}`}
className={cn(
"size-3.5 shrink-0 rounded-sm object-contain",
status !== "loaded" && "hidden",
className,
)}
onLoad={() => {
loadedProjectFaviconSrcs.add(src);
setStatus("loaded");
+29 -27
View File
@@ -2218,9 +2218,8 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
<div className="group/project-header relative">
<SidebarMenuButton
ref={isManualProjectSorting ? dragHandleProps?.setActivatorNodeRef : undefined}
size="sm"
className={`h-8 gap-2 rounded-md px-2 py-1.5 pr-8 text-left hover:bg-sidebar-row-hover group-hover/project-header:bg-sidebar-row-hover group-hover/project-header:text-sidebar-foreground max-sm:pr-14 ${
isManualProjectSorting ? "cursor-grab active:cursor-grabbing" : "cursor-pointer"
className={`pr-8 group-hover/project-header:bg-sidebar-row-hover group-hover/project-header:text-sidebar-foreground max-sm:pr-14 ${
isManualProjectSorting ? "cursor-grab active:cursor-grabbing" : ""
}`}
{...(isManualProjectSorting && dragHandleProps ? dragHandleProps.attributes : {})}
{...(isManualProjectSorting && dragHandleProps ? dragHandleProps.listeners : {})}
@@ -2822,30 +2821,33 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
);
return (
<SidebarContent className="gap-0">
<SidebarGroup className="px-2 pt-2 pb-1">
<SidebarMenu>
<SidebarMenuItem>
<CommandDialogTrigger
render={
<SidebarMenuButton
size="sm"
className="h-8 gap-2 rounded-md px-2 py-1.5 text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-0"
data-testid="command-palette-trigger"
/>
}
>
<SearchIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
<span className="flex-1 truncate text-left text-sm font-medium">Search</span>
{commandPaletteShortcutLabel ? (
<Kbd className="h-4 min-w-0 rounded-sm px-1.5 text-[10px]">
{commandPaletteShortcutLabel}
</Kbd>
) : null}
</CommandDialogTrigger>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
<SidebarContent
className="gap-0"
fixedHeader={
<SidebarGroup className="px-2 pt-2 pb-1">
<SidebarMenu>
<SidebarMenuItem>
<CommandDialogTrigger
render={
<SidebarMenuButton
className="focus-visible:ring-0"
data-testid="command-palette-trigger"
/>
}
>
<SearchIcon />
<span className="flex-1 truncate">Search</span>
{commandPaletteShortcutLabel ? (
<Kbd className="h-4 min-w-0 rounded-sm px-1.5 text-[10px]">
{commandPaletteShortcutLabel}
</Kbd>
) : null}
</CommandDialogTrigger>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
}
>
{showArm64IntelBuildWarning && arm64IntelBuildWarningDescription ? (
<SidebarGroup className="px-2 pt-2 pb-0">
<Alert variant="warning" className="rounded-2xl border-warning/40 bg-warning/8">
+237 -218
View File
@@ -242,38 +242,40 @@ function SidebarV2ThreadTooltip({
<TooltipPopup
side="right"
align="start"
sideOffset={8}
sideOffset={4}
variant="glass"
className="max-w-80 text-left whitespace-normal"
>
<div className="flex max-w-80 flex-col gap-2 p-2">
<div className="whitespace-nowrap text-sm font-medium text-foreground">{thread.title}</div>
<div className="grid gap-1.5 text-xs text-muted-foreground">
<div className="flex min-w-0 max-w-80 flex-col gap-2 px-0.5 py-1.5">
<div className="min-w-0 truncate text-xs leading-none font-medium text-foreground">
{thread.title}
</div>
<div className="grid gap-1.5 pl-0.5 text-xs text-muted-foreground">
{projectTitle ? (
<div className="flex min-w-0 items-center gap-2">
<ProjectFavicon
environmentId={thread.environmentId}
cwd={projectCwd ?? ""}
className="size-4 shrink-0 stroke-muted-foreground"
className="size-3 shrink-0 stroke-muted-foreground"
/>
<div className="min-w-0 wrap-break-word text-foreground/90">{projectTitle}</div>
<div className="min-w-0 truncate text-foreground/75">{projectTitle}</div>
</div>
) : null}
{environmentLabel ? (
<div className="flex min-w-0 items-center gap-2">
<ServerIcon className="size-4 shrink-0 stroke-muted-foreground" />
<div className="min-w-0 wrap-break-word text-foreground/90">{environmentLabel}</div>
<ServerIcon className="size-3 shrink-0 stroke-muted-foreground" />
<div className="min-w-0 truncate text-foreground/75">{environmentLabel}</div>
</div>
) : null}
{thread.branch ? (
<div className="flex min-w-0 items-center gap-2">
<GitBranchIcon className="size-4 shrink-0 stroke-muted-foreground" />
<div className="min-w-0 wrap-break-word text-foreground/90">{thread.branch}</div>
<GitBranchIcon className="size-3 shrink-0 stroke-muted-foreground" />
<div className="min-w-0 truncate text-foreground/75">{thread.branch}</div>
</div>
) : null}
{branchMismatch ? (
<div className="flex min-w-0 items-start gap-2 text-warning">
<CircleAlertIcon aria-hidden className="mt-0.5 size-4 shrink-0 stroke-current" />
<CircleAlertIcon aria-hidden className="mt-0.5 size-3 shrink-0 stroke-current" />
<div className="min-w-0 flex-1 wrap-break-word leading-5">
You're currently checked out on another branch.
</div>
@@ -284,15 +286,15 @@ function SidebarV2ThreadTooltip({
<ProviderInstanceIcon
driverKind={driverKind}
displayName={thread.session?.providerName ?? modelInstanceId}
iconClassName="size-4 shrink-0"
iconClassName="size-3 shrink-0 grayscale opacity-60"
/>
<div className="min-w-0 wrap-break-word text-foreground/90">{modelLabel}</div>
<div className="min-w-0 truncate text-foreground/75">{modelLabel}</div>
</div>
) : null}
{thread.session?.lastError ? (
<div className="flex min-w-0 items-center gap-2 text-red-600 dark:text-red-400">
<CircleAlertIcon className="size-4 shrink-0 stroke-current" />
<div className="min-w-0 wrap-break-word">{thread.session.lastError}</div>
<CircleAlertIcon className="size-3 shrink-0 stroke-current" />
<div className="min-w-0 truncate">Error occurred</div>
</div>
) : null}
</div>
@@ -815,9 +817,9 @@ const SidebarV2Row = memo(function SidebarV2Row(props: {
type="button"
aria-label="Un-settle thread"
onClick={handleUnsettleClick}
className="absolute inset-y-0 right-0 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-2 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/v2-row:opacity-100"
className="absolute inset-y-0 right-0 -mr-1 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/v2-row:opacity-100"
>
<Undo2Icon className="size-3" />
<Undo2Icon className="mb-px size-3.5" />
</button>
) : (
<button
@@ -917,7 +919,7 @@ const SidebarV2Row = memo(function SidebarV2Row(props: {
{props.settlementSupported || showSnoozeButton ? (
<span
className={cn(
"absolute inset-y-0 right-0 flex items-stretch gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/v2-row:opacity-100",
"absolute inset-y-0 right-0 flex items-stretch opacity-0 transition-opacity focus-within:opacity-100 group-hover/v2-row:opacity-100",
snoozeMenuOpen && "opacity-100",
)}
>
@@ -933,9 +935,9 @@ const SidebarV2Row = memo(function SidebarV2Row(props: {
type="button"
aria-label="Settle thread"
onClick={handleSettleClick}
className="inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-2 text-xs text-muted-foreground hover:text-foreground"
className="-mr-1 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-1.5 text-xs text-muted-foreground hover:text-foreground"
>
<CheckIcon className="size-3" />
<CheckIcon className="size-3.5" />
Settle
</button>
) : null}
@@ -2220,151 +2222,158 @@ export default function SidebarV2() {
return (
<>
<SidebarChromeHeader isElectron={isElectron} />
<SidebarContent className="gap-0">
<SidebarGroup className="px-2 pb-2 pt-3">
<div className="flex items-center gap-1">
<div className="min-w-0 flex-1">
<CommandDialogTrigger
render={
<SidebarMenuButton
size="sm"
type="button"
aria-label="Search threads and commands"
className="h-8 gap-2 rounded-md border-0 bg-transparent px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"
data-testid="command-palette-trigger"
/>
}
>
<SearchIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
<div className="flex-1 truncate text-left">Search</div>
{commandPaletteShortcutLabel ? (
<Kbd className="h-4 min-w-0 rounded-sm bg-sidebar-control-surface px-1.5 text-[10px] text-sidebar-muted-foreground ring-1 ring-sidebar-border">
{commandPaletteShortcutLabel}
</Kbd>
) : null}
</CommandDialogTrigger>
</div>
<div className="shrink-0">
<Tooltip>
<TooltipTrigger
<SidebarContent
className="gap-0"
fixedHeader={
<SidebarGroup className="gap-1 p-2">
<div className="flex items-center gap-1">
<div className="min-w-0 flex-1">
<CommandDialogTrigger
render={
<SidebarMenuButton
size="sm"
type="button"
className="relative size-8 justify-center rounded-md border-0 bg-transparent p-0 text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"
onClick={handleNewThreadClick}
disabled={projects.length === 0}
aria-label="New thread"
aria-label="Search threads and commands"
className="focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"
data-testid="command-palette-trigger"
/>
}
>
<SquarePenIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
<span
className="pointer-events-none absolute left-1/2 top-1/2 size-[max(100%,3rem)] -translate-1/2 pointer-fine:hidden"
aria-hidden="true"
/>
</TooltipTrigger>
<TooltipPopup side="right">
{newThreadShortcutLabel ? `New thread (${newThreadShortcutLabel})` : "New thread"}
</TooltipPopup>
</Tooltip>
</div>
</div>
</SidebarGroup>
{projectGroups.length > 0 ? (
<SidebarGroup className="px-2 pb-2 pt-0">
<div className="flex items-center gap-1">
<Menu open={projectScopeMenuOpen} onOpenChange={setProjectScopeMenuOpen}>
<MenuTrigger
aria-label="Filter threads by project"
className="flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2 text-left text-sm font-medium text-sidebar-muted-foreground outline-none hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"
>
{scopedProjectGroup ? (
<ProjectFavicon
environmentId={scopedProjectGroup.environmentId}
cwd={scopedProjectGroup.workspaceRoot}
className="size-4 shrink-0"
/>
) : (
<FolderIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
)}
<span className="min-w-0 flex-1 truncate">
{scopedProjectGroup?.displayName ?? "All projects"}
</span>
<ChevronDownIcon className="size-4 shrink-0 text-sidebar-muted-foreground/70" />
</MenuTrigger>
<MenuPopup align="start" className="w-(--anchor-width)">
<MenuRadioGroup
value={projectScopeKey ?? "all"}
onValueChange={(value) =>
setProjectScopeKey(value === "all" ? null : (value as string))
<SearchIcon />
<div className="flex-1 truncate text-left">Search</div>
{commandPaletteShortcutLabel ? (
<Kbd className="mr-px h-4 min-w-0 rounded-sm bg-sidebar-control-surface px-1.5 text-[10px] text-sidebar-muted-foreground ring-1 ring-sidebar-border">
{commandPaletteShortcutLabel}
</Kbd>
) : null}
</CommandDialogTrigger>
</div>
<div className="shrink-0">
<Tooltip>
<TooltipTrigger
render={
<SidebarMenuButton
size="icon"
type="button"
className="relative focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"
onClick={handleNewThreadClick}
disabled={projects.length === 0}
aria-label="New thread"
/>
}
>
<MenuRadioItem
value="all"
closeOnClick
className="h-8 min-h-8 px-1 py-0 text-sm font-medium [&>span:last-child]:flex [&>span:last-child]:min-w-0 [&>span:last-child]:items-center [&>span:last-child]:gap-2"
>
<FolderIcon className="size-4 shrink-0" />
<span className="min-w-0 truncate text-sm">All projects</span>
</MenuRadioItem>
{projectGroups.map((project) => {
const scopeKey = project.projectKey;
return (
<MenuRadioItem
key={scopeKey}
value={scopeKey}
closeOnClick
className="h-8 min-h-8 px-1 py-0 text-sm font-medium [&>span:last-child]:flex [&>span:last-child]:min-w-0 [&>span:last-child]:items-center [&>span:last-child]:gap-2"
>
<ProjectFavicon
environmentId={project.environmentId}
cwd={project.workspaceRoot}
className="size-4 shrink-0"
/>
<span className="min-w-0 truncate text-sm">{project.displayName}</span>
<button
type="button"
aria-label={`Project actions for ${project.displayName}`}
title={`Project actions for ${project.displayName}`}
className="ml-auto inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground/55 outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
onPointerDown={(event) => event.stopPropagation()}
onClick={(event) => {
void handleProjectActions(event, project);
}}
>
<EllipsisIcon className="size-3.5" />
</button>
</MenuRadioItem>
);
})}
</MenuRadioGroup>
</MenuPopup>
</Menu>
<Tooltip>
<TooltipTrigger
render={
<SidebarMenuButton
size="sm"
className="relative size-8 shrink-0 justify-center rounded-md bg-transparent p-0 text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"
onClick={openAddProjectCommandPalette}
type="button"
aria-label="New project"
<SquarePenIcon />
<span
className="pointer-events-none absolute left-1/2 top-1/2 size-[max(100%,3rem)] -translate-1/2 pointer-fine:hidden"
aria-hidden="true"
/>
}
>
<FolderPlusIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
<span
className="pointer-events-none absolute left-1/2 top-1/2 size-[max(100%,3rem)] -translate-1/2 pointer-fine:hidden"
aria-hidden="true"
/>
</TooltipTrigger>
<TooltipPopup side="right">New project</TooltipPopup>
</Tooltip>
</TooltipTrigger>
<TooltipPopup side="right">
{newThreadShortcutLabel
? `New thread (${newThreadShortcutLabel})`
: "New thread"}
</TooltipPopup>
</Tooltip>
</div>
</div>
{projectGroups.length > 0 ? (
<div className="flex items-center gap-1">
<Menu open={projectScopeMenuOpen} onOpenChange={setProjectScopeMenuOpen}>
<MenuTrigger
render={
<SidebarMenuButton
aria-label="Filter threads by project"
className="min-w-0 flex-1 focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"
/>
}
>
{scopedProjectGroup ? (
<ProjectFavicon
environmentId={scopedProjectGroup.environmentId}
cwd={scopedProjectGroup.workspaceRoot}
className="size-4 shrink-0"
/>
) : (
<FolderIcon className="size-4 shrink-0" />
)}
<span className="min-w-0 flex-1 truncate">
{scopedProjectGroup?.displayName ?? "All projects"}
</span>
<ChevronDownIcon className="-mr-px size-4 shrink-0" />
</MenuTrigger>
<MenuPopup align="start" className="w-(--anchor-width)">
<MenuRadioGroup
value={projectScopeKey ?? "all"}
onValueChange={(value) =>
setProjectScopeKey(value === "all" ? null : (value as string))
}
>
<MenuRadioItem
value="all"
closeOnClick
className="h-8 min-h-8 px-1 py-0 text-sm font-medium [&>span:last-child]:flex [&>span:last-child]:min-w-0 [&>span:last-child]:items-center [&>span:last-child]:gap-2"
>
<FolderIcon className="size-4 shrink-0" />
<span className="min-w-0 truncate text-sm">All projects</span>
</MenuRadioItem>
{projectGroups.map((project) => {
const scopeKey = project.projectKey;
return (
<MenuRadioItem
key={scopeKey}
value={scopeKey}
closeOnClick
className="h-8 min-h-8 px-1 py-0 text-sm font-medium [&>span:last-child]:flex [&>span:last-child]:min-w-0 [&>span:last-child]:items-center [&>span:last-child]:gap-2"
>
<ProjectFavicon
environmentId={project.environmentId}
cwd={project.workspaceRoot}
className="size-4 shrink-0"
/>
<span className="min-w-0 truncate text-sm">{project.displayName}</span>
<button
type="button"
aria-label={`Project actions for ${project.displayName}`}
title={`Project actions for ${project.displayName}`}
className="ml-auto inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground/55 outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
onPointerDown={(event) => event.stopPropagation()}
onClick={(event) => {
void handleProjectActions(event, project);
}}
>
<EllipsisIcon className="size-3.5" />
</button>
</MenuRadioItem>
);
})}
</MenuRadioGroup>
</MenuPopup>
</Menu>
<Tooltip>
<TooltipTrigger
render={
<SidebarMenuButton
size="icon"
className="relative shrink-0 focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"
onClick={openAddProjectCommandPalette}
type="button"
aria-label="New project"
/>
}
>
<FolderPlusIcon />
<span
className="pointer-events-none absolute left-1/2 top-1/2 size-[max(100%,3rem)] -translate-1/2 pointer-fine:hidden"
aria-hidden="true"
/>
</TooltipTrigger>
<TooltipPopup side="right">New project</TooltipPopup>
</Tooltip>
</div>
) : null}
</SidebarGroup>
) : null}
<SidebarGroup className="min-h-0 flex-1 overflow-y-auto px-2 py-1 [scrollbar-gutter:stable]">
}
>
<SidebarGroup className="px-2 pb-1 pt-0">
<TooltipProvider
key="sidebar-thread-tooltips-150"
delay={150}
@@ -2526,12 +2535,10 @@ export default function SidebarV2() {
<button
type="button"
onClick={showMoreSettled}
className="mt-1 flex h-[30px] w-full items-center justify-center gap-1.5 rounded-md border border-dashed border-border font-mono text-[11px] text-muted-foreground transition-colors hover:border-solid hover:border-input hover:bg-background/45 hover:text-foreground dark:border-white/15 dark:hover:border-white/30 dark:hover:bg-transparent"
className="flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-left text-sm text-sidebar-muted-foreground/55 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
>
<PlusIcon aria-hidden className="size-4 shrink-0" />
Show {Math.min(hiddenSettledCount, SETTLED_TAIL_PAGE_COUNT)} more
<span className="text-muted-foreground/50">
({hiddenSettledCount} settled hidden)
</span>
</button>
</li>
) : null}
@@ -2547,7 +2554,7 @@ export default function SidebarV2() {
onClick={openAddProjectCommandPalette}
className="inline-flex items-center gap-1.5 rounded-md border border-sidebar-border px-2.5 py-1 text-[11px] font-medium text-sidebar-muted-foreground transition-colors hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
>
<PlusIcon className="size-3" />
<PlusIcon className="-mx-0.5 size-3" />
Add project
</button>
</>
@@ -2567,48 +2574,52 @@ export default function SidebarV2() {
}}
>
<DialogPopup className="max-w-xl">
<DialogHeader className="gap-1.5">
<DialogHeader className="gap-3 pb-1!">
<DialogTitle className="text-balance">Project settings</DialogTitle>
<DialogDescription>
{projectActionsTarget && projectActionsTarget.memberProjects.length > 1
? `${projectActionsTarget.displayName} has an entry in each environment. Changes apply only to the entry you choose.`
: `Manage ${projectActionsTarget?.displayName ?? "this project"} in this environment.`}
<DialogDescription className="sr-only">
Manage project names, grouping rules, and environments.
</DialogDescription>
<div className="grid gap-1.5 text-base text-muted-foreground">
{projectActionsTarget?.memberProjects.map((member) => (
<div key={member.physicalProjectKey} className="flex min-w-0 items-center gap-3">
<span className="flex min-w-0 items-center gap-1">
<FolderIcon className="size-3.5 shrink-0 opacity-60" />
<span className="min-w-0 truncate font-mono">{member.workspaceRoot}</span>
<Button
size="icon-xs"
variant="ghost"
className="size-4 shrink-0 rounded-sm"
aria-label="Copy project path"
title="Copy project path"
onClick={() =>
copyProjectPath(member.workspaceRoot, { path: member.workspaceRoot })
}
>
<CopyIcon className="size-3.5" />
</Button>
</span>
<span className="flex min-w-0 shrink-0 items-center gap-1">
<ServerIcon className="size-3.5 shrink-0 opacity-60" />
<span className="min-w-0 truncate">
{member.environmentLabel ?? "Current environment"}
</span>
</span>
</div>
))}
</div>
</DialogHeader>
<DialogPanel className="p-0">
<div className="divide-y divide-border/60">
{projectActionsTarget?.memberProjects.map((member) => (
<section
key={member.physicalProjectKey}
className="flex min-w-0 flex-col gap-4 px-6 py-5 sm:gap-3 sm:py-4"
className="grid min-w-0 gap-5 px-6 pb-5 pt-2 sm:gap-4 sm:pb-4 sm:pt-2"
>
<div className="flex min-w-0 items-start gap-3">
<ProjectFavicon
environmentId={member.environmentId}
cwd={member.workspaceRoot}
className="size-5 shrink-0 sm:size-4"
/>
<div className="min-w-0 flex-1">
<div className="flex min-w-0 items-center gap-1.5 text-base text-muted-foreground sm:text-sm">
<ServerIcon className="size-4 shrink-0 stroke-muted-foreground" />
<p className="min-w-0 truncate">
{member.environmentLabel ?? "Current environment"}
</p>
</div>
<p
className="truncate font-mono text-base text-muted-foreground/72 sm:text-sm"
title={member.workspaceRoot}
>
{member.workspaceRoot}
</p>
</div>
</div>
<div className="grid gap-4 sm:grid-cols-2 sm:gap-3 sm:pl-7">
<div className="grid gap-4 sm:grid-cols-2 sm:gap-3">
<label className="grid min-w-0 gap-1.5">
<span className="font-medium text-foreground">Project name</span>
<Input
key={`${member.physicalProjectKey}:${member.title}`}
size="sm"
aria-label={`Project name in ${member.environmentLabel ?? "current environment"}`}
defaultValue={member.title}
onBlur={(event) => {
@@ -2639,8 +2650,7 @@ export default function SidebarV2() {
}}
>
<SelectTrigger
size="sm"
className="w-full"
className="w-full sm:min-h-7.5"
aria-label={`Grouping rule for ${member.environmentLabel ?? "current environment"}`}
>
<SelectValue>
@@ -2672,32 +2682,23 @@ export default function SidebarV2() {
</Select>
</label>
</div>
<div className="flex flex-wrap items-center gap-2 sm:pl-7">
<Button
size="sm"
variant="ghost"
onClick={() =>
copyProjectPath(member.workspaceRoot, { path: member.workspaceRoot })
}
>
<CopyIcon />
Copy path
</Button>
<Button
size="sm"
variant="ghost"
className="text-destructive-foreground hover:bg-destructive/8 hover:text-destructive-foreground sm:ml-auto"
onClick={() => {
const projectGroup = projectActionsTarget;
if (!projectGroup) return;
setProjectActionsTarget(null);
void handleRemoveProjectMembers(projectGroup, [member]);
}}
>
<Trash2Icon />
Remove
</Button>
</div>
{projectActionsTarget.memberProjects.length > 1 ? (
<div className="flex justify-end">
<Button
size="sm"
variant="ghost"
className="text-destructive-foreground hover:bg-destructive/8 hover:text-destructive-foreground"
onClick={() => {
const projectGroup = projectActionsTarget;
setProjectActionsTarget(null);
void handleRemoveProjectMembers(projectGroup, [member]);
}}
>
<Trash2Icon />
Remove project
</Button>
</div>
) : null}
</section>
))}
</div>
@@ -2727,8 +2728,26 @@ export default function SidebarV2() {
</div>
) : null}
</DialogPanel>
<DialogFooter variant="bare">
<Button onClick={() => setProjectActionsTarget(null)}>Done</Button>
<DialogFooter
variant="bare"
className={cn(
projectActionsTarget?.memberProjects.length === 1 && "sm:justify-between",
)}
>
{projectActionsTarget?.memberProjects.length === 1 ? (
<Button
variant="destructive-outline"
onClick={() => {
const projectGroup = projectActionsTarget;
setProjectActionsTarget(null);
void handleRemoveProjectMembers(projectGroup, projectGroup.memberProjects);
}}
>
<Trash2Icon />
Remove project
</Button>
) : null}
<Button onClick={() => setProjectActionsTarget(null)}>Close</Button>
</DialogFooter>
</DialogPopup>
</Dialog>
+12 -21
View File
@@ -95,6 +95,7 @@ import { ComposerPrimaryActions } from "./ComposerPrimaryActions";
import { ComposerPendingApprovalPanel } from "./ComposerPendingApprovalPanel";
import { ComposerPendingUserInputPanel } from "./ComposerPendingUserInputPanel";
import { ComposerPlanFollowUpBanner } from "./ComposerPlanFollowUpBanner";
import { ComposerControl, ComposerControlIcon, ComposerSelectControl } from "./ComposerControl";
import { resolveComposerMenuActiveItemId } from "./composerMenuHighlight";
import { searchSlashCommandItems } from "./composerSlashCommandSearch";
import {
@@ -167,7 +168,7 @@ function ComposerCommandMenuLayer(props: { anchor: HTMLElement | null; children:
);
}
import { Button } from "../ui/button";
import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
import { Select, SelectItem, SelectPopup, SelectValue } from "../ui/select";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
import { toastManager } from "../ui/toast";
import {
@@ -303,15 +304,13 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
<Tooltip>
<TooltipTrigger
render={
<Button
variant="ghost"
<ComposerControl
className={cn(
"shrink-0 whitespace-nowrap px-2 sm:px-3",
"shrink-0 whitespace-nowrap",
props.interactionMode === "plan"
? "bg-blue-500/10 text-blue-400 hover:bg-blue-500/15 hover:text-blue-300"
: "text-muted-foreground/70 hover:text-foreground/80",
)}
size="sm"
type="button"
onClick={props.onToggleInteractionMode}
aria-label={interactionModeTooltip}
@@ -319,9 +318,9 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
}
>
{props.interactionMode === "plan" ? (
<PencilRulerIcon className="text-current opacity-100" />
<ComposerControlIcon icon={PencilRulerIcon} className="text-current opacity-100" />
) : (
<BotIcon />
<ComposerControlIcon icon={BotIcon} opticalSize="large" />
)}
<span className="sr-only sm:not-sr-only">
{props.interactionMode === "plan" ? "Plan" : "Build"}
@@ -342,16 +341,9 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
onValueChange={(value) => props.onRuntimeModeChange(value!)}
>
<TooltipTrigger
render={
<SelectTrigger
variant="ghost"
size="sm"
className="font-medium"
aria-label="Runtime mode"
/>
}
render={<ComposerSelectControl className="font-medium" aria-label="Runtime mode" />}
>
<RuntimeModeIcon className="size-4" />
<ComposerControlIcon icon={RuntimeModeIcon} />
<SelectValue>{runtimeModeOption.label}</SelectValue>
</TooltipTrigger>
<SelectPopup alignItemWithTrigger={false}>
@@ -387,22 +379,21 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
<Tooltip>
<TooltipTrigger
render={
<Button
variant="ghost"
<ComposerControl
className={cn(
"shrink-0 whitespace-nowrap px-2 sm:px-3",
"shrink-0 whitespace-nowrap",
props.planSidebarOpen
? "bg-blue-500/10 text-blue-400 hover:bg-blue-500/15 hover:text-blue-300"
: "text-muted-foreground/70 hover:text-foreground/80",
)}
size="sm"
type="button"
onClick={props.onTogglePlanSidebar}
aria-label={planSidebarTooltip}
/>
}
>
<ListTodoIcon
<ComposerControlIcon
icon={ListTodoIcon}
className={props.planSidebarOpen ? "text-current opacity-100" : undefined}
/>
<span className="sr-only sm:not-sr-only">{props.planSidebarLabel}</span>
@@ -93,7 +93,7 @@ export function ComposerBannerStack({ className, items }: ComposerBannerStackPro
{showCollapsedStackCap ? (
<div
className={cn(
"pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-xl",
"pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-[22px]",
"border border-b-0 border-warning/24 bg-background/96 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",
"transition-opacity duration-150 ease-out",
"group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0",
@@ -174,7 +174,7 @@ function ComposerBannerStackAlert({
return (
<Alert
variant={item.variant}
className={cn("alert-glass", item.className)}
className={cn("alert-glass rounded-[22px]", item.className)}
data-variant={item.variant}
>
{item.icon}
@@ -139,7 +139,10 @@ export const ComposerCommandMenu = memo(function ComposerCommandMenu(props: {
);
}}
>
<div ref={listRef} className="dropdown-glass relative w-full overflow-hidden rounded-[20px]">
<div
ref={listRef}
className="dropdown-glass relative w-full overflow-hidden rounded-[20px] **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4"
>
{props.items.length > 0 ? (
<CommandList className="max-h-72">
{groups.map((group, groupIndex) => (
@@ -0,0 +1,71 @@
import type { ComponentProps } from "react";
import { ChevronDownIcon, type LucideIcon } from "lucide-react";
import { cn } from "~/lib/utils";
import { Button } from "../ui/button";
import { SelectTrigger } from "../ui/select";
const composerControlClassName =
"h-7 min-h-7 gap-1.5 px-2.5 text-muted-foreground/70 transition-none hover:text-foreground/80 [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5";
export function ComposerControl({
className,
size = "sm",
variant = "ghost",
...props
}: ComponentProps<typeof Button>) {
return (
<Button
className={cn(composerControlClassName, className)}
size={size}
variant={variant}
{...props}
/>
);
}
export function ComposerControlIcon({
icon: Icon,
className,
opticalSize = "default",
}: {
icon: LucideIcon;
className?: string | undefined;
opticalSize?: "default" | "large";
}) {
return (
<Icon
aria-hidden="true"
className={cn("shrink-0", opticalSize === "large" ? "size-4.5" : "size-4", className)}
data-composer-control-icon
/>
);
}
export function ComposerControlChevron() {
return (
<ChevronDownIcon
aria-hidden="true"
className="-mx-0.5 size-3.5 shrink-0 text-muted-foreground opacity-70"
data-composer-control-chevron
strokeWidth={2.25}
/>
);
}
export function ComposerSelectControl({
className,
size = "sm",
variant = "ghost",
...props
}: ComponentProps<typeof SelectTrigger>) {
return (
<SelectTrigger
className={cn(composerControlClassName, className)}
icon={<ComposerControlChevron />}
size={size}
variant={variant}
{...props}
/>
);
}
@@ -101,11 +101,11 @@ export function DraftHeroHeadline({
<Menu>
<MenuTrigger
aria-label={hasResolvedProject ? "Change project" : "Choose a project"}
className="pointer-events-auto inline cursor-pointer border-current border-b border-dotted text-foreground underline-offset-8 transition-opacity hover:opacity-75 focus-visible:rounded-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
className="pointer-events-auto inline cursor-pointer border-foreground/60 border-b border-dotted text-foreground transition-colors hover:border-foreground/80 focus-visible:rounded-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
>
{activeProjectDisplayName ?? "Choose a project"}
</MenuTrigger>
<MenuPopup align="center" className="max-h-80 w-64 overflow-y-auto">
<MenuPopup align="center" className="max-h-80 min-w-40! w-max max-w-64 overflow-y-auto">
<MenuRadioGroup
value={activeProjectKey}
onValueChange={(value) => {
@@ -138,7 +138,7 @@ export function DraftHeroHeadline({
<button
type="button"
onClick={openAddProject}
className="pointer-events-auto inline cursor-pointer border-current border-b border-dotted text-muted-foreground/60 underline-offset-8 transition-opacity hover:opacity-75 focus-visible:rounded-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
className="pointer-events-auto inline cursor-pointer border-muted-foreground/35 border-b border-dotted text-muted-foreground/60 transition-colors hover:border-muted-foreground/60 hover:text-muted-foreground/80 focus-visible:rounded-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
>
{activeProjectTitle ?? "Add a project"}
</button>
@@ -50,7 +50,7 @@ export const ModelListRow = memo(function ModelListRow(props: {
disabled={Boolean(props.disabledReason)}
contentClassName="flex w-full items-center gap-3"
className={cn(
"group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2.5 transition-[background-color,box-shadow,color]",
"group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-[background-color,box-shadow,color]",
"hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--foreground))]",
props.disabledReason &&
"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent",
@@ -43,6 +43,10 @@ type ModelPickerItem = {
const EMPTY_MODEL_JUMP_LABELS = new Map<string, string>();
function ModelListSeparator() {
return <div className="h-0.5" />;
}
// Split a `${instanceId}:${slug}` combobox key back into its pieces. Slugs
// can contain colons (e.g. some vendor model ids), so we only split on the
// first colon — anything after that is the slug.
@@ -521,7 +525,7 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
return (
<TooltipProvider delay={0}>
<div
className="dropdown-glass model-picker-surface relative flex h-screen max-h-96 w-screen max-w-100 flex-row overflow-hidden rounded-lg text-popover-foreground [clip-path:inset(0_round_var(--radius-lg))]"
className="dropdown-glass model-picker-surface relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden rounded-lg text-popover-foreground [clip-path:inset(0_round_var(--radius-lg))]"
data-model-picker-content="true"
>
{/* Sidebar */}
@@ -571,12 +575,12 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
<div
className={cn(
"flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",
showSidebar && "border-l",
showSidebar && "border-l border-border/70",
)}
>
{/* Search bar */}
<div className="px-4 pt-2.5">
<div className="-translate-y-px border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring">
<div className="px-2 pt-2">
<div className="border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring">
<ComboboxInput
ref={searchInputRef}
className="[&_input]:h-6.5 [&_input]:font-sans [&_input]:leading-6.5"
@@ -584,7 +588,7 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
placeholder="Search models..."
showTrigger={false}
startAddon={
<SearchIcon className="-translate-x-0.5 size-4 shrink-0 text-muted-foreground/55" />
<SearchIcon className="-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70" />
}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
@@ -618,8 +622,8 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
</div>
{/* Model list */}
<div className="relative min-h-0 flex-1 overflow-hidden">
<ComboboxListVirtualized className="model-picker-list size-full min-w-0 p-0">
<div className="relative min-h-0 flex-1 overflow-hidden pr-px">
<ComboboxListVirtualized className="size-full min-w-0 p-0 not-empty:p-0">
<LegendList<string>
ref={modelListRef}
data={filteredModelKeys}
@@ -656,12 +660,14 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
estimatedItemSize={60}
drawDistance={480}
recycleItems
contentContainerClassName="pl-2 pr-px"
ItemSeparatorComponent={ModelListSeparator}
onLayout={updateModelListScrollFades}
onScroll={updateModelListScrollFades}
className={cn(
"scrollbar-gutter-both h-full overflow-x-hidden overscroll-y-contain py-1.5 [--fade-size:1.5rem]",
showTopScrollFade && "mask-t-from-[calc(100%-var(--fade-size))]",
showBottomScrollFade && "mask-b-from-[calc(100%-var(--fade-size))]",
"model-picker-list h-full overflow-x-hidden overscroll-y-contain py-1.5 [--fade-size:1.5rem]",
showTopScrollFade && "model-picker-list-scroll-fade-top",
showBottomScrollFade && "model-picker-list-scroll-fade-bottom",
)}
/>
</ComboboxListVirtualized>
@@ -78,34 +78,20 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
if (!content) {
return;
}
const selectedButton = Array.from(
const selectedItem = Array.from(
content.querySelectorAll<HTMLElement>("[data-model-picker-provider]"),
).find((button) => button.dataset.modelPickerProvider === props.selectedInstanceId);
if (!selectedButton) {
).find((item) => item.dataset.modelPickerProvider === props.selectedInstanceId);
if (!selectedItem) {
setSelectedIndicatorTop(null);
return;
}
const contentRect = content.getBoundingClientRect();
const selectedButtonRect = selectedButton.getBoundingClientRect();
setSelectedIndicatorTop(
selectedButtonRect.top -
contentRect.top +
content.scrollTop +
selectedButtonRect.height / 2 -
10,
);
setSelectedIndicatorTop(selectedItem.offsetTop + selectedItem.offsetHeight / 2 - 10);
}, [props.instanceEntries, props.selectedInstanceId, showFavorites]);
return (
<div
className="w-12 shrink-0 overflow-hidden border-r bg-muted/30"
data-model-picker-sidebar="true"
>
<div className="w-11 shrink-0 overflow-hidden bg-muted/30" data-model-picker-sidebar="true">
<div className="h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
<div
ref={sidebarContentRef}
className="relative flex min-h-full flex-col gap-1 px-1 pb-1 pt-0.5"
>
<div ref={sidebarContentRef} className="relative flex min-h-full flex-col gap-1 p-1">
{selectedIndicatorTop !== null ? (
<div
data-model-picker-selected-indicator="true"
@@ -118,8 +104,8 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
) : null}
{/* Favorites section */}
{showFavorites ? (
<div className="mb-1 border-b pb-1">
<div className="relative w-full">
<>
<div className="relative w-full" data-model-picker-provider="favorites">
<Tooltip>
<TooltipTrigger
render={
@@ -129,7 +115,6 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
)}
onClick={() => handleSelect("favorites")}
type="button"
data-model-picker-provider="favorites"
aria-label="Favorites"
>
<StarIcon className="size-5 fill-current shrink-0" aria-hidden />
@@ -146,7 +131,8 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
</TooltipPopup>
</Tooltip>
</div>
</div>
<div className="border-b border-border/70" aria-hidden="true" />
</>
) : null}
{/* Instance buttons (one per configured instance — built-in + custom) */}
@@ -170,7 +156,6 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
const button = (
<button
data-model-picker-provider={entry.instanceId}
className={cn(
"relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--foreground))] focus-visible:outline-none",
isDisabled && "opacity-50 cursor-not-allowed hover:bg-transparent",
@@ -228,7 +213,11 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
);
return (
<div key={entry.instanceId} className="relative w-full">
<div
key={entry.instanceId}
className="relative w-full"
data-model-picker-provider={entry.instanceId}
>
<Tooltip>
<TooltipTrigger render={trigger} />
<TooltipPopup
@@ -5,8 +5,7 @@ import {
} from "@t3tools/contracts";
import { memo, useEffect, useMemo, useState } from "react";
import type { VariantProps } from "class-variance-authority";
import { ChevronDownIcon } from "lucide-react";
import { Button, buttonVariants } from "../ui/button";
import { buttonVariants } from "../ui/button";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
import { cn } from "~/lib/utils";
@@ -18,6 +17,7 @@ import {
getTriggerDisplayModelName,
} from "./providerIconUtils";
import type { ProviderInstanceEntry } from "../../providerInstances";
import { ComposerControl, ComposerControlChevron } from "./ComposerControl";
export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
/**
@@ -146,28 +146,27 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
>
<PopoverTrigger
render={
<Button
<ComposerControl
aria-label={props.triggerAriaLabel}
size="sm"
variant={props.triggerVariant ?? "ghost"}
data-chat-provider-model-picker="true"
className={cn(
"min-w-0 justify-between whitespace-nowrap px-2 text-muted-foreground/70 hover:text-foreground/80",
props.compact ? "max-w-42 shrink-0" : "max-w-48 shrink sm:max-w-56 sm:px-3",
"min-w-0 justify-between whitespace-nowrap",
props.compact ? "max-w-42 shrink-0" : "max-w-48 shrink sm:max-w-56",
props.triggerClassName,
)}
disabled={props.disabled}
/>
}
>
<span className="flex min-w-0 flex-1 items-center gap-2">
<span className="flex min-w-0 flex-1 items-center gap-1.5">
{activeEntry ? (
<ProviderInstanceIcon
driverKind={activeEntry.driverKind}
displayName={activeEntry.displayName}
accentColor={activeEntry.accentColor}
showBadge={showInstanceBadge}
className={showInstanceBadge ? "size-5" : "size-4"}
className="size-4"
iconClassName={cn("size-4", props.activeProviderIconClassName)}
indicatorBackground="var(--input)"
badgeClassName={cn(
@@ -184,7 +183,7 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
</Tooltip>
</span>
<span aria-hidden="true" className="flex items-center">
<ChevronDownIcon aria-hidden="true" className="!ms-0 !-me-1 size-3 shrink-0 opacity-60" />
<ComposerControlChevron />
</span>
</PopoverTrigger>
<PopoverPopup
@@ -16,8 +16,8 @@ import {
} from "@t3tools/shared/model";
import { memo, useCallback, useState } from "react";
import type { VariantProps } from "class-variance-authority";
import { ChevronDownIcon, ZapIcon } from "lucide-react";
import { Button, buttonVariants } from "../ui/button";
import { ZapIcon } from "lucide-react";
import { buttonVariants } from "../ui/button";
import {
Menu,
MenuGroup,
@@ -31,6 +31,7 @@ import { useComposerDraftStore, DraftId } from "../../composerDraftStore";
import { getProviderModelCapabilities } from "../../providerModels";
import { cn } from "~/lib/utils";
import { Badge } from "../ui/badge";
import { ComposerControl, ComposerControlChevron, ComposerControlIcon } from "./ComposerControl";
type ProviderOptions = ReadonlyArray<ProviderOptionSelection>;
@@ -463,7 +464,7 @@ export const TraitsPicker = memo(function TraitsPicker({
});
const fastModeIcon = showFastModeIcon ? (
<>
<ZapIcon aria-hidden="true" className="size-3 shrink-0 text-foreground/80 opacity-100" />
<ComposerControlIcon icon={ZapIcon} className="text-foreground/80 opacity-100" />
<span className="sr-only">Fast mode on</span>
</>
) : null;
@@ -479,13 +480,12 @@ export const TraitsPicker = memo(function TraitsPicker({
>
<MenuTrigger
render={
<Button
size="sm"
<ComposerControl
variant={triggerVariant ?? "ghost"}
className={cn(
isCodexStyle
? "min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap px-2 text-muted-foreground/70 hover:text-foreground/80 sm:max-w-48 sm:px-3 [&_svg]:mx-0"
: "shrink-0 whitespace-nowrap px-2 text-muted-foreground/70 hover:text-foreground/80 sm:px-3",
? "min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48"
: "shrink-0 whitespace-nowrap",
triggerClassName,
)}
/>
@@ -495,13 +495,13 @@ export const TraitsPicker = memo(function TraitsPicker({
<span className="flex min-w-0 w-full items-center gap-1.5 overflow-hidden">
{fastModeIcon}
<span className="min-w-0 truncate">{triggerLabel}</span>
<ChevronDownIcon aria-hidden="true" className="size-3 shrink-0 opacity-60" />
<ComposerControlChevron />
</span>
) : (
<>
{fastModeIcon}
<span>{triggerLabel}</span>
<ChevronDownIcon aria-hidden="true" className="size-3 opacity-60" />
<ComposerControlChevron />
</>
)}
</MenuTrigger>
@@ -53,12 +53,8 @@ function ConfiguredT3ConnectSidebarSignIn() {
<>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton
size="sm"
className="h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
onClick={openAuthPrompt}
>
<LogInIcon className="size-4 shrink-0" />
<SidebarMenuButton onClick={openAuthPrompt}>
<LogInIcon />
<span>Sign in to T3 Connect</span>
</SidebarMenuButton>
</SidebarMenuItem>
@@ -72,7 +72,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
return (
<>
<SidebarContent className="overflow-x-hidden">
<SidebarGroup className="px-2 py-3">
<SidebarGroup className="p-2">
<SidebarMenu>
{SETTINGS_NAV_ITEMS.map((item) => {
const Icon = item.icon;
@@ -80,22 +80,10 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
return (
<SidebarMenuItem key={item.to}>
<SidebarMenuButton
size="sm"
isActive={isActive}
className={
isActive
? "h-8 items-center gap-2 rounded-md bg-sidebar-row-active px-2 py-1.5 text-left text-sm font-medium text-sidebar-foreground"
: "h-8 items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm font-medium text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
}
onClick={() => handleSectionClick(item.to)}
>
<Icon
className={
isActive
? "size-4 shrink-0 text-sidebar-foreground"
: "size-4 shrink-0 text-sidebar-muted-foreground/60"
}
/>
<Icon />
<span className="truncate">{item.label}</span>
</SidebarMenuButton>
</SidebarMenuItem>
@@ -106,15 +94,11 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
</SidebarContent>
<SidebarFooter className="p-2">
<T3ConnectSidebarSignIn />
<div className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-1">
<SidebarMenu className="min-w-0">
<div className="flex items-center gap-1">
<SidebarMenu className="min-w-0 flex-1">
<SidebarMenuItem>
<SidebarMenuButton
size="sm"
className="h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
onClick={handleBackClick}
>
<ArrowLeftIcon className="size-4" />
<SidebarMenuButton onClick={handleBackClick}>
<ArrowLeftIcon />
<span>Back</span>
</SidebarMenuButton>
</SidebarMenuItem>
@@ -113,12 +113,8 @@ export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
<SidebarUpdatePill />
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton
size="sm"
className="h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
onClick={handleSettingsClick}
>
<SettingsIcon className="size-4.5 shrink-0" />
<SidebarMenuButton onClick={handleSettingsClick}>
<SettingsIcon />
<span>Settings</span>
</SidebarMenuButton>
</SidebarMenuItem>
+6 -6
View File
@@ -65,7 +65,7 @@ function CommandDialogPopup({
<CommandDialogPrimitive.Popup
className={cn(
DIALOG_POPUP_CLASS,
"pointer-events-auto max-h-105 max-w-xl text-foreground **:data-[slot=scroll-area-viewport]:data-has-overflow-y:pe-1",
"pointer-events-auto max-h-105 max-w-xl text-foreground",
className,
)}
data-slot="command-dialog-popup"
@@ -103,16 +103,16 @@ function CommandInput({
wrapperClassName?: string | undefined;
}) {
return (
<div className={cn("px-2.5 py-1.5", wrapperClassName)}>
<div className={cn("px-1.25 py-1.5", wrapperClassName)}>
<AutocompleteInput
autoFocus
className={cn(
"border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0 placeholder:text-muted-foreground/80",
"border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0 placeholder:text-muted-foreground/80 *:data-[slot=autocomplete-input]:ps-9! sm:*:data-[slot=autocomplete-input]:ps-8.5!",
className,
)}
placeholder={placeholder}
size="lg"
startAddon={<SearchIcon />}
startAddon={<SearchIcon className="translate-x-0.5 text-muted-foreground" />}
{...props}
/>
</div>
@@ -198,7 +198,7 @@ function CommandShortcut({ className, ...props }: React.ComponentProps<"kbd">) {
return (
<kbd
className={cn(
"ms-auto font-medium font-sans text-muted-foreground text-xs tracking-widest",
"ms-auto font-medium font-sans text-muted-foreground/70 text-xs tracking-widest",
className,
)}
data-slot="command-shortcut"
@@ -211,7 +211,7 @@ function CommandFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
className={cn(
"relative flex items-center justify-between gap-2 rounded-b-[calc(var(--radius-2xl)-1px)] bg-foreground/[0.025] px-5 py-3 font-medium text-sm text-muted-foreground [&_[data-slot=kbd-group]]:font-sans [&_[data-slot=kbd]]:bg-foreground/[0.08] [&_[data-slot=kbd]]:text-foreground [&_[data-slot=kbd]]:ring-0",
"relative flex items-center justify-between gap-2 rounded-b-[calc(var(--radius-2xl)-1px)] bg-foreground/[0.025] px-4 py-2.5 font-medium text-sm text-muted-foreground [&_[data-slot=kbd-group]]:font-sans [&_[data-slot=kbd]]:bg-foreground/[0.08] [&_[data-slot=kbd]]:text-foreground [&_[data-slot=kbd]]:ring-0",
className,
)}
data-slot="command-footer"
+2 -2
View File
@@ -56,7 +56,7 @@ function ScrollBar({
return (
<ScrollAreaPrimitive.Scrollbar
className={cn(
"m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
"flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:mx-1 data-[orientation=horizontal]:mb-px data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:my-1 data-[orientation=vertical]:mr-px data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
className,
)}
data-slot="scroll-area-scrollbar"
@@ -64,7 +64,7 @@ function ScrollBar({
{...props}
>
<ScrollAreaPrimitive.Thumb
className="relative flex-1 rounded-full bg-foreground/20"
className="relative flex-1 rounded-full bg-[var(--app-scrollbar-thumb)] transition-colors hover:bg-[var(--app-scrollbar-thumb-hover)]"
data-slot="scroll-area-thumb"
/>
</ScrollAreaPrimitive.Scrollbar>
+4 -2
View File
@@ -77,8 +77,10 @@ function SelectTrigger({
size = "default",
variant = "default",
children,
icon,
...props
}: SelectPrimitive.Trigger.Props & VariantProps<typeof selectTriggerVariants>) {
}: SelectPrimitive.Trigger.Props &
VariantProps<typeof selectTriggerVariants> & { icon?: React.ReactNode }) {
return (
<SelectPrimitive.Trigger
className={cn(selectTriggerVariants({ size, variant }), className)}
@@ -87,7 +89,7 @@ function SelectTrigger({
>
{children}
<SelectPrimitive.Icon data-slot="select-icon">
<ChevronDownIcon className="-me-1 size-3 opacity-50" />
{icon ?? <ChevronDownIcon className="-me-1 size-3 opacity-50" />}
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
);
+23 -1
View File
@@ -50,13 +50,35 @@ describe("sidebar interactive cursors", () => {
expect(html).toContain("size-[var(--workspace-titlebar-control-size)]!");
});
it("uses a pointer cursor for menu buttons by default", () => {
it("uses shared geometry and icon constraints for menu buttons by default", () => {
const html = renderSidebarButton();
expect(html).toContain('data-slot="sidebar-menu-button"');
expect(html).toContain("h-8");
expect(html).toContain("rounded-md");
expect(html).toContain("px-2");
expect(html).toContain("py-1.5");
expect(html).toContain("]:size-4");
expect(html).toContain("]:shrink-0");
expect(html).toContain("cursor-pointer");
});
it("applies the shared default treatment to icon-only menu buttons", () => {
const html = renderToStaticMarkup(
<SidebarProvider>
<SidebarMenuButton size="icon">
<span>+</span>
</SidebarMenuButton>
</SidebarProvider>,
);
expect(html).toContain("size-8");
expect(html).toContain("justify-center");
expect(html).toContain("p-0");
expect(html).toContain("font-medium");
expect(html).toContain("text-sidebar-muted-foreground/80");
});
it("lets project drag handles override the default pointer cursor", () => {
const html = renderSidebarButton("cursor-grab");
+28 -19
View File
@@ -684,19 +684,28 @@ function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof S
);
}
function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
function SidebarContent({
className,
fixedHeader,
...props
}: React.ComponentProps<"div"> & {
fixedHeader?: React.ReactNode;
}) {
return (
<ScrollArea hideScrollbars scrollFade className="h-auto min-h-0 flex-1">
<div
className={cn(
"flex w-full min-w-0 flex-col gap-2 group-data-[collapsible=icon]:overflow-hidden",
className,
)}
data-sidebar="content"
data-slot="sidebar-content"
{...props}
/>
</ScrollArea>
<>
{fixedHeader ? <div className="w-full shrink-0">{fixedHeader}</div> : null}
<ScrollArea hideScrollbars scrollFade className="h-auto min-h-0 flex-1">
<div
className={cn(
"flex w-full min-w-0 flex-col gap-2 group-data-[collapsible=icon]:overflow-hidden",
className,
)}
data-sidebar="content"
data-slot="sidebar-content"
{...props}
/>
</ScrollArea>
</>
);
}
@@ -783,7 +792,7 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
}
const sidebarMenuButtonVariants = cva(
"peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-ring transition-[width,height,padding] hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-row-active active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-row-selected data-[active=true]:font-medium data-[active=true]:text-sidebar-foreground data-[state=open]:hover:bg-sidebar-row-hover data-[state=open]:hover:text-sidebar-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
"peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden text-left outline-hidden ring-ring transition-[width,height,padding] hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-row-active active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-row-selected data-[active=true]:font-medium data-[active=true]:text-sidebar-foreground data-[state=open]:hover:bg-sidebar-row-hover data-[state=open]:hover:text-sidebar-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-muted-foreground [&>svg]:opacity-60 hover:[&>svg]:text-sidebar-foreground hover:[&>svg]:opacity-100 active:[&>svg]:text-sidebar-foreground active:[&>svg]:opacity-100 data-[active=true]:[&>svg]:text-sidebar-foreground data-[active=true]:[&>svg]:opacity-100",
{
defaultVariants: {
size: "default",
@@ -791,14 +800,14 @@ const sidebarMenuButtonVariants = cva(
},
variants: {
size: {
default: "h-8 text-sm",
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
sm: "h-7 text-xs",
default: "h-8 rounded-md px-2.5 py-1.5 text-sm",
icon: "size-8 justify-center rounded-md p-0",
lg: "h-12 rounded-lg p-2 text-sm group-data-[collapsible=icon]:p-0!",
sm: "h-7 rounded-lg p-2 text-xs",
},
variant: {
default: "hover:bg-sidebar-row-hover hover:text-sidebar-foreground",
outline:
"bg-sidebar-control-surface ring-1 ring-sidebar-border hover:bg-sidebar-row-hover hover:text-sidebar-foreground",
default: "font-medium text-sidebar-muted-foreground/80",
outline: "bg-sidebar-control-surface ring-1 ring-sidebar-border",
},
},
},
+2 -2
View File
@@ -166,9 +166,9 @@ export function showContextMenuFallback<T extends string>(
const menu = document.createElement("div");
menu.className =
"fixed z-[10000] min-w-32 max-w-sm overflow-hidden rounded-lg border border-border bg-popover bg-clip-padding text-popover-foreground shadow-lg/5 outline-none";
"dropdown-glass fixed z-[10000] min-w-32 max-w-sm overflow-hidden rounded-lg bg-clip-padding text-popover-foreground outline-none";
menu.style.cssText =
"position:fixed;z-index:10000;min-width:8rem;max-width:24rem;overflow:hidden;border-radius:var(--radius-lg);border:1px solid var(--border);background:var(--popover);background-clip:padding-box;color:var(--popover-foreground);box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.05),0 4px 6px -4px rgb(0 0 0 / 0.05);outline:none;pointer-events:auto;";
"position:fixed;z-index:10000;min-width:8rem;max-width:24rem;overflow:hidden;border-radius:var(--radius-lg);background-clip:padding-box;color:var(--popover-foreground);outline:none;pointer-events:auto;";
menu.style.left = `${preferredLeft}px`;
menu.style.top = `${preferredTop}px`;
menu.dataset.level = String(level);
+52 -34
View File
@@ -77,6 +77,8 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
:root {
--app-scrollbar-width: 6px;
--app-scrollbar-thumb: rgb(217 217 217);
--app-scrollbar-thumb-hover: rgb(191 191 191);
--glass-blur: 12px;
--glass-opacity: 80%;
--glass-saturation: 1.14;
@@ -91,6 +93,8 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
}
.dark {
--app-scrollbar-thumb: rgb(255 255 255 / 8%);
--app-scrollbar-thumb-hover: rgb(255 255 255 / 12%);
--glass-blur: 16px;
--glass-saturation: 1.08;
}
@@ -327,12 +331,13 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
rgb(0 0 0 / 96%) 82%,
black 100%
),
linear-gradient(black, black);
-webkit-mask-position: top, bottom;
linear-gradient(black, black), linear-gradient(black, black);
-webkit-mask-position: top, bottom, right;
-webkit-mask-repeat: no-repeat;
-webkit-mask-size:
100% var(--topbar-scroll-fade-height),
100% calc(100% - var(--topbar-scroll-fade-height));
100% calc(100% - var(--topbar-scroll-fade-height)),
var(--app-scrollbar-width) 100%;
mask-image:
linear-gradient(
to bottom,
@@ -344,12 +349,13 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
rgb(0 0 0 / 96%) 82%,
black 100%
),
linear-gradient(black, black);
mask-position: top, bottom;
linear-gradient(black, black), linear-gradient(black, black);
mask-position: top, bottom, right;
mask-repeat: no-repeat;
mask-size:
100% var(--topbar-scroll-fade-height),
100% calc(100% - var(--topbar-scroll-fade-height));
100% calc(100% - var(--topbar-scroll-fade-height)),
var(--app-scrollbar-width) 100%;
}
.workspace-titlebar-controls {
@@ -1035,20 +1041,54 @@ code {
}
::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.15);
background: var(--app-scrollbar-thumb);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.25);
background: var(--app-scrollbar-thumb-hover);
}
.dark ::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
.model-picker-list::-webkit-scrollbar-track {
margin-block: 0.5rem;
}
.dark ::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.18);
.model-picker-list-scroll-fade-top,
.model-picker-list-scroll-fade-bottom {
-webkit-mask-image: var(--model-picker-list-scroll-mask), linear-gradient(black, black);
-webkit-mask-position: left, right;
-webkit-mask-repeat: no-repeat;
-webkit-mask-size:
calc(100% - var(--app-scrollbar-width)) 100%,
var(--app-scrollbar-width) 100%;
mask-image: var(--model-picker-list-scroll-mask), linear-gradient(black, black);
mask-position: left, right;
mask-repeat: no-repeat;
mask-size:
calc(100% - var(--app-scrollbar-width)) 100%,
var(--app-scrollbar-width) 100%;
}
.model-picker-list-scroll-fade-top {
--model-picker-list-scroll-mask: linear-gradient(to bottom, transparent, black var(--fade-size));
}
.model-picker-list-scroll-fade-bottom {
--model-picker-list-scroll-mask: linear-gradient(
to bottom,
black calc(100% - var(--fade-size)),
transparent
);
}
.model-picker-list-scroll-fade-top.model-picker-list-scroll-fade-bottom {
--model-picker-list-scroll-mask: linear-gradient(
to bottom,
transparent,
black var(--fade-size),
black calc(100% - var(--fade-size)),
transparent
);
}
.turn-chip-strip {
@@ -1569,28 +1609,6 @@ label:has(> select#reasoning-effort) select {
animation: ultrathink-rainbow 10s linear infinite;
}
/* Thin scrollbar for model picker */
.model-picker-list::-webkit-scrollbar {
width: 4px;
}
.model-picker-list::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.1);
border-radius: 2px;
}
.model-picker-list::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.2);
}
.dark .model-picker-list::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.08);
}
.dark .model-picker-list::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.15);
}
/* Composer chips are non-editable decorators, so the browser skips them when
painting text selection; this overlay stands in for the native highlight. */
.composer-inline-chip[data-composer-chip-selected]::after {
+2 -2
View File
@@ -74,11 +74,11 @@ function SettingsContentLayout() {
{!isElectron && (
<header
className={cn(
"px-3 py-2 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none sm:px-5",
"workspace-topbar px-3 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none sm:px-5",
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
)}
>
<div className="flex min-h-7 items-center gap-2 sm:min-h-6">
<div className="flex w-full items-center gap-2">
<span className="text-sm font-medium text-foreground">Settings</span>
{showRestoreDefaults ? (
<div className="ms-auto flex items-center gap-2">