Skip to content

Commit 95349cd

Browse files
shivamhwpclaude
andcommitted
fix(web): show the machine icon after the project name
The corner badge covered part of the checkbox and was too small to tell machines apart, so the filter shows the machine icon right after the name again, hidden on checked rows. The new-thread picker goes back to main's layout, since it no longer needs the shared corner badge. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 333a240 commit 95349cd

4 files changed

Lines changed: 45 additions & 77 deletions

File tree

‎apps/web/src/components/ProjectComboboxRow.tsx‎

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
import type { MouseEvent, PointerEvent, ReactNode } from "react";
1+
import type { ReactNode } from "react";
22

33
import { cn } from "~/lib/utils";
44
import { CheckboxMark } from "./ui/checkbox";
55

66
/**
7-
* A project row's icon slot in a combobox, with the machine badge on its corner. With `selection`,
8-
* a checkbox takes the icon's place on the highlighted row and stays while the row is checked.
9-
* Touch has no hover, so it always shows the checkbox. Render it after the name: it moves itself
10-
* first, so the option reads "name, On machine".
7+
* A project row's icon slot. With `selection`, a checkbox takes the icon's place on the highlighted
8+
* row and stays while the row is checked. Touch has no hover, so it always shows the checkbox.
119
*/
1210
export function ProjectRowLeading(props: {
1311
readonly icon: ReactNode;
14-
readonly machine?: ReactNode;
1512
readonly selection?:
1613
| {
1714
readonly checked: boolean;
@@ -20,20 +17,8 @@ export function ProjectRowLeading(props: {
2017
| undefined;
2118
}) {
2219
const { selection } = props;
23-
// The badge covers part of the checkbox, so it toggles too instead of picking the row.
24-
const toggleHandlers = selection
25-
? {
26-
onPointerDown: (event: PointerEvent) => event.stopPropagation(),
27-
onMouseDown: (event: MouseEvent) => event.preventDefault(),
28-
onClick: (event: MouseEvent) => {
29-
event.preventDefault();
30-
event.stopPropagation();
31-
selection.onToggle();
32-
},
33-
}
34-
: {};
3520
return (
36-
<span className="relative order-first mr-1 grid shrink-0">
21+
<span className="grid shrink-0">
3722
<span
3823
className={cn(
3924
"col-start-1 row-start-1 flex",
@@ -55,24 +40,17 @@ export function ProjectRowLeading(props: {
5540
!selection.checked &&
5641
"invisible pointer-coarse:visible pointer-fine:in-data-highlighted:visible",
5742
)}
58-
{...toggleHandlers}
43+
onPointerDown={(event) => event.stopPropagation()}
44+
onMouseDown={(event) => event.preventDefault()}
45+
onClick={(event) => {
46+
event.preventDefault();
47+
event.stopPropagation();
48+
selection.onToggle();
49+
}}
5950
>
6051
<CheckboxMark checked={selection.checked} />
6152
</button>
6253
) : null}
63-
{props.machine ? (
64-
<span
65-
className={cn(
66-
"absolute -right-1.5 -bottom-1 z-10 flex",
67-
selection && "cursor-pointer",
68-
// Checked rows drop the badge visually but keep its label for screen readers.
69-
selection?.checked && "pointer-events-none opacity-0",
70-
)}
71-
{...toggleHandlers}
72-
>
73-
{props.machine}
74-
</span>
75-
) : null}
7654
</span>
7755
);
7856
}

‎apps/web/src/components/ProjectEnvironmentBadge.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ export function ProjectEnvironmentBadge(props: {
2828
<span
2929
role="img"
3030
aria-label={description}
31-
className="grid size-3.5 place-items-center rounded-sm bg-popover text-muted-foreground ring-1 ring-popover"
31+
className="inline-flex shrink-0 items-center text-muted-foreground"
3232
/>
3333
}
3434
>
3535
<EnvironmentMachineIcon
3636
aria-hidden
3737
kind={props.machineByEnvironmentId.get(first.environmentId) ?? "server"}
38-
className="size-3"
38+
className="size-3.5"
3939
/>
4040
</TooltipTrigger>
4141
<TooltipPopup side="top">{description}</TooltipPopup>

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,7 +3116,6 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
31163116
if (project) handleProjectSettings(event, project);
31173117
}}
31183118
>
3119-
<span className="min-w-0 flex-1 truncate text-sm">{item.label}</span>
31203119
<ProjectRowLeading
31213120
icon={
31223121
project ? (
@@ -3125,15 +3124,6 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
31253124
<FolderIcon className="size-4 shrink-0" />
31263125
)
31273126
}
3128-
machine={
3129-
project && showProjectEnvironments ? (
3130-
<ProjectEnvironmentBadge
3131-
group={project}
3132-
primaryEnvironmentId={primaryEnvironmentId}
3133-
machineByEnvironmentId={environmentMachineById}
3134-
/>
3135-
) : null
3136-
}
31373127
selection={
31383128
project
31393129
? {
@@ -3143,6 +3133,17 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
31433133
: undefined
31443134
}
31453135
/>
3136+
<span className="min-w-0 truncate text-sm">{item.label}</span>
3137+
{project && showProjectEnvironments ? (
3138+
// A checked row drops the badge visually but keeps its label for screen readers.
3139+
<span className={cn("flex", isSelected && "opacity-0")}>
3140+
<ProjectEnvironmentBadge
3141+
group={project}
3142+
primaryEnvironmentId={primaryEnvironmentId}
3143+
machineByEnvironmentId={environmentMachineById}
3144+
/>
3145+
</span>
3146+
) : null}
31463147
{project ? (
31473148
<ProjectRowActions
31483149
pin={
@@ -3176,7 +3177,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
31763177
/>
31773178
) : (
31783179
// Keeps "All projects" as tall as the project rows.
3179-
<span className="size-7 shrink-0 sm:size-6" />
3180+
<span className="ml-auto size-7 shrink-0 sm:size-6" />
31803181
)}
31813182
</ComboboxItem>
31823183
);

‎apps/web/src/components/chat/DraftHeroHeadline.tsx‎

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
useEnvironmentProviders,
3535
} from "~/state/environments";
3636
import { ProjectEnvironmentBadge } from "../ProjectEnvironmentBadge";
37-
import { ProjectRowActions, ProjectRowLeading } from "../ProjectComboboxRow";
3837
import { ProjectFavicon } from "../ProjectFavicon";
3938
import { isProjectPinShortcut, ProjectPinButton } from "../ProjectPinButton";
4039
import { sortLogicalProjectsForSidebar } from "../Sidebar.logic";
@@ -333,42 +332,32 @@ export function DraftHeroHeadline({
333332
const entry = projectEntryByKey.get(item.value);
334333
return (
335334
<ComboboxItem key={item.value} hideIndicator value={item}>
335+
{item.value === ADD_PROJECT_VALUE ? (
336+
<FolderPlusIcon className="size-4 shrink-0" />
337+
) : entry ? (
338+
<ProjectFavicon project={entry.group} className="size-4 shrink-0" />
339+
) : null}
336340
<Tooltip>
337341
<TooltipTrigger render={<span className="min-w-0 flex-1 text-sm" />}>
338342
<DraftProjectName value={item.label} />
339343
</TooltipTrigger>
340344
<TooltipPopup side="top">{item.label}</TooltipPopup>
341345
</Tooltip>
342-
<ProjectRowLeading
343-
icon={
344-
item.value === ADD_PROJECT_VALUE ? (
345-
<FolderPlusIcon className="size-4 shrink-0" />
346-
) : entry ? (
347-
<ProjectFavicon project={entry.group} className="size-4 shrink-0" />
348-
) : null
349-
}
350-
machine={
351-
entry && showProjectEnvironments ? (
352-
<ProjectEnvironmentBadge
353-
group={entry.group}
354-
primaryEnvironmentId={primaryEnvironmentId}
355-
machineByEnvironmentId={environmentMachineById}
356-
/>
357-
) : null
358-
}
359-
/>
360-
<ProjectRowActions
361-
pin={
362-
entry && canPinProjectGroup(entry.group) ? (
363-
<ProjectPinButton
364-
name={entry.group.displayName}
365-
pinned={entry.group.pinned}
366-
shortcutLabel={shortcutLabelForCommand(keybindings, "thread.pin")}
367-
onToggle={() => toggleProjectGroupPin(entry.group)}
368-
/>
369-
) : null
370-
}
371-
/>
346+
{entry && canPinProjectGroup(entry.group) ? (
347+
<ProjectPinButton
348+
name={entry.group.displayName}
349+
pinned={entry.group.pinned}
350+
shortcutLabel={shortcutLabelForCommand(keybindings, "thread.pin")}
351+
onToggle={() => toggleProjectGroupPin(entry.group)}
352+
/>
353+
) : null}
354+
{entry && showProjectEnvironments ? (
355+
<ProjectEnvironmentBadge
356+
group={entry.group}
357+
primaryEnvironmentId={primaryEnvironmentId}
358+
machineByEnvironmentId={environmentMachineById}
359+
/>
360+
) : null}
372361
</ComboboxItem>
373362
);
374363
}}

0 commit comments

Comments
 (0)