Skip to content

Commit 2e21132

Browse files
committed
refactor(code): use status token for signal report list ordering
1 parent 798faf2 commit 2e21132

File tree

6 files changed

+45
-65
lines changed

6 files changed

+45
-65
lines changed

apps/code/src/renderer/features/inbox/components/ReportCard.tsx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,33 @@ export function ReportCard({
8080
>
8181
<Flex align="start" justify="between" gap="3">
8282
<Flex direction="column" gap="1" style={{ minWidth: 0, flex: 1 }}>
83-
<Flex align="center" gapX="2" wrap="wrap">
83+
{/* Bullet stays in its own column so title + badges wrap under each other, not under the dot */}
84+
<Flex align="center" gapX="2" className="min-w-0">
8485
<span
8586
title={`Signal strength: ${strengthLabel}`}
8687
aria-hidden
88+
className="shrink-0"
8789
style={{
8890
width: "6px",
8991
height: "6px",
9092
borderRadius: "9999px",
9193
backgroundColor: strengthColor,
9294
display: "inline-block",
93-
flexShrink: 0,
9495
}}
9596
/>
96-
<Text
97-
size="1"
98-
weight="medium"
99-
className="block min-w-0 truncate font-mono text-[12px]"
97+
<Flex
98+
align="center"
99+
gapX="2"
100+
wrap="wrap"
101+
className="min-w-0 flex-1"
100102
>
101-
{report.title ?? "Untitled signal"}
102-
</Text>
103-
<Flex align="center" gapX="2" wrap="wrap">
103+
<Text
104+
size="1"
105+
weight="medium"
106+
className="min-w-0 flex-1 basis-0 truncate font-mono text-[12px]"
107+
>
108+
{report.title ?? "Untitled signal"}
109+
</Text>
104110
<span
105111
className="shrink-0 rounded-sm px-1 py-px font-mono text-[9px] uppercase tracking-wider"
106112
style={{
@@ -113,14 +119,18 @@ export function ReportCard({
113119
</span>
114120
<SignalReportPriorityBadge priority={report.priority} />
115121
</Flex>
116-
<div style={{ opacity: isReady ? 1 : 0.82 }}>
117-
<SignalReportSummaryMarkdown
118-
content={report.summary}
119-
fallback="No summary yet — still collecting context."
120-
variant="list"
121-
/>
122-
</div>
123122
</Flex>
123+
{/* Summary is outside the title row so wrapped lines align with title text (bullet + gap), not the card edge */}
124+
<div
125+
className="min-w-0 pl-[calc(6px+var(--space-2))]"
126+
style={{ opacity: isReady ? 1 : 0.82 }}
127+
>
128+
<SignalReportSummaryMarkdown
129+
content={report.summary}
130+
fallback="No summary yet — still collecting context."
131+
variant="list"
132+
/>
133+
</div>
124134
</Flex>
125135
<Flex direction="column" align="end" gap="1" className="shrink-0">
126136
<Text size="1" color="gray" className="font-mono text-[11px]">

apps/code/src/renderer/features/inbox/utils/filterReports.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,21 @@ describe("filterReportsBySearch", () => {
9797
});
9898

9999
describe("buildSignalReportListOrdering", () => {
100-
it("puts pipeline first then descending field", () => {
100+
it("puts status rank first then descending field", () => {
101101
expect(buildSignalReportListOrdering("total_weight", "desc")).toBe(
102-
"pipeline,-total_weight",
102+
"status,-total_weight",
103103
);
104104
});
105105

106-
it("puts pipeline first then ascending field", () => {
106+
it("puts status rank first then ascending field", () => {
107107
expect(buildSignalReportListOrdering("created_at", "asc")).toBe(
108-
"pipeline,created_at",
108+
"status,created_at",
109109
);
110110
});
111111

112112
it("works for signal_count", () => {
113113
expect(buildSignalReportListOrdering("signal_count", "desc")).toBe(
114-
"pipeline,-signal_count",
114+
"status,-signal_count",
115115
);
116116
});
117117
});

apps/code/src/renderer/features/inbox/utils/filterReports.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export function filterReportsBySearch(
1616
}
1717

1818
/**
19-
* Comma-separated `ordering` for the signal report list API: stage (`pipeline`) then
20-
* the toolbar field (matches default inbox UX).
19+
* Comma-separated `ordering` for the signal report list API: semantic `status` rank
20+
* then the toolbar field (matches default inbox UX).
2121
*/
2222
export function buildSignalReportListOrdering(
2323
field: SignalReportOrderingField,
2424
direction: "asc" | "desc",
2525
): string {
2626
const secondary = direction === "desc" ? `-${field}` : field;
27-
return `pipeline,${secondary}`;
27+
return `status,${secondary}`;
2828
}

apps/code/src/renderer/features/sidebar/components/SidebarMenu.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ function SidebarMenuComponent() {
6262
const inboxSignalCount = inboxResults.filter(
6363
(r) => r.status === "ready",
6464
).length;
65-
const inboxPipelineActive = inboxResults.some(
66-
(r) => r.status === "in_progress",
67-
);
6865

6966
const commandCenterCells = useCommandCenterStore((s) => s.cells);
7067
const commandCenterActiveCount = commandCenterCells.filter(
@@ -209,7 +206,6 @@ function SidebarMenuComponent() {
209206
isActive={sidebarData.isInboxActive}
210207
onClick={handleInboxClick}
211208
signalCount={inboxSignalCount}
212-
pipelineActive={inboxPipelineActive}
213209
/>
214210
</Box>
215211

apps/code/src/renderer/features/sidebar/components/items/HomeItem.tsx

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,14 @@ interface InboxItemProps {
2222
isActive: boolean;
2323
onClick: () => void;
2424
signalCount?: number;
25-
/** True while at least one report is `in_progress` (summary / judges running). */
26-
pipelineActive?: boolean;
2725
}
2826

2927
function formatSignalCount(count: number): string {
3028
if (count > 99) return "99+";
3129
return String(count);
3230
}
3331

34-
export function InboxItem({
35-
isActive,
36-
onClick,
37-
signalCount,
38-
pipelineActive = false,
39-
}: InboxItemProps) {
32+
export function InboxItem({ isActive, onClick, signalCount }: InboxItemProps) {
4033
return (
4134
<SidebarItem
4235
depth={0}
@@ -45,32 +38,13 @@ export function InboxItem({
4538
isActive={isActive}
4639
onClick={onClick}
4740
endContent={
48-
pipelineActive || (signalCount && signalCount > 0) ? (
49-
<span className="inline-flex items-center gap-1">
50-
{pipelineActive ? (
51-
<span
52-
className="relative flex h-2 w-2 shrink-0"
53-
title="Research in progress on at least one report"
54-
>
55-
<span
56-
className="absolute inline-flex h-full w-full animate-ping rounded-full opacity-35"
57-
style={{ backgroundColor: "var(--amber-9)" }}
58-
/>
59-
<span
60-
className="relative inline-flex h-2 w-2 rounded-full"
61-
style={{ backgroundColor: "var(--amber-9)" }}
62-
/>
63-
</span>
64-
) : null}
65-
{signalCount && signalCount > 0 ? (
66-
<span
67-
className="inline-flex min-w-[16px] items-center justify-center rounded-full px-1 text-[10px] text-gray-11 leading-none"
68-
style={{ height: "16px" }}
69-
title={`${signalCount} ready reports`}
70-
>
71-
{formatSignalCount(signalCount)}
72-
</span>
73-
) : null}
41+
signalCount && signalCount > 0 ? (
42+
<span
43+
className="inline-flex min-w-[16px] items-center justify-center rounded-full px-1 text-[10px] text-gray-11 leading-none"
44+
style={{ height: "16px" }}
45+
title={`${signalCount} ready reports`}
46+
>
47+
{formatSignalCount(signalCount)}
7448
</span>
7549
) : undefined
7650
}

apps/code/src/shared/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ export interface SignalReportsQueryParams {
236236
offset?: number;
237237
status?: CommaSeparatedSignalReportStatuses;
238238
/**
239-
* Comma-separated sort keys (prefix `-` for descending). Use `pipeline` (or `stage`)
240-
* for report stage rank; `signal_count`, `total_weight`, `created_at`, `updated_at`, `id`.
241-
* Example: `pipeline,-total_weight`. Omit `pipeline` if you want a global sort only.
239+
* Comma-separated sort keys (prefix `-` for descending). `status` is semantic stage
240+
* rank (not lexicographic `status` column order). Also: `signal_count`, `total_weight`,
241+
* `created_at`, `updated_at`, `id`. Example: `status,-total_weight`.
242242
*/
243243
ordering?: string;
244244
}

0 commit comments

Comments
 (0)