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:
@@ -14,7 +14,9 @@ export function ThreadList({ agent, onSelect }: Props) {
|
|||||||
if (status === "error") return <p style={{ color: "var(--color-error)" }}>Error: {error}</p>;
|
if (status === "error") return <p style={{ color: "var(--color-error)" }}>Error: {error}</p>;
|
||||||
|
|
||||||
const threads = [...data.threads].sort((a, b) => {
|
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);
|
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"
|
className="text-xs px-2 py-0.5 rounded"
|
||||||
style={{
|
style={{
|
||||||
background:
|
background:
|
||||||
t.status === "running"
|
t.status === "completed"
|
||||||
? "var(--color-success)"
|
? "var(--color-success)"
|
||||||
: t.status === "failed"
|
: t.status === "failed"
|
||||||
? "var(--color-error)"
|
? "var(--color-error)"
|
||||||
: t.status === "completed"
|
: "var(--color-accent)",
|
||||||
? "var(--color-success)"
|
|
||||||
: "var(--color-accent)",
|
|
||||||
color: "#000",
|
color: "#000",
|
||||||
opacity: t.status === "completed" ? 0.7 : 1,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t.status}
|
{t.status}
|
||||||
|
|||||||
Reference in New Issue
Block a user