import { Icon } from "./Icon";
import { del, post } from "../api";
import { useT } from "../i18n";
import { useStore } from "../store";
import type { QueueItem } from "../types";
import { imageSrc } from "./FileFigure";
import { confirmDialog, promptDialog, toast } from "../dialogs";
const EMPTY: QueueItem[] = [];
/** Messages waiting for the agent; deletable until delivered. */
export function QueueList({ sessionId, busy }: { sessionId: string; busy: boolean }) {
const t = useT();
const items = useStore((s) => s.queue[sessionId] ?? EMPTY);
if (items.length === 0) return null;
return (
{busy ? t("queue.pending", { n: items.length }) : t("queue.stopped", { n: items.length })}
{!busy && (
)}
{items.map((it) => {
const text = it.parts.map((p) => (p.type === "text" ? p.text : "")).join(" ").trim();
const images = it.parts.filter((p) => p.type === "image") as Extract
[];
return (
{it.source === "background" &&
{t("tool.background")}}
{it.source === "background" ? t("queue.backgroundResult") : text || "—"}
{images.map((p, i) => (
})
))}
{it.source !== "background" && (
)}
);
})}
);
}