Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions apps/web/src/components/ProjectComboboxRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { ReactNode } from "react";

/** Settings shows only on the highlighted row; the pin keeps the far-right column. */
export function ProjectRowActions(props: {
readonly settings?: ReactNode;
readonly pin?: ReactNode;
}) {
return (
<span className="ml-auto flex shrink-0 items-center pointer-coarse:gap-1">
{props.settings ? (
<span className="flex pointer-fine:invisible pointer-fine:in-data-highlighted:visible">
{props.settings}
</span>
) : null}
{props.pin ?? <span className="size-7 sm:size-6" />}
</span>
);
}
2 changes: 1 addition & 1 deletion apps/web/src/components/ProjectEnvironmentBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function ProjectEnvironmentBadge(props: {
<span
role="img"
aria-label={description}
className="ml-auto inline-flex shrink-0 items-center text-muted-foreground"
className="inline-flex shrink-0 items-center text-muted-foreground"
/>
}
>
Expand Down
77 changes: 47 additions & 30 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ import type { SidebarThreadSummary } from "../types";
import { isScratchProject } from "@t3tools/client-runtime/state/projects";
import { cn } from "~/lib/utils";
import { ProjectEnvironmentBadge } from "./ProjectEnvironmentBadge";
import { ProjectRowActions } from "./ProjectComboboxRow";
import {
buildDraftActionMenuItems,
buildThreadActionMenuItems,
Expand Down Expand Up @@ -3020,13 +3021,18 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
}
>
{scopedProjectGroups.length > 1 ? (
<span className="flex shrink-0 -space-x-1.5">
{scopedProjectGroups.slice(0, 2).map((project) => (
<ProjectFavicon
<span className="flex shrink-0">
{scopedProjectGroups.slice(0, 2).map((project, index) => (
<span
key={project.projectKey}
project={project}
className="size-3.5"
/>
className={
index === 0
? "flex"
: "-ml-1 flex rounded-[25%] bg-sidebar ring-2 ring-sidebar"
}
>
<ProjectFavicon project={project} className="size-3.5" />
</span>
))}
</span>
) : scopedProjectGroups[0] ? (
Expand Down Expand Up @@ -3117,15 +3123,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
<FolderIcon className="size-4 shrink-0" />
)}
</ProjectScopeRowIcon>
<span className="min-w-0 flex-1 truncate text-sm">{item.label}</span>
{project && canPinProject(project) ? (
<ProjectPinButton
name={project.displayName}
pinned={project.pinned}
shortcutLabel={shortcutLabelForCommand(keybindings, "thread.pin")}
onToggle={() => toggleProjectGroupPin(project)}
/>
) : null}
<span className="min-w-0 truncate text-sm">{item.label}</span>
{project && showProjectEnvironments ? (
<ProjectEnvironmentBadge
group={project}
Expand All @@ -3134,21 +3132,40 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
/>
) : null}
{project ? (
<Button
size="icon-xs"
variant="ghost-muted"
tabIndex={-1}
aria-hidden="true"
title={`Project settings for ${project.displayName}`}
className={canPinProject(project) ? undefined : "ml-auto"}
onPointerDown={(event) => event.stopPropagation()}
onClick={(event) => {
void handleProjectSettings(event, project);
}}
>
<SettingsIcon className="size-3.5" />
</Button>
) : null}
<ProjectRowActions
pin={
canPinProject(project) ? (
<ProjectPinButton
name={project.displayName}
pinned={project.pinned}
shortcutLabel={shortcutLabelForCommand(
keybindings,
"thread.pin",
)}
onToggle={() => toggleProjectGroupPin(project)}
/>
) : null
}
settings={
<Button
size="icon-xs"
variant="ghost-muted"
tabIndex={-1}
aria-hidden="true"
title={`Project settings for ${project.displayName}`}
onPointerDown={(event) => event.stopPropagation()}
onClick={(event) => {
void handleProjectSettings(event, project);
}}
>
<SettingsIcon className="size-3.5" />
</Button>
}
/>
) : (
// Keeps "All projects" as tall as the project rows.
<span className="ml-auto size-7 shrink-0 sm:size-6" />
)}
</ComboboxItem>
);
}}
Expand Down
Loading