import { useQuery } from '@tanstack/react-query';
import { Skeleton } from '#/components/atoms/skeleton.jsx';
import { CheckRun } from '#/components/molecules/check-run.jsx';
import { EmptyState } from '#/components/molecules/empty-state.jsx';
import { PageNotice } from '#/components/molecules/page-notice.jsx';
import { Screen } from '#/components/molecules/screen.jsx';
import { loadChecks } from '#/lib/checks.js';
import { repoRecord } from '#/lib/git.js';
/**
* One run, addressed by the record key the runner wrote it under. The listing
* this reads from is the one the checks page already loaded, so arriving from
* that page costs no request; arriving from a shared link loads it.
*/
export function CheckPage({ repo, rkey, space }) {
const record = repoRecord(repo, space);
const { data } = useQuery({
queryKey: ['checks', repo, space ?? ''],
queryFn: () => loadChecks(repo, space),
});
if (!record) {
return No such repository.;
}
const check = data?.runs.find((run) => run.rkey === rkey);
if (!data) {
return (
);
}
if (!check) {
return (
);
}
return (
);
}