import React from 'react'; import {ArrowDown, ArrowUp} from 'lucide-react'; import ChangeRow from './ChangeRow'; const ChangeTable = ({ changes, title, icon, isIncoming, selectedChanges, onSelectChange, sortConfig, onRequestSort, isDevMode }) => { const sortedChanges = changesArray => { if (!sortConfig.key) return changesArray; return [...changesArray].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 ( onRequestSort(sortKey)}>
{children} {isSorted && (sortConfig.direction === 'ascending' ? ( ) : ( ))}
); }; return (

{icon} {isIncoming ? title : isDevMode ? 'Outgoing Changes' : 'Local Changes'}{' '} ({changes.length})

Status Type Name {sortedChanges(changes).map((change, index) => ( onSelectChange(filePath, isIncoming) } isIncoming={isIncoming} isDevMode={isDevMode} /> ))}
Actions Select
); }; export default ChangeTable;