| ... | ... | @@ -169,6 +169,7 @@ import { |
| 169 | 169 | } from "../threadRoutes"; |
| 170 | 170 | import { formatRelativeTimeLabel, parseTimestampDate } from "../timestampFormat"; |
| 171 | 171 | import type { SidebarThreadSummary } from "../types"; |
| 172 | import { isScratchProject } from "@t3tools/client-runtime/state/projects"; |
| 172 | 173 | import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell"; |
| 173 | 174 | import { cn } from "~/lib/utils"; |
| 174 | 175 | import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon"; |
| ... | ... | @@ -1141,6 +1142,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { |
| 1141 | 1142 | currentEnvironmentId: string | null; |
| 1142 | 1143 | environmentLabel: string | null; |
| 1143 | 1144 | environmentMachine: EnvironmentMachineKind; |
| 1145 | scratchMachineLabel: string | null; |
| 1144 | 1146 | project: EnvironmentProject | null; |
| 1145 | 1147 | projectDisplayName: string | null; |
| 1146 | 1148 | providerEntryByInstanceId: ReadonlyMap<string, ProviderInstanceEntry>; |
| ... | ... | @@ -1370,6 +1372,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { |
| 1370 | 1372 | // that is every thread, which is the point: the glyph is what tells rows on |
| 1371 | 1373 | // different machines apart. |
| 1372 | 1374 | const isRemote = thread.environmentId !== props.currentEnvironmentId; |
| 1375 | const showsScratchMachine = !thread.branch && props.scratchMachineLabel !== null; |
| 1373 | 1376 | |
| 1374 | 1377 | const detailsTooltip = ( |
| 1375 | 1378 | <SidebarThreadTooltip |
| ... | ... | @@ -2164,6 +2167,17 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { |
| 2164 | 2167 | <MiddleTruncate value={thread.branch} showTitle={false} /> |
| 2165 | 2168 | </span> |
| 2166 | 2169 | </> |
| 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 | </> |
| 2167 | 2181 | ) : ( |
| 2168 | 2182 | <span className="flex-1" /> |
| 2169 | 2183 | )} |
| ... | ... | @@ -2179,7 +2193,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { |
| 2179 | 2193 | aria-hidden |
| 2180 | 2194 | className="pointer-events-none ml-auto inline-flex shrink-0 items-center gap-1" |
| 2181 | 2195 | > |
| 2182 | | {isRemote ? ( |
| 2196 | {isRemote && !showsScratchMachine ? ( |
| 2183 | 2197 | <span className="inline-flex shrink-0 items-center text-sidebar-muted-foreground/70"> |
| 2184 | 2198 | <EnvironmentMachineIcon |
| 2185 | 2199 | aria-hidden |
| ... | ... | @@ -2595,6 +2609,20 @@ export default function Sidebar() { |
| 2595 | 2609 | () => projectGroupsSpanEnvironments(projectGroups), |
| 2596 | 2610 | [projectGroups], |
| 2597 | 2611 | ); |
| 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 | ); |
| 2598 | 2626 | const projectGroupByScopeKey = useMemo( |
| 2599 | 2627 | () => new Map(projectGroups.map((project) => [project.projectKey, project] as const)), |
| 2600 | 2628 | [projectGroups], |
| ... | ... | @@ -5299,6 +5327,7 @@ export default function Sidebar() { |
| 5299 | 5327 | environmentMachine={ |
| 5300 | 5328 | environmentMachineById.get(thread.environmentId) ?? "server" |
| 5301 | 5329 | } |
| 5330 | scratchMachineLabel={scratchMachineLabelFor(thread)} |
| 5302 | 5331 | project={ |
| 5303 | 5332 | projectByKey.get(`${thread.environmentId}:${thread.projectId}`) ?? |
| 5304 | 5333 | null |