feat: Implement exclusive selection for incoming/outgoing changes

This commit is contained in:
Sam Chau
2024-09-19 10:27:06 +09:30
parent 45872e66eb
commit c1d9ce6ef4
2 changed files with 7 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ const ChangeTable = ({
<SortableHeader sortKey='name' className='w-2/6'>
Name
</SortableHeader>
<th className='px-4 py-2 text-left text-gray-300 w-1/6'>
<th className='px-4 py-2 text-left text-gray-300 w-1/12'>
Actions
</th>
<th className='px-4 py-2 text-right text-gray-300 w-1/12'>

View File

@@ -34,6 +34,9 @@ const StatusContainer = ({
const handleSelectChange = (filePath, isIncoming) => {
if (isIncoming) {
if (selectedOutgoingChanges.length > 0) {
setSelectedOutgoingChanges([]);
}
setSelectedIncomingChanges(prevSelected => {
if (prevSelected.includes(filePath)) {
return prevSelected.filter(path => path !== filePath);
@@ -42,6 +45,9 @@ const StatusContainer = ({
}
});
} else {
if (selectedIncomingChanges.length > 0) {
setSelectedIncomingChanges([]);
}
const change = status.outgoing_changes.find(
c => c.file_path === filePath
);