Show offline thread panels

This commit is contained in:
murashit 2026-05-26 09:41:37 +09:00
parent 4011e76788
commit 27be1adc8a
3 changed files with 15 additions and 2 deletions

View file

@ -2,7 +2,7 @@ import type { OpenCodexPanelSnapshot } from "../chat/panel-snapshot";
import type { Thread } from "../../generated/app-server/v2/Thread";
import { getThreadTitle } from "../../domain/threads/model";
export type ThreadsLiveStatus = "needs-input" | "approval" | "running" | "draft" | "open";
export type ThreadsLiveStatus = "needs-input" | "approval" | "running" | "draft" | "offline" | "open";
export interface ThreadsLiveState {
status: ThreadsLiveStatus;
@ -23,7 +23,8 @@ const STATUS_PRIORITY: Record<ThreadsLiveStatus, number> = {
approval: 4,
running: 3,
draft: 2,
open: 1,
offline: 1,
open: 0,
};
export function threadRows(
@ -80,6 +81,7 @@ function snapshotStatus(snapshot: OpenCodexPanelSnapshot): ThreadsLiveStatus {
if (snapshot.pendingApprovals > 0) return "approval";
if (snapshot.busy) return "running";
if (snapshot.hasComposerDraft) return "draft";
if (!snapshot.connected) return "offline";
return "open";
}
@ -93,6 +95,8 @@ function statusLabel(status: ThreadsLiveStatus): string {
return "Running";
case "draft":
return "Draft";
case "offline":
return "Offline";
case "open":
return "Open";
}

View file

@ -180,6 +180,10 @@
--codex-panel-threads-gutter-color: color-mix(in srgb, var(--codex-panel-color-accent) 36%, transparent);
}
.codex-panel-threads__row--offline {
--codex-panel-threads-gutter-color: var(--text-muted);
}
.codex-panel-threads__row--open {
--codex-panel-threads-gutter-color: var(--codex-panel-border-muted-color);
}
@ -188,6 +192,7 @@
.codex-panel-threads__row--approval::before,
.codex-panel-threads__row--running::before,
.codex-panel-threads__row--draft::before,
.codex-panel-threads__row--offline::before,
.codex-panel-threads__row--open::before {
background: var(--codex-panel-threads-gutter-color);
}

View file

@ -1922,6 +1922,10 @@ describe("threads view renderer decisions", () => {
status: "draft",
label: "Draft",
});
expect(liveStateForSnapshots([openPanelSnapshot({ viewId: "offline", threadId: "thread", connected: false })])).toMatchObject({
status: "offline",
label: "Offline",
});
expect(liveStateForSnapshots([openPanelSnapshot({ viewId: "none", threadId: null, busy: true })])).toBeNull();
});