import { ChevronRight, Trash2 } from 'lucide-react'; import DiffViewer from '../../../DiffViewer.jsx'; import type { FileStatusCode } from '../../types/types'; import { getStatusBadgeClass, getStatusLabel } from '../../utils/gitPanelUtils'; type DiffViewerProps = { diff: string; fileName: string; isMobile: boolean; wrapText: boolean; }; const DiffViewerComponent = DiffViewer as unknown as (props: DiffViewerProps) => JSX.Element; type FileChangeItemProps = { filePath: string; status: FileStatusCode; isMobile: boolean; isExpanded: boolean; isSelected: boolean; diff?: string; wrapText: boolean; onToggleSelected: (filePath: string) => void; onToggleExpanded: (filePath: string) => void; onOpenFile: (filePath: string) => void; onToggleWrapText: () => void; onRequestFileAction: (filePath: string, status: FileStatusCode) => void; }; export default function FileChangeItem({ filePath, status, isMobile, isExpanded, isSelected, diff, wrapText, onToggleSelected, onToggleExpanded, onOpenFile, onToggleWrapText, onRequestFileAction, }: FileChangeItemProps) { const statusLabel = getStatusLabel(status); const badgeClass = getStatusBadgeClass(status); return (
onToggleSelected(filePath)} onClick={(event) => event.stopPropagation()} className={`rounded border-border text-primary focus:ring-primary/40 bg-background checked:bg-primary ${isMobile ? 'mr-1.5' : 'mr-2'}`} />
{ event.stopPropagation(); onOpenFile(filePath); }} title="Click to open file" > {filePath} {(status === 'M' || status === 'D' || status === 'U') && ( )} {status}
{status} {statusLabel} {isMobile && ( )}
{diff && }
); }