import { useQuery } from '@tanstack/react-query';
import { ImageOff } from 'lucide-react';
import { useState } from 'react';
import { Button } from '#/components/atoms/button.jsx';
import { Card } from '#/components/atoms/card.jsx';
import { Link } from '#/components/atoms/link.jsx';
import { Notice } from '#/components/atoms/notice.jsx';
import { Skeleton } from '#/components/atoms/skeleton.jsx';
import { Copyable } from '#/components/molecules/copyable.jsx';
import { EmptyState } from '#/components/molecules/empty-state.jsx';
import { RepoScope } from '#/components/molecules/repo-scope.jsx';
import { fileSize } from '#/lib/format.js';
import { href } from '#/lib/navigation.jsx';
import { useSession } from '#/lib/session.jsx';
import { getBlob, listBlobs } from '#/lib/spaces.js';
/** One blob, fetched only when a reader asks to see it. */
function BlobRow({ space, repo, cid }) {
const { session } = useSession();
const [open, setOpen] = useState(false);
const { data, error, isPending } = useQuery({
queryKey: ['blob', space, repo, cid],
queryFn: () => getBlob(session, { space, repo }, cid),
enabled: open,
retry: false,
});
return (
)}
{data.type || 'unknown type'} · {fileSize(data.size)}
>
)}
The blobs this repo's records in the space reference. Reachability is read from the records themselves, so a blob no record names is not listed and is not served.
{isPending &&