import type { ReactNode } from 'react'; import { CommitCard } from '@/components/commit-card'; import { CommitSkeleton, EmptyFeed } from '@/components/commit-feed'; import { GraphCanvas } from '@/components/graph-canvas'; import { authorLaneColor } from '@/lib/utils'; import type { Commit } from '@/types'; export type SearchResultSet = { term: string; commits: Commit[] }; export function SearchResults({ results, isWaiting = false, heading = 'Most relevant commits', empty = 'Try describing the idea in other words, or pick one of the searches below.', isStandalone = false, }: { results: SearchResultSet | null; isWaiting?: boolean; heading?: string; empty?: ReactNode; isStandalone?: boolean; }) { if (results === null) { return (
); } return (

{heading}

{results.commits.length}{' '} {results.commits.length === 1 ? 'match' : 'matches'}
{results.commits.length === 0 ? (
{empty}
) : ( {results.commits.map((commit, index) => { if (isStandalone) { return ( ); } const previous = results.commits[index - 1]; return ( ); })} )}
); }