import { MessageSquareText } from "lucide-react"; import Link from "next/link"; import { formatRelativeDate } from "@/lib/format-date"; import type { LibraryArtifact } from "../model/artifact"; import { KIND_META } from "./kind-meta"; export function ArtifactCard({ artifact, searchSpaceId, onOpen, }: { artifact: LibraryArtifact; searchSpaceId: number; onOpen: (artifact: LibraryArtifact) => void; }) { const meta = KIND_META[artifact.kind]; const Icon = meta.icon; const subtitle = artifact.status === "running" ? "Generating…" : artifact.status === "error" ? "Failed" : meta.label; return (
{/* Stretched overlay makes the whole card open the viewer; sibling controls sit above it via z-10. */} {artifact.title} {subtitle} · {formatRelativeDate(artifact.createdAt)} {artifact.sourceThreadId ? ( Open source chat ) : null}
); }