Open History to see the last commit
1import {
2 capitalizeTerm,
3 sourceControlClients,
4} from "@t3tools/client-runtime/source-control-clients";
5import { useAtomCommand } from "~/state/use-atom-command";
6import type {
7 EnvironmentId,
8 PullRequestActor,
9 PullRequestComment,
10 PullRequestDetailView,
11 PullRequestRef,
12 ScopedThreadRef,
13} from "@t3tools/contracts";
14import {
15 ChevronDownIcon,
16 CircleCheckIcon,
17 ExternalLinkIcon,
18 FileCode2Icon,
19 GitCommitHorizontalIcon,
20 MessageSquareIcon,
21} from "lucide-react";
22import { useState, type ReactNode } from "react";
23
24import { cn } from "~/lib/utils";
25import { readLocalApi } from "~/localApi";
26import { pullRequestEnvironment } from "~/state/pullRequests";
27import { RelativeTime } from "~/components/RelativeTime";
28
29import { Button } from "../ui/button";
30import { PullRequestEditButton } from "./PullRequestEditButton";
31import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "../ui/collapsible";
32import { toastManager } from "../ui/toast";
33import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
34import {
35 buildPullRequestTimeline,
36 groupPullRequestTimelineConversations,
37 type PullRequestTimelineRow,
38 isPullRequestVerdictStale,
39 newestPullRequestCommitAt,
40 pullRequestReviewOutcome,
41 type PullRequestReviewOutcome,
42 type PullRequestTimelineEvent,
43 type PullRequestTimelineThread,
44} from "./pullRequestDetail.logic";
45import { canEditPullRequestComment } from "@t3tools/client-runtime/pull-request-editing";
46import { PullRequestMarkdown } from "./PullRequestMarkdown";
47import { PullRequestMoreReplies } from "./PullRequestMoreReplies";
48import { PullRequestMarkdownEditor } from "./PullRequestMarkdownEditor";
49import { PullRequestReactionBar } from "./PullRequestReactions";
50import {
51 PullRequestActorAvatar,
52 PullRequestDiffStat,
53 PullRequestMetaLine,
54 PullRequestReviewOutcomeIcon,
55 pullRequestReviewOutcomeLabel,
56 pullRequestReviewOutcomeStaleLabel,
57 pullRequestReviewOutcomeToneClassName,
58} from "./pullRequestPresentation";
59import { PullRequestGlyph } from "./pullRequestIcons";
60import { LegendList, type LegendListRef } from "@legendapp/list/react";
61
62interface ReactionSurface {
63 readonly canReact: boolean;
64 readonly environmentId: EnvironmentId;
65 readonly threadRef: ScopedThreadRef | null;
66 readonly reference: PullRequestRef;
67 readonly onRefresh: () => void;
68}
69
70function TimelineBody({
71 body,
72 markdown,
73 cwd,
74 environmentId,
75 threadRef,
76}: {
77 body: string;
78 markdown: boolean;
79 cwd: string;
80 environmentId: EnvironmentId;
81 threadRef: ScopedThreadRef | null;
82}) {
83 return (
84 <div className="mt-3">
85 {markdown ? (
86 <PullRequestMarkdown
87 text={body}
88 cwd={cwd}
89 environmentId={environmentId}
90 threadRef={threadRef}
91 />
92 ) : (
93 <p className="whitespace-pre-wrap text-xs text-muted-foreground">{body}</p>
94 )}
95 </div>
96 );
97}
98
99function ActorName({ actor }: { actor: PullRequestActor | null }) {
100 return <span className="font-semibold text-foreground">{actor?.login ?? "ghost"}</span>;
101}
102
103function TimelineMarker({
104 children,
105 className,
106}: {
107 children: ReactNode;
108 className?: string | undefined;
109}) {
110 return (
111 <span
112 className={cn(
113 "absolute left-0 top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center bg-background",
114 className,
115 )}
116 >
117 {children}
118 </span>
119 );
120}
121
122function IconMarker({ icon, className }: { icon: ReactNode; className?: string | undefined }) {
123 return (
124 <TimelineMarker className={className}>
125 <span className="flex size-7 items-center justify-center bg-background text-muted-foreground">
126 {icon}
127 </span>
128 </TimelineMarker>
129 );
130}
131
132function ActorTimelineMarker({
133 actors,
134 className,
135 fallback,
136 muted = false,
137}: {
138 actors: ReadonlyArray<PullRequestActor>;
139 className?: string | undefined;
140 fallback: ReactNode;
141 muted?: boolean;
142}) {
143 const actor = actors[0];
144 return actor === undefined ? (
145 <IconMarker className={className} icon={fallback} />
146 ) : (
147 <TimelineMarker className={className}>
148 <PullRequestActorAvatar
149 actor={actor}
150 className={cn(
151 "size-7 bg-muted text-3xs transition-opacity",
152 muted && "opacity-45 grayscale",
153 )}
154 />
155 </TimelineMarker>
156 );
157}
158
159function friendlyReviewState(value: string): string {
160 const words = value.toLowerCase().replaceAll("_", " ").replaceAll("-", " ");
161 return words.replace(/^\w/u, (letter) => letter.toUpperCase());
162}
163
164function ReviewStateBadge({ state }: { state: string }) {
165 return (
166 <span className="text-3xs font-medium text-muted-foreground">{friendlyReviewState(state)}</span>
167 );
168}
169
170function OpenOnHostButton({ url, onOpen }: { url: string | null; onOpen: (url: string) => void }) {
171 return url === null ? null : (
172 <Button
173 size="icon-xs"
174 variant="ghost-muted"
175 className="-mr-1 shrink-0"
176 aria-label="Open activity on host"
177 onClick={() => onOpen(url)}
178 >
179 <ExternalLinkIcon className="size-3" />
180 </Button>
181 );
182}
183
184function ConversationCard({
185 event,
186 editable,
187 cwd,
188 onOpen,
189 reactions,
190 showPath = true,
191}: {
192 event: PullRequestTimelineEvent;
193 editable: PullRequestComment | null;
194 cwd: string;
195 onOpen: (url: string) => void;
196 reactions: ReactionSurface;
197 showPath?: boolean;
198}) {
199 const [editing, setEditing] = useState(false);
200 const [saving, setSaving] = useState(false);
201 const updateComment = useAtomCommand(pullRequestEnvironment.updateComment, {
202 reportFailure: false,
203 });
204
205 const save = async (body: string) => {
206 if (editable === null || saving || editable.kind === "review") return;
207 setSaving(true);
208 const result = await updateComment({
209 environmentId: reactions.environmentId,
210 input: { ...reactions.reference, commentId: editable.id, kind: editable.kind, body },
211 });
212 setSaving(false);
213 if (result._tag === "Failure") {
214 toastManager.add({ type: "error", title: "Could not save the comment" });
215 return;
216 }
217 setEditing(false);
218 reactions.onRefresh();
219 };
220
221 return (
222 <article className="group py-2">
223 <div className="px-2">
224 <div className="flex min-w-0 flex-wrap items-center gap-2">
225 <div className="min-w-0 flex-1">
226 <div className="flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs">
227 <ActorName actor={event.actor} />
228 <span className="text-muted-foreground">{event.title}</span>
229 {event.reviewState ? <ReviewStateBadge state={event.reviewState} /> : null}
230 </div>
231 <PullRequestMetaLine className="mt-1 flex-wrap text-2xs text-muted-foreground">
232 <span>
233 <RelativeTime timestamp={event.at} />
234 </span>
235 {showPath && event.path ? (
236 <span className="inline-flex min-w-0 items-center gap-1">
237 <FileCode2Icon aria-hidden className="size-3 shrink-0" />
238 <span className="truncate">{event.path}</span>
239 </span>
240 ) : null}
241 </PullRequestMetaLine>
242 </div>
243 {editable !== null && !editing ? (
244 <PullRequestEditButton aria-label="Edit comment" onClick={() => setEditing(true)} />
245 ) : null}
246 {reactions.canReact || event.reactions.length > 0 ? (
247 <PullRequestReactionBar
248 className="ml-auto justify-end"
249 reactions={event.reactions}
250 canReact={reactions.canReact}
251 subjectId={event.id}
252 environmentId={reactions.environmentId}
253 reference={reactions.reference}
254 onRefresh={reactions.onRefresh}
255 />
256 ) : null}
257 <OpenOnHostButton url={event.url} onOpen={onOpen} />
258 </div>
259 </div>
260 {editing && editable !== null ? (
261 <div className="px-2 pb-2 pt-3">
262 <PullRequestMarkdownEditor
263 value={editable.body}
264 cwd={cwd}
265 environmentId={reactions.environmentId}
266 threadRef={reactions.threadRef}
267 label="Edit comment"
268 saving={saving}
269 onSave={(body) => void save(body)}
270 onCancel={() => setEditing(false)}
271 />
272 </div>
273 ) : event.body ? (
274 <div className="px-2 pb-2">
275 <TimelineBody
276 body={event.body}
277 markdown={event.markdown}
278 cwd={cwd}
279 environmentId={reactions.environmentId}
280 threadRef={reactions.threadRef}
281 />
282 </div>
283 ) : null}
284 </article>
285 );
286}
287
288function uniqueConversationActors(events: ReadonlyArray<PullRequestTimelineEvent>) {
289 const actors = new Map<string, PullRequestActor>();
290 for (const event of events) {
291 const actor = event.actor;
292 if (actor !== null && !actors.has(actor.login)) actors.set(actor.login, actor);
293 }
294 return [...actors.values()];
295}
296
297function ConversationGroup({
298 events,
299 editable,
300 cwd,
301 onOpen,
302 reactions,
303}: {
304 events: ReadonlyArray<PullRequestTimelineEvent>;
305 editable: ReadonlyMap<string, PullRequestComment>;
306 cwd: string;
307 onOpen: (url: string) => void;
308 reactions: ReactionSurface;
309}) {
310 const [open, setOpen] = useState(false);
311 const actors = uniqueConversationActors(events);
312 const first = events[0];
313 if (first === undefined) return null;
314
315 return (
316 <div className="relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]">
317 <ActorTimelineMarker
318 actors={actors}
319 className="top-6"
320 fallback={<MessageSquareIcon className="size-3.5" />}
321 muted={!open}
322 />
323 <Collapsible open={open} onOpenChange={setOpen}>
324 <div>
325 <CollapsibleTrigger
326 className={cn(
327 "flex w-full min-w-0 items-center gap-3 py-2 text-left transition-opacity hover:opacity-100",
328 open ? "text-foreground opacity-100" : "text-muted-foreground opacity-55",
329 )}
330 >
331 <span className="min-w-0 flex-1">
332 <span className="block text-xs font-semibold">
333 {events.length.toLocaleString()} {events.length === 1 ? "comment" : "comments"}
334 </span>
335 <span className="block truncate text-3xs text-muted-foreground">
336 {actors.length.toLocaleString()} {actors.length === 1 ? "author" : "authors"} ·{" "}
337 <RelativeTime timestamp={first.at} />
338 </span>
339 </span>
340 <ChevronDownIcon
341 aria-hidden
342 className={cn(
343 "size-3.5 shrink-0 text-muted-foreground transition-transform",
344 open && "rotate-180",
345 )}
346 />
347 </CollapsibleTrigger>
348 <CollapsiblePanel>
349 {open ? (
350 <div className="mt-1 space-y-1">
351 {events.map((event) => (
352 <ConversationCard
353 // Host comment ids can collide across pull requests.
354 key={`${reactions.reference.projectId}#${reactions.reference.number}:${event.id}`}
355 event={event}
356 editable={editable.get(event.id) ?? null}
357 cwd={cwd}
358 onOpen={onOpen}
359 reactions={reactions}
360 />
361 ))}
362 </div>
363 ) : null}
364 </CollapsiblePanel>
365 </div>
366 </Collapsible>
367 </div>
368 );
369}
370
371function ReviewThreadEvent({
372 event,
373 thread,
374 editable,
375 cwd,
376 onOpen,
377 reactions,
378}: {
379 event: PullRequestTimelineEvent;
380 thread: PullRequestTimelineThread;
381 editable: ReadonlyMap<string, PullRequestComment>;
382 cwd: string;
383 onOpen: (url: string) => void;
384 reactions: ReactionSurface;
385}) {
386 const dismissed = pullRequestReviewOutcome(event.reviewState) === "dismissed";
387 const [expanded, setExpanded] = useState(!thread.isResolved && !dismissed);
388 const replyCount = thread.replies.length + thread.moreReplies;
389
390 return (
391 <div className="group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]">
392 <ActorTimelineMarker
393 actors={event.actor ? [event.actor] : []}
394 className="top-4"
395 fallback={<MessageSquareIcon className="size-3.5" />}
396 muted={!expanded}
397 />
398 <button
399 type="button"
400 className="flex w-full min-w-0 items-center gap-2 px-2 py-2 text-left text-2xs text-muted-foreground hover:text-foreground"
401 aria-expanded={expanded}
402 onClick={() => setExpanded((current) => !current)}
403 >
404 <FileCode2Icon aria-hidden className="size-3 shrink-0" />
405 <span className="min-w-0 truncate font-mono">
406 {thread.line === null ? thread.path : `${thread.path}:${thread.line}`}
407 </span>
408 {thread.isResolved ? (
409 <span className="inline-flex shrink-0 items-center gap-1 font-medium text-success-foreground">
410 <CircleCheckIcon aria-hidden className="size-3" />
411 Resolved
412 </span>
413 ) : null}
414 {dismissed ? <span className="shrink-0 font-medium">Review dismissed</span> : null}
415 {thread.isOutdated ? <span className="shrink-0 font-medium">Outdated</span> : null}
416 {expanded ? null : (
417 <span className="shrink-0">
418 · {event.actor?.login ?? "ghost"}
419 {replyCount > 0 ? (
420 <>
421 {" "}
422 · {replyCount.toLocaleString()} {replyCount === 1 ? "reply" : "replies"}
423 </>
424 ) : null}
425 </span>
426 )}
427 <ChevronDownIcon
428 aria-hidden
429 className={cn("ml-auto size-3.5 shrink-0 transition-transform", expanded && "rotate-180")}
430 />
431 </button>
432 {expanded ? (
433 <>
434 <ConversationCard
435 event={event}
436 editable={editable.get(event.id) ?? null}
437 cwd={cwd}
438 onOpen={onOpen}
439 reactions={reactions}
440 showPath={false}
441 />
442 {thread.replies.length > 0 ? (
443 <div className="ml-2 space-y-1 border-l border-border/60 pl-3">
444 {thread.replies.map((reply) => (
445 <ConversationCard
446 key={reply.id}
447 event={reply}
448 editable={editable.get(reply.id) ?? null}
449 cwd={cwd}
450 onOpen={onOpen}
451 reactions={reactions}
452 showPath={false}
453 />
454 ))}
455 </div>
456 ) : null}
457 </>
458 ) : null}
459 {thread.hasMoreReplies ? (
460 <div className="px-2">
461 <PullRequestMoreReplies {...thread} />
462 </div>
463 ) : null}
464 </div>
465 );
466}
467
468function CommitEvent({
469 event,
470 onOpen,
471}: {
472 event: PullRequestTimelineEvent;
473 onOpen: (oid: string) => void;
474}) {
475 return (
476 <button
477 type="button"
478 className="group relative mb-5 block w-full cursor-pointer rounded-sm pl-12 text-left outline-none [contain-intrinsic-block-size:48px] [content-visibility:auto] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
479 aria-label={`View commit ${event.id}`}
480 onClick={() => onOpen(event.id)}
481 >
482 <ActorTimelineMarker
483 actors={event.commitAuthors}
484 fallback={<GitCommitHorizontalIcon className="size-3.5" />}
485 />
486 <div className="flex min-w-0 items-center gap-2.5 py-1.5">
487 <div className="min-w-0 flex-1">
488 <div className="truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary">
489 {event.body ?? "Untitled commit"}
490 </div>
491 <div className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-3xs text-muted-foreground">
492 <code className="font-mono">{event.id.slice(0, 7)}</code>
493 <span>
494 <RelativeTime timestamp={event.at} />
495 </span>
496 </div>
497 </div>
498 {event.additions !== null && event.deletions !== null ? (
499 <PullRequestDiffStat
500 additions={event.additions}
501 deletions={event.deletions}
502 className="ml-auto shrink-0 font-mono text-3xs"
503 />
504 ) : null}
505 </div>
506 </button>
507 );
508}
509
510function LifecycleEvent({ event, term }: { event: PullRequestTimelineEvent; term: string }) {
511 const title = capitalizeTerm(term);
512 const presentation =
513 event.kind === "opened"
514 ? {
515 icon: <PullRequestGlyph.pullRequest className="size-3.5" />,
516 label: `${title} opened`,
517 }
518 : event.kind === "merged"
519 ? {
520 icon: <PullRequestGlyph.merged className="size-3.5" />,
521 label: `${title} merged`,
522 }
523 : {
524 icon: <PullRequestGlyph.closed className="size-3.5" />,
525 label: `${title} closed`,
526 };
527
528 return (
529 <div className="relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]">
530 <IconMarker icon={presentation.icon} />
531 <div className="py-1.5 text-xs">
532 <div className="flex flex-wrap items-center gap-1.5">
533 {event.actor ? <ActorName actor={event.actor} /> : null}
534 <span className="font-semibold text-foreground">{presentation.label}</span>
535 </div>
536 <div className="mt-0.5 text-2xs text-muted-foreground">
537 <RelativeTime timestamp={event.at} />
538 </div>
539 </div>
540 </div>
541 );
542}
543
544function ReviewVerdictEvent({
545 event,
546 outcome,
547 stale,
548 cwd,
549 onOpen,
550 reactions,
551}: {
552 event: PullRequestTimelineEvent;
553 outcome: PullRequestReviewOutcome;
554 stale: boolean;
555 cwd: string;
556 onOpen: (url: string) => void;
557 reactions: ReactionSurface;
558}) {
559 return (
560 <div className="group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]">
561 <ActorTimelineMarker
562 actors={event.actor ? [event.actor] : []}
563 className="top-6"
564 fallback={<PullRequestReviewOutcomeIcon outcome={outcome} />}
565 />
566 <div className="flex min-w-0 flex-wrap items-center gap-2 py-1.5">
567 <div className="min-w-0 flex-1">
568 <div className="flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs">
569 <ActorName actor={event.actor} />
570 <Tooltip disabled={!stale}>
571 <TooltipTrigger
572 render={
573 <span
574 className={cn(
575 "font-medium lowercase",
576 stale
577 ? "text-muted-foreground opacity-70"
578 : pullRequestReviewOutcomeToneClassName(outcome),
579 )}
580 />
581 }
582 >
583 {pullRequestReviewOutcomeLabel(outcome)}
584 {stale ? <span className="sr-only">, before the latest commits</span> : null}
585 </TooltipTrigger>
586 <TooltipPopup>{pullRequestReviewOutcomeStaleLabel(outcome)}</TooltipPopup>
587 </Tooltip>
588 </div>
589 <div className="mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
590 <PullRequestMetaLine className="flex-wrap text-2xs text-muted-foreground">
591 <span>
592 <RelativeTime timestamp={event.at} />
593 </span>
594 {event.path ? (
595 <span className="inline-flex min-w-0 items-center gap-1">
596 <FileCode2Icon aria-hidden className="size-3 shrink-0" />
597 <span className="truncate">{event.path}</span>
598 </span>
599 ) : null}
600 </PullRequestMetaLine>
601 </div>
602 </div>
603 {reactions.canReact || event.reactions.length > 0 ? (
604 <PullRequestReactionBar
605 className="ml-auto justify-end"
606 reactions={event.reactions}
607 canReact={reactions.canReact}
608 subjectId={event.id}
609 environmentId={reactions.environmentId}
610 reference={reactions.reference}
611 onRefresh={reactions.onRefresh}
612 />
613 ) : null}
614 <OpenOnHostButton url={event.url} onOpen={onOpen} />
615 </div>
616 {event.body ? (
617 <TimelineBody
618 body={event.body}
619 markdown={event.markdown}
620 cwd={cwd}
621 environmentId={reactions.environmentId}
622 threadRef={reactions.threadRef}
623 />
624 ) : null}
625 </div>
626 );
627}
628
629export function PullRequestTimelineTab({
630 scrollerRef,
631 detail,
632 environmentId,
633 threadRef = null,
634 reference,
635 order,
636 onOpenCommit,
637 onRefresh,
638}: {
639 scrollerRef: (node: HTMLElement | null) => void;
640 detail: PullRequestDetailView;
641 environmentId: EnvironmentId;
642 threadRef?: ScopedThreadRef | null;
643 reference: PullRequestRef;
644 order: "newest" | "oldest";
645 onOpenCommit: (oid: string) => void;
646 onRefresh: () => void;
647}) {
648 const events = buildPullRequestTimeline(detail);
649 const term = sourceControlClients.get(detail.provider).changeRequest.singular;
650 const newestCommitAt = newestPullRequestCommitAt(detail.commits);
651 const reactions: ReactionSurface = {
652 canReact: detail.capabilities.reactions === true,
653 environmentId,
654 threadRef,
655 reference,
656 onRefresh,
657 };
658 const editable = new Map(
659 events
660 .flatMap((event) => [event, ...(event.thread?.replies ?? [])])
661 .flatMap((event) => (event.comment ? [event.comment] : []))
662 .filter((comment) => canEditPullRequestComment(detail, comment))
663 .map((comment) => [comment.id, comment] as const),
664 );
665 const orderedEvents = order === "newest" ? events : events.toReversed();
666 const rows = groupPullRequestTimelineConversations(orderedEvents);
667 const openOnHost = (url: string) => {
668 void readLocalApi()?.shell.openExternal(url);
669 };
670
671 const rowKey = (row: PullRequestTimelineRow) => {
672 if (row.kind === "comments") return `comments:${row.events[0]?.id ?? "empty"}`;
673 const event = row.event;
674 // A thread's resolution or dismissal remounts it, so its disclosure starts in the new state.
675 return event.thread === undefined
676 ? event.id
677 : `thread:${event.id}:${event.thread.isResolved}:${pullRequestReviewOutcome(event.reviewState) === "dismissed"}`;
678 };
679 const renderRow = ({ item: row }: { item: PullRequestTimelineRow }) => {
680 if (row.kind === "comments") {
681 return (
682 <ConversationGroup
683 events={row.events}
684 editable={editable}
685 cwd={detail.workspaceRoot}
686 onOpen={openOnHost}
687 reactions={reactions}
688 />
689 );
690 }
691 const event = row.event;
692 if (event.thread !== undefined) {
693 return (
694 <ReviewThreadEvent
695 event={event}
696 thread={event.thread}
697 editable={editable}
698 cwd={detail.workspaceRoot}
699 onOpen={openOnHost}
700 reactions={reactions}
701 />
702 );
703 }
704 if (event.kind === "commit") return <CommitEvent event={event} onOpen={onOpenCommit} />;
705 const outcome = pullRequestReviewOutcome(event.reviewState);
706 if (outcome !== null) {
707 return (
708 <ReviewVerdictEvent
709 event={event}
710 outcome={outcome}
711 stale={isPullRequestVerdictStale(event.at, newestCommitAt)}
712 cwd={detail.workspaceRoot}
713 onOpen={openOnHost}
714 reactions={reactions}
715 />
716 );
717 }
718 return <LifecycleEvent event={event} term={term} />;
719 };
720
721 if (events.length === 0) {
722 return (
723 <div ref={scrollerRef} className="scrollbar-gutter-both h-full overflow-y-auto px-4 py-5">
724 <div className="flex flex-col items-center justify-center py-16 text-center text-muted-foreground">
725 <PullRequestGlyph.pullRequest className="mb-2 size-5" />
726 <p className="text-xs">No activity yet.</p>
727 </div>
728 </div>
729 );
730 }
731
732 // Virtualized: a large pull request has thousands of events, and mounting every one stalls
733 // the page. The connector line is drawn by the content container, behind the rows.
734 return (
735 <LegendList<PullRequestTimelineRow>
736 ref={(list: LegendListRef | null) => scrollerRef(list?.getScrollableNode() ?? null)}
737 data={rows}
738 extraData={{ editable, reactions, newestCommitAt }}
739 keyExtractor={rowKey}
740 renderItem={renderRow}
741 estimatedItemSize={140}
742 className="scrollbar-gutter-both h-full px-4"
743 contentContainerClassName="relative mx-auto w-full max-w-3xl before:absolute before:bottom-10 before:left-[15px] before:top-6 before:w-px before:bg-border/45"
744 ListHeaderComponent={<div className="h-5" />}
745 ListFooterComponent={<div className="h-5" />}
746 />
747 );
748}