import Link from "@moduletrace/twui/layout/Link"; import Row from "@moduletrace/twui/layout/Row"; import Span from "@moduletrace/twui/layout/Span"; import Stack from "@moduletrace/twui/layout/Stack"; import Button from "@moduletrace/twui/layout/Button"; import { RefreshCw, Trash2 } from "lucide-react"; import type { MediaType, PublicBotFile } from "@/src/types"; import relativeTime from "@/src/utils/relative-time"; import AttachmentIcon from "./attachment-icon"; type Props = { file: PublicBotFile; /** * A crew manager may delete and re-ingest. */ can_manage: boolean; busy?: boolean; onIngest: () => void; onDelete: () => void; }; /** * One file in the files modal: its type, path, size and age, and what can * be done with it. A file that isn't searchable says why. */ export default function FileRow({ file, can_manage, busy, onIngest, onDelete }: Props) { return ( {file.path || file.name} {[ file.scope == "workspace" ? "Workspace" : "Bot files", `${Math.max(1, Math.round(file.size / 1024))} KB`, file.created_at ? relativeTime({ at: file.created_at }) : "", file.ingest_error ? file.ingest_error : file.ingested_at ? "searchable" : "not searchable yet", ] .filter(Boolean) .join(" ยท ")} {can_manage ? ( ) : null} ); }