import type { PullRequestListEntry } from "@t3tools/contracts"; import { memo } from "react"; import { cn } from "~/lib/utils"; import { getSourceControlPresentationForKind } from "~/sourceControlPresentation"; import { formatRelativeTimeLabel } from "~/timestampFormat"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { PullRequestActorLabel, PullRequestDiffStat, PullRequestMetaLine, PullRequestStateGlyph, } from "./pullRequestPresentation"; function PullRequestRowImpl({ entry, selected, showProjectTitle, showProvider, matchedElsewhere, onSelect, }: { entry: PullRequestListEntry; selected: boolean; showProjectTitle: boolean; /** Only when the list spans more than one host, where the repository alone is ambiguous. */ showProvider: boolean; /** * A search found this, but in something the row does not show — a description, a comment, a * commit message. Saying so is the difference between a result and an apparently random row. */ matchedElsewhere?: boolean; onSelect: (entry: PullRequestListEntry) => void; }) { const { Icon, providerName } = getSourceControlPresentationForKind(entry.provider); return ( ); } /** * Memoized: the list re-renders on every keystroke of a search and every status poll, and a * row whose entry, selection and match state are unchanged has nothing new to say. Effective * because the route hands it a stable `onSelect`. */ export const PullRequestRow = memo(PullRequestRowImpl);