fix: review — stable sort fallback, cleaner status colors

- Sort: threads without startedAt pushed to bottom (not random)
- Colors: completed=success(green), running/active=accent(blue), failed=error(red)
- Remove opacity hack, simplify ternary

小橘 <xiaoju@shazhou.work>
This commit is contained in:
2026-05-11 12:14:51 +00:00
parent 0970139418
commit f87cb38a67
@@ -14,7 +14,9 @@ export function ThreadList({ agent, onSelect }: Props) {
if (status === "error") return <p style={{ color: "var(--color-error)" }}>Error: {error}</p>;
const threads = [...data.threads].sort((a, b) => {
if (!a.startedAt || !b.startedAt) return 0;
if (!a.startedAt && !b.startedAt) return 0;
if (!a.startedAt) return 1;
if (!b.startedAt) return -1;
return b.startedAt.localeCompare(a.startedAt);
});
@@ -42,15 +44,12 @@ export function ThreadList({ agent, onSelect }: Props) {
className="text-xs px-2 py-0.5 rounded"
style={{
background:
t.status === "running"
t.status === "completed"
? "var(--color-success)"
: t.status === "failed"
? "var(--color-error)"
: t.status === "completed"
? "var(--color-success)"
: "var(--color-accent)",
: "var(--color-accent)",
color: "#000",
opacity: t.status === "completed" ? 0.7 : 1,
}}
>
{t.status}