a bit more work on exchanges
This commit is contained in:
parent
93542667e6
commit
6a34d1140f
1 changed files with 17 additions and 3 deletions
|
|
@ -62,6 +62,20 @@ export function ExchangesTable() {
|
|||
async (mappingId: string, currentStatus: boolean) => {
|
||||
const success = await updateProviderMapping(mappingId, { active: !currentStatus });
|
||||
if (success) {
|
||||
// Update the local expanded row data immediately
|
||||
setExpandedRowData(prev => {
|
||||
const updated = { ...prev };
|
||||
Object.keys(updated).forEach(exchangeId => {
|
||||
updated[exchangeId] = updated[exchangeId].map(mapping =>
|
||||
mapping.id === mappingId
|
||||
? { ...mapping, active: !currentStatus }
|
||||
: mapping
|
||||
);
|
||||
});
|
||||
return updated;
|
||||
});
|
||||
|
||||
// Also refresh the main table data
|
||||
refetch();
|
||||
}
|
||||
},
|
||||
|
|
@ -298,13 +312,13 @@ export function ExchangesTable() {
|
|||
{
|
||||
id: 'actions',
|
||||
header: 'Actions',
|
||||
size: 140,
|
||||
size: 160,
|
||||
disableTooltip: true,
|
||||
cell: ({ row }) => (
|
||||
<div className="flex gap-1">
|
||||
<button
|
||||
onClick={() => handleAddProviderMapping(row.original.id, row.original.name)}
|
||||
className="inline-flex items-center gap-1 px-2 py-1 bg-primary-500/20 text-primary-400 rounded text-xs hover:bg-primary-500/30 transition-colors"
|
||||
className="inline-flex items-center gap-1 px-3 py-1.5 bg-primary-500/20 text-primary-400 rounded text-xs hover:bg-primary-500/30 transition-colors whitespace-nowrap"
|
||||
title="Add Provider Mapping"
|
||||
>
|
||||
<PlusIcon className="h-3 w-3" />
|
||||
|
|
@ -312,7 +326,7 @@ export function ExchangesTable() {
|
|||
</button>
|
||||
<button
|
||||
onClick={() => handleDeleteExchange(row.original.id, row.original.name)}
|
||||
className="inline-flex items-center gap-1 px-2 py-1 bg-danger/20 text-danger rounded text-xs hover:bg-danger/30 transition-colors"
|
||||
className="inline-flex items-center gap-1 px-3 py-1.5 bg-danger/20 text-danger rounded text-xs hover:bg-danger/30 transition-colors whitespace-nowrap"
|
||||
title="Delete Exchange"
|
||||
>
|
||||
<TrashIcon className="h-3 w-3" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue