import { Badge } from '#/components/atoms/badge.jsx'; import { Link } from '#/components/atoms/link.jsx'; import { TextLink } from '#/components/molecules/text-link.jsx'; import { bytes, dateTime } from '#/lib/format.js'; import { parseAtUri } from '#/lib/record-link.js'; /** * The records this file appears in, each opening in the records browser. A * file no record points at is flagged instead: the link table is this server's * bookkeeping, so it is phrased as what is known, not a promise. */ function UsedBy({ records, recordHref, onNavigate }) { if (!records.length) { return (
Not used by any record

No record points at this file. Unused files are cleaned up automatically.

); } return (
Used by
{records.map((uri) => { const target = parseAtUri(uri); if (!target) return null; return ( {target.collection}/{target.rkey} ); })}
); } /** One file's full details; the body of both the card and the tile dialog. */ export function FileDetails({ blob, blobBase, recordHref, onNavigate }) { return (
{blob.mimeType || 'File'} {bytes(blob.size)} {(blob.time || blob.createdAt) && ( {blob.timeFromRecord ? dateTime(blob.time) : `Stored ${dateTime(blob.time || blob.createdAt)}`} )}
{blob.cid}
{blobBase && ( Download )}
); }