Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/web/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import { ErrorFeed } from "./ErrorFeed.js";
import { SettingsPanel } from "./SettingsPanel.js";
import { StatusBadge, formatTs } from "./shared.js";

export { StatusBadge } from "./shared.js";

type LoadState = { tag: "loading" } | { tag: "ready" } | { tag: "error"; message: string };

export function Dashboard() {
Expand Down
2 changes: 1 addition & 1 deletion src/web/RunDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useMemo, useRef, useState } from "react";
import { fetchRun, type ApiEvent, type ApiRun, type ApiRunDetail, type ApiTurn } from "./api.js";
import { StatusBadge } from "./Dashboard.js";
import { StatusBadge } from "./shared.js";
import { useEventStream } from "./useEventStream.js";
import {
ASSISTANT_LINE_THRESHOLD,
Expand Down
2 changes: 1 addition & 1 deletion src/web/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useMemo, useState } from "react";
import { searchRuns, type ApiSearchMatch } from "./api.js";
import { StatusBadge } from "./Dashboard.js";
import { StatusBadge } from "./shared.js";

export function Search({ query }: { query: string }) {
const [input, setInput] = useState(query);
Expand Down
26 changes: 12 additions & 14 deletions src/web/shared.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
const STATUS_BADGE_COLORS: Record<string, string> = {
completed: "bg-emerald-500/10 text-emerald-300",
running: "bg-cyan-500/10 text-cyan-300",
max_turns: "bg-amber-500/10 text-amber-300",
failed: "bg-rose-500/10 text-rose-300",
rate_limited: "bg-fuchsia-500/10 text-fuchsia-300",
cancelled: "bg-slate-500/10 text-slate-300",
};

const STATUS_BADGE_DEFAULT_COLOR = "bg-slate-500/10 text-slate-300";

export function StatusBadge({ status }: { status: string }) {
const color =
status === "completed"
? "bg-emerald-500/10 text-emerald-300"
: status === "running"
? "bg-cyan-500/10 text-cyan-300"
: status === "max_turns"
? "bg-amber-500/10 text-amber-300"
: status === "failed"
? "bg-rose-500/10 text-rose-300"
: status === "rate_limited"
? "bg-fuchsia-500/10 text-fuchsia-300"
: status === "cancelled"
? "bg-slate-500/10 text-slate-300"
: "bg-slate-500/10 text-slate-300";
const color = STATUS_BADGE_COLORS[status] ?? STATUS_BADGE_DEFAULT_COLOR;
return (
<span
className={`inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium ${color}`}
Expand Down
Loading