authorgravatar for 97427849+flamboh@users.noreply.github.comoliver <97427849+flamboh@users.noreply.github.com> 2026-10-07 23:04:09-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-08 03:04:09-03:00
logff9eb8bd0c8e71f98969a58d5789889e07b57c8b
treedfb5d97fc05eb3f405ece7c3c9a6497ea424231a
parent12865b4a73c23bb402717d5f592dcd954ed196e5
signature Signed by PGP key B5690EEEBB952194

feat(web): projectless threads show their machine in the sidebar (#17022)


1 files changed, 30 insertions(+), 1 deletions(-)

apps/web/src/components/Sidebar.tsx+30-1
......@@ -169,6 +169,7 @@ import {
169169} from "../threadRoutes";
170170import { formatRelativeTimeLabel, parseTimestampDate } from "../timestampFormat";
171171import type { SidebarThreadSummary } from "../types";
172import { isScratchProject } from "@t3tools/client-runtime/state/projects";
172173import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
173174import { cn } from "~/lib/utils";
174175import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
......@@ -1141,6 +1142,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
11411142 currentEnvironmentId: string | null;
11421143 environmentLabel: string | null;
11431144 environmentMachine: EnvironmentMachineKind;
1145 scratchMachineLabel: string | null;
11441146 project: EnvironmentProject | null;
11451147 projectDisplayName: string | null;
11461148 providerEntryByInstanceId: ReadonlyMap<string, ProviderInstanceEntry>;
......@@ -1370,6 +1372,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
13701372 // that is every thread, which is the point: the glyph is what tells rows on
13711373 // different machines apart.
13721374 const isRemote = thread.environmentId !== props.currentEnvironmentId;
1375 const showsScratchMachine = !thread.branch && props.scratchMachineLabel !== null;
13731376
13741377 const detailsTooltip = (
13751378 <SidebarThreadTooltip
......@@ -2164,6 +2167,17 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
21642167 <MiddleTruncate value={thread.branch} showTitle={false} />
21652168 </span>
21662169 </>
2170 ) : showsScratchMachine ? (
2171 <>
2172 <EnvironmentMachineIcon
2173 aria-hidden
2174 kind={props.environmentMachine}
2175 className="size-3 shrink-0 text-muted-foreground/40"
2176 />
2177 <span className="min-w-0 flex-1 truncate text-muted-foreground/40">
2178 {props.scratchMachineLabel}
2179 </span>
2180 </>
21672181 ) : (
21682182 <span className="flex-1" />
21692183 )}
......@@ -2179,7 +2193,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
21792193 aria-hidden
21802194 className="pointer-events-none ml-auto inline-flex shrink-0 items-center gap-1"
21812195 >
2182 {isRemote ? (
2196 {isRemote && !showsScratchMachine ? (
21832197 <span className="inline-flex shrink-0 items-center text-sidebar-muted-foreground/70">
21842198 <EnvironmentMachineIcon
21852199 aria-hidden
......@@ -2595,6 +2609,20 @@ export default function Sidebar() {
25952609 () => projectGroupsSpanEnvironments(projectGroups),
25962610 [projectGroups],
25972611 );
2612 const scratchMachineLabelFor = useCallback(
2613 (thread: Pick<SidebarThreadSummary, "environmentId" | "projectId">) => {
2614 if (!showProjectEnvironments) return null;
2615 const project = projectByKey.get(`${thread.environmentId}:${thread.projectId}`);
2616 if (
2617 !project ||
2618 !isScratchProject(project, serverConfigs.get(thread.environmentId)?.scratchWorkspaceRoot)
2619 ) {
2620 return null;
2621 }
2622 return environmentLabelById.get(thread.environmentId) ?? null;
2623 },
2624 [environmentLabelById, projectByKey, serverConfigs, showProjectEnvironments],
2625 );
25982626 const projectGroupByScopeKey = useMemo(
25992627 () => new Map(projectGroups.map((project) => [project.projectKey, project] as const)),
26002628 [projectGroups],
......@@ -5299,6 +5327,7 @@ export default function Sidebar() {
52995327 environmentMachine={
53005328 environmentMachineById.get(thread.environmentId) ?? "server"
53015329 }
5330 scratchMachineLabel={scratchMachineLabelFor(thread)}
53025331 project={
53035332 projectByKey.get(`${thread.environmentId}:${thread.projectId}`) ??
53045333 null