Dashboard-Automatizase/components/ConfirmModal.tsx
Luis Erlacher 0152a2fda0 feat: add n8n API testing script for Google OAuth2 schema and existing credentials
- Implemented a bash script to test n8n API and retrieve credential schemas.
- Added types for API responses, Google Calendar, and WhatsApp instances.
- Configured Vitest for testing with React and added setup for testing-library.
2025-10-10 14:29:02 -03:00

61 lines
1.6 KiB
TypeScript

"use client";
interface ConfirmModalProps {
isOpen: boolean;
onClose: () => void;
onConfirm: () => void;
title: string;
message: string;
confirmText?: string;
cancelText?: string;
loading?: boolean;
}
export default function ConfirmModal({
isOpen,
onClose,
onConfirm,
title,
message,
confirmText = "Confirmar",
cancelText = "Cancelar",
loading = false,
}: ConfirmModalProps) {
if (!isOpen) return null;
return (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70">
<div className="bg-gray-800 border border-gray-700 rounded-lg max-w-md w-full p-6">
{/* Header */}
<h3 className="text-xl font-semibold text-white mb-4">{title}</h3>
{/* Message */}
<p className="text-gray-300 mb-6">{message}</p>
{/* Actions */}
<div className="flex gap-3 justify-end">
<button
type="button"
onClick={onClose}
disabled={loading}
className="px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded-md transition-colors disabled:opacity-50"
>
{cancelText}
</button>
<button
type="button"
onClick={onConfirm}
disabled={loading}
className="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md transition-colors disabled:opacity-50 flex items-center gap-2"
>
{loading && (
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white"></div>
)}
{confirmText}
</button>
</div>
</div>
</div>
);
}