fix(web): use container icon on desktopLocal-only project headers

The thread-row icon was fixed in ad7e3d77, but the project-header
indicator still rendered a cloud for any group whose members were
all non-primary. That was visually wrong for WSL backends: the
project lives on the user's machine, just in a sandbox.

Pull the desktopLocal marker through into the sidebar's grouping
output as allRemoteMembersAreDesktopLocal, and let the project
header render ContainerIcon (plus a "Local sandbox" tooltip) when
every non-primary member is desktopLocal. Mixed groups and true
remote-only groups still get the cloud icon.

buildSidebarProjectSnapshots gains an optional
isDesktopLocalEnvironment resolver so callers without saved-env
context still get the legacy behavior.
This commit is contained in:
Josh Gratton committed 2026-05-18 09:40:40 -04:00
1 parent 0dbdd9f47f
commit 943e1ed993
2 files changed
+34 -11

No files matched your search

+13 -5
View File
@@ -2049,18 +2049,24 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
render={
<span
aria-label={
project.environmentPresence === "remote-only"
? "Remote project"
: "Available in multiple environments"
project.allRemoteMembersAreDesktopLocal
? "Local sandbox project"
: "Remote project"
}
className="pointer-events-none absolute top-1 right-1.5 inline-flex size-5 items-center justify-center rounded-md text-muted-foreground/60 transition-opacity duration-150 max-sm:right-7 group-hover/project-header:opacity-0 group-focus-within/project-header:opacity-0 max-sm:group-hover/project-header:opacity-100 max-sm:group-focus-within/project-header:opacity-100"
/>
}
>
<CloudIcon className="size-3" />
{project.allRemoteMembersAreDesktopLocal ? (
<ContainerIcon className="size-3" />
) : (
<CloudIcon className="size-3" />
)}
</TooltipTrigger>
<TooltipPopup side="top">
Remote environment: {project.remoteEnvironmentLabels.join(", ")}
{project.allRemoteMembersAreDesktopLocal
? `Local sandbox: ${project.remoteEnvironmentLabels.join(", ")}`
: `Remote environment: ${project.remoteEnvironmentLabels.join(", ")}`}
</TooltipPopup>
</Tooltip>
)}
@@ -2879,6 +2885,8 @@ export default function Sidebar() {
const saved = savedEnvironmentRegistry[environmentId];
return rt?.descriptor?.label ?? saved?.label ?? null;
},
isDesktopLocalEnvironment: (environmentId) =>
Boolean(savedEnvironmentRegistry[environmentId]?.desktopLocal),
});
}, [
orderedProjects,
+21 -6
View File
@@ -20,6 +20,12 @@ export interface SidebarProjectSnapshot extends Project {
displayName: string;
groupedProjectCount: number;
environmentPresence: EnvironmentPresence;
// True iff every non-primary member of this group lives in a
// desktopLocal env (today: the WSL backend). The sidebar uses this
// to differentiate "lives on this machine but in a sandbox" from
// "lives on a real remote" so the project header can pick a
// container icon instead of the generic cloud icon.
allRemoteMembersAreDesktopLocal: boolean;
memberProjects: readonly SidebarProjectGroupMember[];
memberProjectRefs: readonly ScopedProjectRef[];
remoteEnvironmentLabels: readonly string[];
@@ -44,6 +50,11 @@ export function buildSidebarProjectSnapshots(input: {
settings: ProjectGroupingSettings;
primaryEnvironmentId: EnvironmentId | null;
resolveEnvironmentLabel: (environmentId: EnvironmentId) => string | null;
// Returns true when an env id maps to a desktopLocal saved-env
// record (today: the WSL backend). Defaults to "false for every
// env" so callers that don't care about the distinction get the
// legacy behavior.
isDesktopLocalEnvironment?: (environmentId: EnvironmentId) => boolean;
}): SidebarProjectSnapshot[] {
const groupedMembers = new Map<string, SidebarProjectGroupMember[]>();
for (const project of input.projects) {
@@ -86,14 +97,17 @@ export function buildSidebarProjectSnapshots(input: {
input.primaryEnvironmentId !== null
? members.some((member) => member.environmentId !== input.primaryEnvironmentId)
: false;
const remoteEnvironmentLabels = members
.filter(
(member) =>
input.primaryEnvironmentId !== null &&
member.environmentId !== input.primaryEnvironmentId,
)
const remoteMembers = members.filter(
(member) =>
input.primaryEnvironmentId !== null && member.environmentId !== input.primaryEnvironmentId,
);
const remoteEnvironmentLabels = remoteMembers
.flatMap((member) => (member.environmentLabel ? [member.environmentLabel] : []))
.filter((label, index, labels) => labels.indexOf(label) === index);
const isDesktopLocal = input.isDesktopLocalEnvironment ?? (() => false);
const allRemoteMembersAreDesktopLocal =
remoteMembers.length > 0 &&
remoteMembers.every((member) => isDesktopLocal(member.environmentId));
result.push({
...representative,
@@ -108,6 +122,7 @@ export function buildSidebarProjectSnapshots(input: {
groupedProjectCount: members.length,
environmentPresence:
hasLocal && hasRemote ? "mixed" : hasRemote ? "remote-only" : "local-only",
allRemoteMembersAreDesktopLocal,
memberProjects: members,
memberProjectRefs: members.map((member) => scopeProjectRef(member.environmentId, member.id)),
remoteEnvironmentLabels,