import React from 'react'; import {ArrowDown, ArrowUp} from 'lucide-react'; import ChangeRow from './ChangeRow'; import ConflictRow from './ConflictRow'; const ChangeTable = ({ changes, isIncoming, isMergeConflict, selectedChanges, willBeSelected, onSelectChange, onMouseEnter, onMouseLeave, sortConfig, onRequestSort, fetchGitStatus }) => { const sortedChanges = changesArray => { // Process changes to extract type from path for unknown types const processedChanges = changesArray.map(change => { if (!change) return change; // Only process items with unknown type if (change.type?.toLowerCase() === 'unknown' && change.file_path) { // Extract type from file path (assuming format: "type/name") const pathParts = change.file_path.split('/'); if (pathParts.length > 1) { return { ...change, type: pathParts[0] }; } } return change; }); if (isMergeConflict || !sortConfig?.key) return processedChanges; return [...processedChanges].sort((a, b) => { if (a[sortConfig.key] < b[sortConfig.key]) { return sortConfig.direction === 'ascending' ? -1 : 1; } if (a[sortConfig.key] > b[sortConfig.key]) { return sortConfig.direction === 'ascending' ? 1 : -1; } return 0; }); }; const SortableHeader = ({children, sortKey, className}) => { const isSorted = sortConfig.key === sortKey; return (
| Actions |
|---|