Align dashboard room progress with Discord messages

This commit is contained in:
ejclaw
2026-04-28 22:33:12 +09:00
parent 1417c37042
commit b83de973f8
4 changed files with 174 additions and 26 deletions

View File

@@ -211,6 +211,77 @@ describe('RoomCardV2', () => {
expect(html).toContain('<code>pnpm openapi:sync</code>');
expect(html).not.toContain('`origin/dev`');
});
});
describe('RoomCardV2 room thread details', () => {
it('does not render site-only active turn placeholders without visible progress', () => {
const pairedTask: NonNullable<DashboardRoomActivity['pairedTask']> = {
id: 'task-1',
title: 'OpenAPI sync',
status: 'running',
roundTripCount: 1,
updatedAt: '2026-04-28T02:01:00.000Z',
currentTurn: {
turnId: 'turn-1',
role: 'owner',
intentKind: 'implementation',
state: 'running',
attemptNo: 1,
executorServiceId: 'svc-1',
executorAgentType: 'codex',
activeRunId: 'run-site-only',
createdAt: '2026-04-28T02:00:00.000Z',
updatedAt: '2026-04-28T02:01:00.000Z',
completedAt: null,
lastError: null,
progressText: null,
progressUpdatedAt: null,
},
outputs: [],
};
const collapsed = renderToStaticMarkup(
createElement(RoomCardV2, {
activity: activity({ pairedTask }),
activityLoading: false,
busy: false,
draft: '',
entry: { ...entry, status: 'processing' },
expanded: false,
inboxItems: [],
locale: 'ko',
onDraftChange: () => {},
onSendMessage: () => {},
onToggle: () => {},
pinned: false,
t,
...formatters,
}),
);
const expanded = renderToStaticMarkup(
createElement(RoomCardV2, {
activity: activity({ pairedTask }),
activityLoading: false,
busy: false,
draft: '',
entry: { ...entry, status: 'processing' },
expanded: true,
inboxItems: [],
locale: 'ko',
onDraftChange: () => {},
onSendMessage: () => {},
onToggle: () => {},
pinned: false,
t,
...formatters,
}),
);
expect(collapsed).not.toContain('class="room-live"');
expect(expanded).not.toContain('room-timeline-live');
expect(expanded).not.toContain(t.rooms.loadingActivity);
expect(expanded).toContain(t.rooms.noActivity);
});
it('renders message attachments as dashboard images', () => {
const html = renderToStaticMarkup(

View File

@@ -227,6 +227,7 @@ export function RoomCardV2({
expanded={expanded}
formatDate={formatDate}
isProcessing={isProcessing}
liveProgressDisplay={liveProgressDisplay}
locale={locale}
senderRoleClass={senderRoleClass}
t={t}
@@ -488,6 +489,7 @@ function CollapsedLiveTurn({
expanded,
formatDate,
isProcessing,
liveProgressDisplay,
locale,
senderRoleClass,
t,
@@ -496,12 +498,13 @@ function CollapsedLiveTurn({
expanded: boolean;
formatDate: RoomCardFormatters['formatDate'];
isProcessing: boolean;
liveProgressDisplay: string | null;
locale: Locale;
senderRoleClass: RoomCardFormatters['senderRoleClass'];
t: Messages;
turn: RoomTurn | null;
}) {
if (expanded || !isProcessing || !turn) return null;
if (expanded || !isProcessing || !turn || !liveProgressDisplay) return null;
return (
<div className="room-live">
<header>
@@ -524,11 +527,7 @@ function CollapsedLiveTurn({
{formatDate(turn.progressUpdatedAt ?? turn.updatedAt, locale)}
</time>
</header>
{turn.progressText && turn.progressText.trim() ? (
<LiveProgressBody text={turn.progressText} />
) : turn.activeRunId ? (
<code className="live-run">{turn.activeRunId}</code>
) : null}
<LiveProgressBody text={liveProgressDisplay} />
</div>
);
}
@@ -702,15 +701,18 @@ function RoomThreadSection({
t: Messages;
turn: RoomTurn | null;
}) {
const showLiveItem =
turn && turn.completedAt === null && (isProcessing || liveProgressDisplay);
const showLiveItem = !!(
turn &&
turn.completedAt === null &&
liveProgressDisplay
);
return (
<section className="room-section room-thread-section">
<header>
<h4>{t.rooms.activity}</h4>
<small>{agentMessages.length}</small>
</header>
{agentMessages.length === 0 && !(isProcessing && turn) ? (
{agentMessages.length === 0 && !showLiveItem ? (
<p className="room-empty">{t.rooms.noActivity}</p>
) : (
<ol className="room-timeline">