import { Dialog, DialogContent, DialogHeader, DialogTitle, Button } from '@/components/ui'; import { useCallback, useState } from 'react'; import { TrashIcon, ExclamationTriangleIcon } from '@heroicons/react/24/outline'; interface DeleteExchangeDialogProps { isOpen: boolean; exchangeId: string; exchangeName: string; providerMappingCount: number; onClose: () => void; onConfirmDelete: (exchangeId: string) => Promise; } export function DeleteExchangeDialog({ isOpen, exchangeId, exchangeName, providerMappingCount, onClose, onConfirmDelete, }: DeleteExchangeDialogProps) { const [loading, setLoading] = useState(false); const handleConfirm = useCallback(async () => { setLoading(true); try { const success = await onConfirmDelete(exchangeId); if (success) { onClose(); } } catch (error) { // Error deleting exchange - could add toast notification here } finally { setLoading(false); } }, [exchangeId, onConfirmDelete, onClose]); return ( Delete Exchange

Are you sure you want to delete "{exchangeName}"?

This action will:

  • Hide the exchange from all lists
  • {providerMappingCount > 0 && (
  • Delete {providerMappingCount} provider mapping{providerMappingCount !== 1 ? 's' : ''}
  • )}
  • Make provider exchanges available for remapping
{providerMappingCount > 0 && (

Warning

This exchange has {providerMappingCount} provider mapping{providerMappingCount !== 1 ? 's' : ''}. Deleting will permanently remove these mappings and make the provider exchanges available for mapping to other exchanges.

)}

Note: This action cannot be undone. The exchange will be hidden but can be restored by directly updating the database if needed.

{/* Action Buttons */}
); }