import type { JobItem } from "../types"; interface JobCardProps { job: JobItem; } function getProgress(job: JobItem): number | null { if (typeof job.progress_percent === "number") return job.progress_percent; if (job.step_max && job.step_max > 0) { return Math.round(((job.step_value || 0) / job.step_max) * 100); } return null; } function statusLabel(status: string) { if (status === "pending") return "Queued"; if (status === "running") return "Generating"; if (status === "failed") return "Failed"; return status; } export function JobCard({ job }: JobCardProps) { const progress = getProgress(job); const isRunning = job.status === "running"; const isFailed = job.status === "failed"; return (
{job.prompt || "Generation job"}
{job.current_node ? `Node: ${job.current_node}` : isRunning ? "Starting..." : job.status === "pending" ? "Waiting for GPU..." : ""} {job.step_max ? ` · step ${job.step_value || 0}/${job.step_max}` : ""}
{job.prompt_id}