~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/pds.js

An atproto PDS in JavaScript, for Cloudflare Workers and Node

0
0
main
24 lines · 756 B Raw History
import { useQuery } from '@tanstack/react-query';
import { CheckStatus } from '#/components/molecules/check-status.jsx';
import { loadChecks, summarize } from '#/lib/checks.js';

/**
 * The badge for one commit in a history listing, from the runner's run
 * listing. Absent means the repository names no runner, or the runner has not
 * reported on this commit; neither is worth showing.
 */
export function CommitCheckStatus({ repo, sha, className, space }) {
  const { data } = useQuery({
    queryKey: ['checks', repo, space ?? ''],
    queryFn: () => loadChecks(repo, space),
  });
  const latest = data?.bySha.get(sha) ?? [];

  return (
    <CheckStatus
      summary={summarize(latest)}
      runs={latest}
      className={className}
    />
  );
}