Skip to content

Commit 075b4f5

Browse files
shivamhwpclaude
andcommitted
fix(web): drop the hover ring; Shift-click stays the way to pick several projects
The project icon is main's again: a check on selected projects and nothing on hover. Shift-click and Shift+Enter toggle a project. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a714362 commit 075b4f5

2 files changed

Lines changed: 29 additions & 70 deletions

File tree

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

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,5 @@
1-
import { CheckIcon } from "lucide-react";
21
import type { ReactNode } from "react";
32

4-
import { cn } from "~/lib/utils";
5-
6-
/**
7-
* A project row's icon slot. A checked row's icon wears a small check. With `onToggle`, the icon
8-
* toggles the row, and an unchecked one shows an empty ring there on the highlighted row (always on
9-
* touch).
10-
*/
11-
export function ProjectRowLeading(props: {
12-
readonly icon: ReactNode;
13-
readonly checked: boolean;
14-
readonly onToggle?: (() => void) | undefined;
15-
}) {
16-
const { checked, onToggle } = props;
17-
const mark = (
18-
<span className="relative flex">
19-
{props.icon}
20-
{checked || onToggle ? (
21-
<span
22-
className={cn(
23-
"pointer-events-none absolute -right-1 -bottom-1 grid size-3 place-items-center rounded-full",
24-
checked
25-
? "bg-primary group-hover/toggle:brightness-125"
26-
: "invisible border border-foreground/50 bg-popover group-hover/toggle:border-primary group-hover/toggle:bg-primary/40 pointer-coarse:visible pointer-fine:in-data-highlighted:visible",
27-
)}
28-
>
29-
{checked ? (
30-
<CheckIcon className="size-2 text-primary-foreground" strokeWidth={4} aria-hidden />
31-
) : null}
32-
</span>
33-
) : null}
34-
</span>
35-
);
36-
if (!onToggle) return <span className="flex shrink-0 pointer-coarse:mr-2">{mark}</span>;
37-
return (
38-
<button
39-
type="button"
40-
tabIndex={-1}
41-
aria-hidden="true"
42-
className="group/toggle -m-1 flex shrink-0 cursor-pointer p-1 pointer-coarse:-my-2 pointer-coarse:mr-0 pointer-coarse:-ml-3 pointer-coarse:py-2 pointer-coarse:pr-2 pointer-coarse:pl-3"
43-
onPointerDown={(event) => event.stopPropagation()}
44-
onMouseDown={(event) => event.preventDefault()}
45-
onClick={(event) => {
46-
event.preventDefault();
47-
event.stopPropagation();
48-
onToggle();
49-
}}
50-
>
51-
{mark}
52-
</button>
53-
);
54-
}
55-
563
/** Settings shows only on the highlighted row; the pin keeps the far-right column. */
574
export function ProjectRowActions(props: {
585
readonly settings?: ReactNode;

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

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ import {
6060
} from "@t3tools/contracts";
6161
import type { OlderSettledScope } from "@t3tools/client-runtime/state/threads";
6262

63-
import { ChevronDownIcon, FolderIcon, ListFilterIcon, PlusIcon, SettingsIcon } from "lucide-react";
63+
import {
64+
CheckIcon,
65+
ChevronDownIcon,
66+
FolderIcon,
67+
ListFilterIcon,
68+
PlusIcon,
69+
SettingsIcon,
70+
} from "lucide-react";
6471
import {
6572
useEffect,
6673
useLayoutEffect,
@@ -163,7 +170,7 @@ import type { SidebarThreadSummary } from "../types";
163170
import { isScratchProject } from "@t3tools/client-runtime/state/projects";
164171
import { cn } from "~/lib/utils";
165172
import { ProjectEnvironmentBadge } from "./ProjectEnvironmentBadge";
166-
import { ProjectRowActions, ProjectRowLeading } from "./ProjectComboboxRow";
173+
import { ProjectRowActions } from "./ProjectComboboxRow";
167174
import {
168175
buildDraftActionMenuItems,
169176
buildThreadActionMenuItems,
@@ -834,6 +841,19 @@ function useSidebarLookups() {
834841
};
835842
}
836843

844+
function ProjectScopeRowIcon(props: { isSelected: boolean; children: ReactNode }) {
845+
return (
846+
<span className="relative flex shrink-0">
847+
{props.children}
848+
{props.isSelected ? (
849+
<span className="pointer-events-none absolute -right-1 -bottom-1 grid size-3 place-items-center rounded-full bg-primary ring-2 ring-popover">
850+
<CheckIcon className="size-2 text-primary-foreground" strokeWidth={4} aria-hidden />
851+
</span>
852+
) : null}
853+
</span>
854+
);
855+
}
856+
837857
function canOperateThreads(
838858
threads: ReadonlyArray<Pick<SidebarThreadSummary, "environmentId">>,
839859
): boolean {
@@ -3096,21 +3116,13 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
30963116
if (project) handleProjectSettings(event, project);
30973117
}}
30983118
>
3099-
<ProjectRowLeading
3100-
icon={
3101-
project ? (
3102-
<ProjectFavicon project={project} className="size-4 shrink-0" />
3103-
) : (
3104-
<FolderIcon className="size-4 shrink-0" />
3105-
)
3106-
}
3107-
checked={isSelected}
3108-
onToggle={
3109-
project
3110-
? () => toggleProjectScopeKey(project.projectKey)
3111-
: undefined
3112-
}
3113-
/>
3119+
<ProjectScopeRowIcon isSelected={isSelected}>
3120+
{project ? (
3121+
<ProjectFavicon project={project} className="size-4 shrink-0" />
3122+
) : (
3123+
<FolderIcon className="size-4 shrink-0" />
3124+
)}
3125+
</ProjectScopeRowIcon>
31143126
<span className="min-w-0 truncate text-sm">{item.label}</span>
31153127
{project && showProjectEnvironments ? (
31163128
<ProjectEnvironmentBadge

0 commit comments

Comments
 (0)