import { SyntheticEvent } from 'react'; import { Button } from '../../../../ui/button'; import { Trash2, AlertTriangle } from 'lucide-react'; import { ConfigKey } from '../../../../../api'; interface ProviderSetupActionsProps { onCancel: () => void; onSubmit: (e: SyntheticEvent) => void; onDelete?: () => void; showDeleteConfirmation?: boolean; onConfirmDelete?: () => void; onCancelDelete?: () => void; canDelete?: boolean; providerName?: string; requiredParameters?: ConfigKey[]; isActiveProvider?: boolean; // Made optional with default false } /** * Renders the action buttons at the bottom of the provider modal. * Includes submit, cancel, and delete functionality with confirmation. */ export default function ProviderSetupActions({ onCancel, onSubmit, onDelete, showDeleteConfirmation, onConfirmDelete, onCancelDelete, canDelete, providerName, requiredParameters, isActiveProvider = false, // Default value provided }: ProviderSetupActionsProps) { // If we're showing delete confirmation, render the delete confirmation buttons if (showDeleteConfirmation) { // Check if this is the active provider if (isActiveProvider) { return ( <>

You cannot delete {providerName} while it's currently in use. Please switch to a different model before deleting this provider.

); } // Normal delete confirmation return ( <>

Are you sure you want to delete the configuration parameters for {providerName}? This action cannot be undone.

); } // Regular buttons (with delete if applicable) return (
{canDelete && onDelete && ( )} {requiredParameters && requiredParameters.length > 0 ? ( <> ) : ( <> )}
); }