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) => {
|
async (mappingId: string, currentStatus: boolean) => {
|
||||||
const success = await updateProviderMapping(mappingId, { active: !currentStatus });
|
const success = await updateProviderMapping(mappingId, { active: !currentStatus });
|
||||||
if (success) {
|
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();
|
refetch();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -298,13 +312,13 @@ export function ExchangesTable() {
|
||||||
{
|
{
|
||||||
id: 'actions',
|
id: 'actions',
|
||||||
header: 'Actions',
|
header: 'Actions',
|
||||||
size: 140,
|
size: 160,
|
||||||
disableTooltip: true,
|
disableTooltip: true,
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => (
|
||||||
<div className="flex gap-1">
|
<div className="flex gap-1">
|
||||||
<button
|
<button
|
||||||
onClick={() => handleAddProviderMapping(row.original.id, row.original.name)}
|
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"
|
title="Add Provider Mapping"
|
||||||
>
|
>
|
||||||
<PlusIcon className="h-3 w-3" />
|
<PlusIcon className="h-3 w-3" />
|
||||||
|
|
@ -312,7 +326,7 @@ export function ExchangesTable() {
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => handleDeleteExchange(row.original.id, row.original.name)}
|
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"
|
title="Delete Exchange"
|
||||||
>
|
>
|
||||||
<TrashIcon className="h-3 w-3" />
|
<TrashIcon className="h-3 w-3" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue