|
3 | 3 | ArchiveIcon, |
4 | 4 | ArrowUpDownIcon, |
5 | 5 | ChevronRightIcon, |
6 | | - CloudIcon, |
7 | | - ContainerIcon, |
8 | 6 | FolderPlusIcon, |
9 | 7 | Globe2Icon, |
10 | 8 | SearchIcon, |
@@ -72,7 +70,7 @@ import { |
72 | 70 | type SidebarThreadPreviewCount, |
73 | 71 | type SidebarThreadSortOrder, |
74 | 72 | } from "@t3tools/contracts/settings"; |
75 | | -import { isDesktopLocalConnectionTarget } from "../connection/desktopLocal"; |
| 73 | +import { isDesktopLocalConnectionTarget, isWslConnectionTarget } from "../connection/desktopLocal"; |
76 | 74 | import { useDesktopLocalBootstraps } from "../connection/useDesktopLocalBootstraps"; |
77 | 75 | import { isElectron } from "../env"; |
78 | 76 | import { useTerminalFocus } from "../hooks/useTerminalFocus"; |
@@ -402,9 +400,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
402 | 400 | const remoteMachine = resolveEnvironmentMachineKind(environment?.serverConfig ?? null); |
403 | 401 | // A desktop-local secondary backend (e.g. the WSL backend) shows up as a |
404 | 402 | // bearer environment whose connection id is prefixed "local:". It runs on the |
405 | | - // user's own machine, so the cloud icon is misleading — label it "Local" and |
406 | | - // suppress the cloud icon (the project header already shows a container icon |
407 | | - // for desktop-local projects, see sidebarProjectGrouping). |
| 403 | + // user's own machine, so the cloud icon is misleading, label it "Local" and |
| 404 | + // suppress the cloud icon (the project header already shows a |
| 405 | + // local-environment icon for desktop-local projects, see sidebarProjectGrouping). |
408 | 406 | const isDesktopLocalThread = |
409 | 407 | environment !== null && isDesktopLocalConnectionTarget(environment.entry.target); |
410 | 408 | const threadEnvironmentLabel = isRemoteThread |
@@ -1109,6 +1107,11 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
1109 | 1107 | isManualProjectSorting, |
1110 | 1108 | dragHandleProps, |
1111 | 1109 | } = props; |
| 1110 | + const environmentMachine = project.allRemoteMembersAreWsl |
| 1111 | + ? "linux" |
| 1112 | + : project.allRemoteMembersAreDesktopLocal |
| 1113 | + ? "laptop" |
| 1114 | + : "cloud"; |
1112 | 1115 | const threadSortOrder = useClientSettings<SidebarThreadSortOrder>( |
1113 | 1116 | (settings) => settings.sidebarThreadSortOrder, |
1114 | 1117 | ); |
@@ -2351,15 +2354,11 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
2351 | 2354 | ? "Local sandbox project" |
2352 | 2355 | : "Remote project" |
2353 | 2356 | } |
2354 | | - className="pointer-events-none absolute top-1 right-1.5 inline-flex size-5 items-center justify-center rounded-md text-icon-muted 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" |
| 2357 | + className="pointer-events-none absolute top-1/2 right-1.5 inline-flex size-5 -translate-y-1/2 items-center justify-center rounded-md text-icon-muted 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" |
2355 | 2358 | /> |
2356 | 2359 | } |
2357 | 2360 | > |
2358 | | - {project.allRemoteMembersAreDesktopLocal ? ( |
2359 | | - <ContainerIcon className="size-3" /> |
2360 | | - ) : ( |
2361 | | - <CloudIcon className="size-3" /> |
2362 | | - )} |
| 2361 | + <EnvironmentMachineIcon kind={environmentMachine} className="size-3" /> |
2363 | 2362 | </TooltipTrigger> |
2364 | 2363 | <TooltipPopup side="top"> |
2365 | 2364 | {project.allRemoteMembersAreDesktopLocal |
@@ -3132,6 +3131,15 @@ export default function LegacySidebar() { |
3132 | 3131 | ), |
3133 | 3132 | [environments], |
3134 | 3133 | ); |
| 3134 | + const wslEnvironmentIds = useMemo( |
| 3135 | + () => |
| 3136 | + new Set( |
| 3137 | + environments |
| 3138 | + .filter((environment) => isWslConnectionTarget(environment.entry.target)) |
| 3139 | + .map((environment) => environment.environmentId), |
| 3140 | + ), |
| 3141 | + [environments], |
| 3142 | + ); |
3135 | 3143 | const orderedProjects = useMemo(() => { |
3136 | 3144 | return orderItemsByPreferredIds({ |
3137 | 3145 | items: projects, |
@@ -3172,10 +3180,12 @@ export default function LegacySidebar() { |
3172 | 3180 | primaryEnvironmentId, |
3173 | 3181 | resolveEnvironmentLabel: (environmentId) => environmentLabelById.get(environmentId) ?? null, |
3174 | 3182 | isDesktopLocalEnvironment: (environmentId) => desktopLocalEnvironmentIds.has(environmentId), |
| 3183 | + isWslEnvironment: (environmentId) => wslEnvironmentIds.has(environmentId), |
3175 | 3184 | }); |
3176 | 3185 | }, [ |
3177 | 3186 | environmentLabelById, |
3178 | 3187 | desktopLocalEnvironmentIds, |
| 3188 | + wslEnvironmentIds, |
3179 | 3189 | orderedProjects, |
3180 | 3190 | projectGroupingSettings, |
3181 | 3191 | primaryEnvironmentId, |
|
0 commit comments