import React from "react"; import { useTranslation } from "react-i18next"; import { GitCommit } from "#/api/open-hands.types"; import { I18nKey } from "#/i18n/declaration"; import { formatTimeDelta } from "#/utils/format-time-delta"; import { ChevronDown, ChevronRight } from "lucide-react"; import { useCommitChanges } from "#/hooks/query/use-commit-changes"; import { AccordionPanel } from "./accordion-panel"; import { DiffChangeList } from "./diff-change-list"; import { LoadingSpinner } from "./loading-spinner"; export interface CommitRowProps { commit: GitCommit; /** Only shown when the listed commits have more than one author. */ showAuthor: boolean; isExpanded: boolean; onToggle: () => void; } /** * One collapsible commit: header row (short SHA, subject, relative time), * expanding into the files that commit changed as a single-open accordion. */ export function CommitRow({ commit, showAuthor, isExpanded, onToggle, }: CommitRowProps) { const { t } = useTranslation("openhands"); // Only fetch a commit's file list once the row is expanded. const { data: changes, isLoading, isSuccess, } = useCommitChanges(commit.sha, { enabled: isExpanded }); return (