Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ThreadStatusIndicators.tsx

730 lines22.5 KB

1import {
2 scopeProjectRef,
3 scopedThreadKey,
4 scopeThreadRef,
5} from "@t3tools/client-runtime/environment";
6import { pullRequestDetailToVcsStatus } from "@t3tools/client-runtime/state/pull-requests";
7import {
8 type EnvironmentId,
9 resolveEnvironmentMachineKind,
10 type ThreadLinkedPullRequest,
11 type VcsStatusResult,
12} from "@t3tools/contracts";
13import { Atom } from "effect/unstable/reactivity";
14import { FolderGit2Icon, TerminalIcon } from "lucide-react";
15import { useCallback, useMemo } from "react";
16import { appAtomRegistry } from "../rpc/atomRegistry";
17import { useEnvironment, usePrimaryEnvironmentId } from "../state/environments";
18import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
19import { useProject } from "../state/entities";
20import { useEnvironmentQuery } from "../state/query";
21import { linkedPullRequestDetailAtom, useSharedPullRequestSummary } from "../state/pullRequests";
22import { useThreadRunningTerminalIds } from "../state/terminalSessions";
23import { vcsEnvironment } from "../state/vcs";
24import { useUiStateStore } from "../uiStateStore";
25import { resolveChangeRequestPresentation } from "../sourceControlPresentation";
26import {
27 resolveThreadLastVisitedAt,
28 resolveThreadStatusPill,
29 type ThreadStatusPill,
30 useRetainedValue,
31 useSidebarRowSubscriptionLease,
32} from "./Sidebar.logic";
33import { resolvePullRequestState } from "./pullRequest/pullRequestPresentation";
34import type { SidebarThreadSummary } from "../types";
35import { formatWorktreePathForDisplay } from "../worktreeCleanup";
36import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
37​
38export interface PrStatusIndicator {
39 label: string;
40 colorClass: string;
41 tooltip: string;
42 tooltipLead: string;
43 tooltipTitle: string;
44 url: string;
46​
47export interface TerminalStatusIndicator {
48 label: "Terminal process running";
49 colorClass: string;
50 pulse: boolean;
52​
53export type ThreadPr = VcsStatusResult["pr"];
54​
55export interface LinkedThreadPullRequestStatus {
56 readonly pr: NonNullable<ThreadPr>;
57 readonly sourceControlProvider: NonNullable<VcsStatusResult["sourceControlProvider"]>;
59​
60export function useLinkedThreadPullRequest(
61 environmentId: EnvironmentId | null,
62 linkedPullRequest: ThreadLinkedPullRequest | null | undefined,
63 enabled = true,
64): LinkedThreadPullRequestStatus | null {
65 const queried = useEnvironmentQuery(
66 !enabled || environmentId === null || linkedPullRequest == null
67 ? null
68 : linkedPullRequestDetailAtom({
69 environmentId,
70 input: {
71 projectId: linkedPullRequest.projectId,
72 repository: linkedPullRequest.repository,
73 number: linkedPullRequest.number,
74 },
75 }),
76 ).data;
77 const detail = useSharedPullRequestSummary(environmentId, linkedPullRequest ?? null, queried);
78​
79 return useMemo(
80 () =>
81 detail === null
82 ? null
83 : {
84 pr: pullRequestDetailToVcsStatus(detail),
85 sourceControlProvider: {
86 kind: detail.provider,
87 name: detail.provider,
88 baseUrl: "",
89 },
90 },
91 [detail],
92 );
94​
95export function settledPrHoverColorClass(
96 state: NonNullable<ThreadPr>["state"],
97 isDraft = false,
98): string {
99 switch (state) {
100 case "open":
101 if (isDraft) {
102 return "group-hover/v2-row:text-zinc-500 dark:group-hover/v2-row:text-zinc-400/80";
103 }
104 return "group-hover/v2-row:text-emerald-600 dark:group-hover/v2-row:text-emerald-300/90";
105 case "merged":
106 return "group-hover/v2-row:text-violet-600 dark:group-hover/v2-row:text-violet-300/90";
107 case "closed":
108 return "group-hover/v2-row:text-red-600 dark:group-hover/v2-row:text-red-300/90";
109 }
111​
112export function prStatusIndicator(
113 pr: ThreadPr,
114 provider: VcsStatusResult["sourceControlProvider"] | null | undefined,
115): PrStatusIndicator | null {
116 function formatPrState(pr: NonNullable<ThreadPr>): string {
117 if (pr.state === "open" && pr.isDraft === true) return "Draft";
118 return pr.state.charAt(0).toUpperCase() + pr.state.slice(1);
119 }
120​
121 function formatPrStatusLead(pr: NonNullable<ThreadPr>, changeRequestShortName: string): string {
122 return `${changeRequestShortName} #${pr.number} - ${formatPrState(pr)}`;
123 }
124 if (!pr) return null;
125 const presentation = resolveChangeRequestPresentation(provider);
126​
127 const tooltipLead = formatPrStatusLead(pr, presentation.shortName);
128 const tooltip = `${tooltipLead}: ${pr.title}`;
129​
130 if (pr.state === "open") {
131 const isDraft = pr.isDraft === true;
132 return {
133 label: `${presentation.shortName} ${isDraft ? "draft" : "open"}`,
134 colorClass: isDraft
135 ? "text-zinc-500 dark:text-zinc-400/80"
136 : "text-emerald-600 dark:text-emerald-300/90",
137 tooltip,
138 tooltipLead,
139 tooltipTitle: pr.title,
140 url: pr.url,
141 };
142 }
143 if (pr.state === "closed") {
144 return {
145 label: `${presentation.shortName} closed`,
146 colorClass: "text-red-600 dark:text-red-300/90",
147 tooltip,
148 tooltipLead,
149 tooltipTitle: pr.title,
150 url: pr.url,
151 };
152 }
153 if (pr.state === "merged") {
154 return {
155 label: `${presentation.shortName} merged`,
156 colorClass: "text-violet-600 dark:text-violet-300/90",
157 tooltip,
158 tooltipLead,
159 tooltipTitle: pr.title,
160 url: pr.url,
161 };
162 }
163 return null;
165​
166export function ChangeRequestStatusIcon({
167 state,
168 isDraft = false,
169 className,
170}: Pick<NonNullable<ThreadPr>, "state"> & {
171 readonly isDraft?: boolean | undefined;
172 readonly className?: string | undefined;
173}) {
174 const presentation = resolvePullRequestState({ state, isDraft });
175 return <presentation.Icon className={className} />;
177​
178export function PrStatusTooltipContent({ status }: { status: PrStatusIndicator }) {
179 return (
180 <span className="flex max-w-[min(34rem,calc(100vw-2rem))] items-stretch overflow-hidden whitespace-nowrap">
181 <span className="shrink-0 pr-2 font-medium">{status.tooltipLead}</span>
182 <span className="min-h-4 shrink-0 border-border/70 border-l" aria-hidden="true" />
183 <span className="min-w-0 truncate pl-2">{status.tooltipTitle}</span>
184 </span>
185 );
187​
188export function resolveThreadPr(input: {
189 threadBranch: string | null;
190 gitStatus: VcsStatusResult | null;
191}): ThreadPr | null {
192 const { threadBranch, gitStatus } = input;
193 if (gitStatus === null) {
194 return null;
195 }
196​
197 if (threadBranch === null || gitStatus.refName !== threadBranch) {
198 return null;
199 }
200​
201 return gitStatus.pr ?? null;
203​
204/**
205 * Parent-held PR snapshot for Sidebar V2. Rows remount when settlement
206 * partitions move them, so terminal PR metadata must live above the row.
207 */
208export interface ThreadChangeRequestSnapshot {
209 readonly branch: string;
210 readonly pr: NonNullable<ThreadPr>;
211 readonly sourceControlProvider: VcsStatusResult["sourceControlProvider"] | undefined;
212 readonly linkedPullRequest?: ThreadLinkedPullRequest;
214​
215export const threadChangeRequestSnapshotsAtom = Atom.make<
216 ReadonlyMap<string, ThreadChangeRequestSnapshot>
217>(new Map()).pipe(Atom.keepAlive, Atom.withLabel("sidebar:thread-change-request-snapshots"));
218​
219function isTerminalChangeRequestState(
220 state: NonNullable<ThreadPr>["state"],
221): state is "merged" | "closed" {
222 return state === "merged" || state === "closed";
224​
225function sourceControlProvidersEqual(
226 left: VcsStatusResult["sourceControlProvider"] | undefined,
227 right: VcsStatusResult["sourceControlProvider"] | undefined,
228): boolean {
229 if (left === right) return true;
230 if (left == null || right == null) return left == null && right == null;
231 return left.kind === right.kind && left.name === right.name && left.baseUrl === right.baseUrl;
233​
234function linkedPullRequestsEqual(
235 left: ThreadLinkedPullRequest | null | undefined,
236 right: ThreadLinkedPullRequest | null | undefined,
237): boolean {
238 if (left == null || right == null) return left == null && right == null;
239 return (
240 left.projectId === right.projectId &&
241 left.repository === right.repository &&
242 left.number === right.number &&
243 left.url === right.url
244 );
246​
247export function threadChangeRequestSnapshotsEqual(
248 left: ThreadChangeRequestSnapshot,
249 right: ThreadChangeRequestSnapshot,
250): boolean {
251 return (
252 left.branch === right.branch &&
253 left.pr.number === right.pr.number &&
254 left.pr.title === right.pr.title &&
255 left.pr.url === right.pr.url &&
256 left.pr.baseRef === right.pr.baseRef &&
257 left.pr.headRef === right.pr.headRef &&
258 left.pr.state === right.pr.state &&
259 left.pr.isDraft === right.pr.isDraft &&
260 (left.pr.updatedAt ?? null) === (right.pr.updatedAt ?? null) &&
261 sourceControlProvidersEqual(left.sourceControlProvider, right.sourceControlProvider) &&
262 linkedPullRequestsEqual(left.linkedPullRequest, right.linkedPullRequest)
263 );
265​
266export function setThreadChangeRequestSnapshot(
267 threadKey: string,
268 snapshot: ThreadChangeRequestSnapshot | null,
269): void {
270 appAtomRegistry.modify(threadChangeRequestSnapshotsAtom, (current) => {
271 const existing = current.get(threadKey);
272 if (snapshot === null) {
273 if (existing === undefined) return [false, current];
274 const next = new Map(current);
275 next.delete(threadKey);
276 return [true, next];
277 }
278 if (existing !== undefined && threadChangeRequestSnapshotsEqual(existing, snapshot)) {
279 return [false, current];
280 }
281 const next = new Map(current);
282 next.set(threadKey, snapshot);
283 return [true, next];
284 });
286​
287/**
288 * Authoritative snapshot update from live VCS status.
289 * - `undefined`: missing status, or a local checkout retaining a terminal PR — leave the map alone
290 * - `null`: no PR (without a retained terminal snapshot), a cleared branch, or a mismatch without a terminal PR — clear
291 * - snapshot: matching branch reports a PR — store/replace
292 */
293export function nextThreadChangeRequestSnapshot(input: {
294 threadBranch: string | null;
295 gitStatus: VcsStatusResult | null;
296 snapshot: ThreadChangeRequestSnapshot | null | undefined;
297 retainTerminalOnBranchMismatch: boolean;
298 linkedPullRequest?: ThreadLinkedPullRequest | null | undefined;
299 linkedPullRequestStatus?: LinkedThreadPullRequestStatus | null | undefined;
300}): ThreadChangeRequestSnapshot | null | undefined {
301 const {
302 threadBranch,
303 gitStatus,
304 snapshot,
305 retainTerminalOnBranchMismatch,
306 linkedPullRequest,
307 linkedPullRequestStatus,
308 } = input;
309 if (linkedPullRequest != null) {
310 if (linkedPullRequestStatus === null || linkedPullRequestStatus === undefined) {
311 return linkedPullRequestsEqual(snapshot?.linkedPullRequest, linkedPullRequest)
312 ? undefined
313 : null;
314 }
315 return {
316 branch: threadBranch ?? linkedPullRequestStatus.pr.headRef,
317 pr: linkedPullRequestStatus.pr,
318 sourceControlProvider: linkedPullRequestStatus.sourceControlProvider,
319 linkedPullRequest,
320 };
321 }
322 if (gitStatus === null) {
323 return snapshot?.linkedPullRequest === undefined ? undefined : null;
324 }
325 if (threadBranch === null) {
326 return null;
327 }
328 if (gitStatus.refName !== threadBranch) {
329 return retainTerminalOnBranchMismatch &&
330 snapshot != null &&
331 snapshot.linkedPullRequest === undefined &&
332 isTerminalChangeRequestState(snapshot.pr.state)
333 ? undefined
334 : null;
335 }
336 if (gitStatus.pr == null) {
337 if (
338 retainTerminalOnBranchMismatch &&
339 snapshot != null &&
340 snapshot.linkedPullRequest === undefined &&
341 isTerminalChangeRequestState(snapshot.pr.state)
342 ) {
343 return undefined;
344 }
345 return null;
346 }
347 return {
348 branch: threadBranch,
349 pr: gitStatus.pr,
350 sourceControlProvider: gitStatus.sourceControlProvider,
351 };
353​
354/**
355 * Live PR when the checkout matches the thread branch; otherwise, for local
356 * checkouts only, a cached merged/closed PR for the thread. Local thread
357 * metadata follows the shared checkout, so the cached branch intentionally
358 * survives that metadata changing to the newly checked-out branch. Open PRs
359 * are retained only while live status is absent and the branch still matches.
360 */
361export function resolveDisplayedThreadPr(input: {
362 threadBranch: string | null;
363 gitStatus: VcsStatusResult | null;
364 snapshot: ThreadChangeRequestSnapshot | null | undefined;
365 retainTerminalOnBranchMismatch: boolean;
366 linkedPullRequest?: ThreadLinkedPullRequest | null | undefined;
367 linkedPullRequestStatus?: LinkedThreadPullRequestStatus | null | undefined;
368}): ThreadPr | null {
369 const {
370 threadBranch,
371 gitStatus,
372 snapshot,
373 retainTerminalOnBranchMismatch,
374 linkedPullRequest,
375 linkedPullRequestStatus,
376 } = input;
377 if (linkedPullRequest != null) {
378 return (
379 linkedPullRequestStatus?.pr ??
380 (linkedPullRequestsEqual(snapshot?.linkedPullRequest, linkedPullRequest)
381 ? (snapshot?.pr ?? null)
382 : null)
383 );
384 }
385 if (
386 threadBranch !== null &&
387 gitStatus !== null &&
388 gitStatus.refName === threadBranch &&
389 gitStatus.pr != null
390 ) {
391 return gitStatus.pr;
392 }
393​
394 if (
395 gitStatus === null &&
396 threadBranch !== null &&
397 snapshot?.branch === threadBranch &&
398 snapshot.linkedPullRequest === undefined
399 ) {
400 return snapshot.pr;
401 }
402​
403 if (
404 threadBranch !== null &&
405 retainTerminalOnBranchMismatch &&
406 snapshot != null &&
407 snapshot.linkedPullRequest === undefined &&
408 isTerminalChangeRequestState(snapshot.pr.state)
409 ) {
410 return snapshot.pr;
411 }
412​
413 return null;
415​
416export function resolveDisplayedThreadPrProvider(input: {
417 threadBranch: string | null;
418 gitStatus: VcsStatusResult | null;
419 snapshot: ThreadChangeRequestSnapshot | null | undefined;
420 retainTerminalOnBranchMismatch: boolean;
421 linkedPullRequest?: ThreadLinkedPullRequest | null | undefined;
422 linkedPullRequestStatus?: LinkedThreadPullRequestStatus | null | undefined;
423}): VcsStatusResult["sourceControlProvider"] | undefined {
424 const {
425 threadBranch,
426 gitStatus,
427 snapshot,
428 retainTerminalOnBranchMismatch,
429 linkedPullRequest,
430 linkedPullRequestStatus,
431 } = input;
432 if (linkedPullRequest != null) {
433 return (
434 linkedPullRequestStatus?.sourceControlProvider ??
435 (linkedPullRequestsEqual(snapshot?.linkedPullRequest, linkedPullRequest)
436 ? snapshot?.sourceControlProvider
437 : undefined)
438 );
439 }
440 if (
441 threadBranch !== null &&
442 gitStatus !== null &&
443 gitStatus.refName === threadBranch &&
444 gitStatus.pr != null
445 ) {
446 return gitStatus.sourceControlProvider;
447 }
448​
449 if (
450 gitStatus === null &&
451 threadBranch !== null &&
452 snapshot?.branch === threadBranch &&
453 snapshot.linkedPullRequest === undefined
454 ) {
455 return snapshot.sourceControlProvider;
456 }
457​
458 if (
459 threadBranch !== null &&
460 retainTerminalOnBranchMismatch &&
461 snapshot != null &&
462 snapshot.linkedPullRequest === undefined &&
463 isTerminalChangeRequestState(snapshot.pr.state)
464 ) {
465 return snapshot.sourceControlProvider;
466 }
467​
468 return undefined;
470​
471export function terminalStatusFromRunningIds(
472 runningTerminalIds: ReadonlyArray<string>,
473): TerminalStatusIndicator | null {
474 if (runningTerminalIds.length === 0) {
475 return null;
476 }
477 return {
478 label: "Terminal process running",
479 colorClass: "text-teal-600 dark:text-teal-300/90",
480 pulse: true,
481 };
483​
484export function ThreadWorktreeIndicator({
485 thread,
486}: {
487 thread: Pick<SidebarThreadSummary, "id" | "branch" | "worktreePath">;
488}) {
489 const worktreePath = thread.worktreePath?.trim();
490 if (!worktreePath) {
491 return null;
492 }
493​
494 const displayPath = formatWorktreePathForDisplay(worktreePath);
495 const tooltip = thread.branch
496 ? `Worktree: ${displayPath} (${thread.branch})`
497 : `Worktree: ${displayPath}`;
498​
499 return (
500 <Tooltip>
501 <TooltipTrigger
502 render={
503 <span
504 role="img"
505 aria-label={tooltip}
506 data-testid={`thread-worktree-${thread.id}`}
507 className="inline-flex items-center justify-center"
508 />
509 }
510 >
511 <FolderGit2Icon className="size-3 text-muted-foreground/40" />
512 </TooltipTrigger>
513 <TooltipPopup side="top">{tooltip}</TooltipPopup>
514 </Tooltip>
515 );
517​
518export function ThreadStatusLabel({
519 status,
520 compact = false,
521}: {
522 status: ThreadStatusPill;
523 compact?: boolean;
524}) {
525 if (compact) {
526 return (
527 <Tooltip>
528 <TooltipTrigger
529 render={
530 <span
531 aria-label={status.label}
532 className={`inline-flex size-3.5 shrink-0 items-center justify-center ${status.colorClass}`}
533 />
534 }
535 >
536 <span
537 className={`size-[9px] rounded-full ${status.dotClass} ${
538 status.pulse ? "animate-status-pulse" : ""
539 }`}
540 />
541 </TooltipTrigger>
542 <TooltipPopup side="top">{status.label}</TooltipPopup>
543 </Tooltip>
544 );
545 }
546​
547 return (
548 <Tooltip>
549 <TooltipTrigger
550 render={
551 <span
552 aria-label={status.label}
553 className={`inline-flex items-center gap-1 text-[10px] ${status.colorClass}`}
554 />
555 }
556 >
557 <span
558 className={`h-1.5 w-1.5 rounded-full ${status.dotClass} ${
559 status.pulse ? "animate-status-pulse" : ""
560 }`}
561 />
562 <span className="hidden md:inline">{status.label}</span>
563 </TooltipTrigger>
564 <TooltipPopup side="top">{status.label}</TooltipPopup>
565 </Tooltip>
566 );
568​
569/**
570 * Non-interactive leading status icons for a thread row in compact contexts
571 * like the command palette. Shows the change request state icon (if present) and the
572 * thread status dot, matching the sidebar's leading indicators.
573 */
574export function ThreadRowLeadingStatus({
575 thread,
576 snapshot,
577}: {
578 thread: SidebarThreadSummary;
579 snapshot?: ThreadChangeRequestSnapshot | undefined;
580}) {
581 const { leaseLiveStatus, rowRef } = useSidebarRowSubscriptionLease(false);
582 // Observe the containing title even when this thread has no badge yet.
583 const statusRef = useCallback(
584 (node: HTMLSpanElement | null) => rowRef(node?.parentElement ?? null),
585 [rowRef],
586 );
587 const threadRef = scopeThreadRef(thread.environmentId, thread.id);
588 const localLastVisitedAt = useUiStateStore(
589 (state) => state.threadLastVisitedAtById[scopedThreadKey(threadRef)],
590 );
591 const lastVisitedAt = resolveThreadLastVisitedAt(thread.lastVisitedAt, localLastVisitedAt);
592 const threadProject = useProject(
593 useMemo(
594 () => scopeProjectRef(thread.environmentId, thread.projectId),
595 [thread.environmentId, thread.projectId],
596 ),
597 );
598 const threadProjectCwd = threadProject?.workspaceRoot ?? null;
599 const gitCwd = thread.worktreePath ?? threadProjectCwd;
600 const linkedPullRequest = useLinkedThreadPullRequest(
601 thread.environmentId,
602 thread.linkedPullRequest,
603 leaseLiveStatus,
604 );
605 const gitStatus = useEnvironmentQuery(
606 leaseLiveStatus &&
607 thread.linkedPullRequest == null &&
608 (thread.branch != null || thread.worktreePath !== null) &&
609 gitCwd !== null
610 ? vcsEnvironment.status({
611 environmentId: thread.environmentId,
612 input: { cwd: gitCwd },
613 })
614 : null,
615 );
616 const visibleGitStatus = useRetainedValue(
617 JSON.stringify([thread.environmentId, gitCwd]),
618 gitStatus.data,
619 );
620 const displayedPrInput = {
621 threadBranch: thread.branch,
622 gitStatus: visibleGitStatus,
623 snapshot,
624 retainTerminalOnBranchMismatch: thread.worktreePath === null,
625 linkedPullRequest: thread.linkedPullRequest,
626 linkedPullRequestStatus: linkedPullRequest,
627 };
628 const pr = resolveDisplayedThreadPr(displayedPrInput);
629 const prStatus = prStatusIndicator(pr, resolveDisplayedThreadPrProvider(displayedPrInput));
630 const threadStatus = resolveThreadStatusPill({
631 thread: {
632 ...thread,
633 lastVisitedAt,
634 },
635 });
636​
637 return (
638 <span
639 ref={statusRef}
640 className={
641 prStatus || threadStatus ? "inline-flex shrink-0 items-center gap-1.5" : "contents"
642 }
643 >
644 {prStatus && pr ? (
645 <Tooltip>
646 <TooltipTrigger
647 render={
648 <span
649 aria-label={prStatus.tooltip}
650 className={`inline-flex items-center justify-center ${prStatus.colorClass}`}
651 />
652 }
653 >
654 <ChangeRequestStatusIcon state={pr.state} isDraft={pr.isDraft} className="size-3" />
655 </TooltipTrigger>
656 <TooltipPopup side="top">
657 <PrStatusTooltipContent status={prStatus} />
658 </TooltipPopup>
659 </Tooltip>
660 ) : null}
661 {threadStatus ? <ThreadStatusLabel status={threadStatus} /> : null}
662 </span>
663 );
665​
666/**
667 * Non-interactive trailing status icons for a thread row in compact contexts
668 * like the command palette. Shows a terminal-running indicator and a remote
669 * environment indicator, matching the sidebar's trailing indicators.
670 */
671export function ThreadRowTrailingStatus({ thread }: { thread: SidebarThreadSummary }) {
672 const runningTerminalIds = useThreadRunningTerminalIds({
673 environmentId: thread.environmentId,
674 threadId: thread.id,
675 });
676 const environment = useEnvironment(thread.environmentId);
677 const primaryEnvironmentId = usePrimaryEnvironmentId();
678 // No primary (the hosted app) means every thread is remote, and the machine
679 // glyph is what tells the environments apart.
680 const isRemoteThread = thread.environmentId !== primaryEnvironmentId;
681 const remoteEnvLabel = environment?.label ?? null;
682 const threadEnvironmentLabel = isRemoteThread ? (remoteEnvLabel ?? "Remote") : null;
683 const remoteMachine = resolveEnvironmentMachineKind(environment?.serverConfig ?? null);
684 const terminalStatus = terminalStatusFromRunningIds(runningTerminalIds);
685​
686 if (!terminalStatus && !isRemoteThread) {
687 return null;
688 }
689​
690 return (
691 <span className="inline-flex shrink-0 items-center gap-1.5">
692 {terminalStatus ? (
693 <Tooltip>
694 <TooltipTrigger
695 render={
696 <span
697 role="img"
698 aria-label={terminalStatus.label}
699 className={`inline-flex items-center justify-center ${terminalStatus.colorClass}`}
700 />
701 }
702 >
703 <TerminalIcon
704 className={`size-3 ${terminalStatus.pulse ? "animate-status-pulse" : ""}`}
705 />
706 </TooltipTrigger>
707 <TooltipPopup side="top">{terminalStatus.label}</TooltipPopup>
708 </Tooltip>
709 ) : null}
710 {isRemoteThread ? (
711 <Tooltip>
712 <TooltipTrigger
713 render={
714 <span
715 aria-label={threadEnvironmentLabel ?? "Remote"}
716 className="inline-flex items-center justify-center"
717 />
718 }
719 >
720 <EnvironmentMachineIcon
721 kind={remoteMachine}
722 className="size-3 text-muted-foreground/60"
723 />
724 </TooltipTrigger>
725 <TooltipPopup side="top">{threadEnvironmentLabel}</TooltipPopup>
726 </Tooltip>
727 ) : null}
728 </span>
729 );