"use client"; import { useState } from "react"; import { IconChevronDown, IconChevronRight, IconGitPullRequest } from "@tabler/icons-react"; import { LineStat } from "@/components/diff-stat"; import { FileStatusIcon } from "./file-status-icon"; import { groupByRepositoryName } from "@/lib/group-by-repo"; import type { PRChangedFile } from "./changes-panel-timeline"; type PRFilesSectionContentProps = { files: PRChangedFile[]; onOpenDiff: (path: string) => void; /** Maps a repository_name to a human-readable label for the per-repo header. */ repoDisplayName?: (repositoryName: string) => string | undefined; }; /** * Body of the PR Changes section: groups files by `repository_name` so * multi-repo tasks render one sub-header per repo, mirroring the Commits * and Changes sections. Single-repo tasks (one group with empty name) * render the file list flat — the section header is enough. */ export function PRFilesGroupedList({ files, onOpenDiff, repoDisplayName, }: PRFilesSectionContentProps) { const groups = groupByRepositoryName(files, (f) => f.repository_name); const showRepoHeaders = groups.length > 1 || (groups[0]?.repositoryName ?? "") !== ""; return (