import Swal from 'sweetalert2'; import 'sweetalert2/dist/sweetalert2.min.css'; const Toast = Swal.mixin({ toast: true, position: 'top-end', showConfirmButton: false, timer: 3000, timerProgressBar: true, }); export const swalSuccess = (title: string, text?: string) => { return Toast.fire({ icon: 'success', title, text, customClass: { popup: '!rounded-[2rem] font-sans px-6' } }); }; export const swalError = (title: string, text?: string) => { return Toast.fire({ icon: 'error', title, text, customClass: { popup: '!rounded-[2rem] font-sans px-6' } }); }; export const swalConfirm = (title: string, text: string, confirmText: string = 'Yes, proceed') => { return Swal.fire({ title, text, icon: 'warning', showCancelButton: true, confirmButtonText: confirmText, cancelButtonText: 'Cancel', reverseButtons: true, buttonsStyling: false, customClass: { popup: '!rounded-[3rem] border-none shadow-2xl font-sans p-10', title: 'text-xl font-bold text-[#3D4E4B] tracking-tight', htmlContainer: 'text-sm font-medium text-gray-500 tracking-tight leading-relaxed', confirmButton: 'px-10 py-3.5 bg-[#3D4E4B] text-white text-sm font-bold tracking-tight rounded-full hover:bg-[#2D3A38] transition-all ml-3 shadow-lg shadow-[#3D4E4B]/20', cancelButton: 'px-10 py-3.5 bg-white text-[#3D4E4B] border border-gray-100 text-sm font-bold tracking-tight rounded-full hover:bg-gray-50 transition-all', actions: 'mt-8' }, }); }; export const swalConfirmDelete = (itemName: string) => { return Swal.fire({ title: `Delete ${itemName}?`, text: 'This action is irreversible. All data assets will be permanently purged.', icon: 'error', showCancelButton: true, confirmButtonText: 'Yes, delete', cancelButtonText: 'Cancel', reverseButtons: true, buttonsStyling: false, customClass: { popup: '!rounded-[3rem] border-none shadow-2xl font-sans p-10', title: 'text-xl font-bold text-[#3D4E4B] tracking-tight', htmlContainer: 'text-sm font-medium text-gray-500 tracking-tight leading-relaxed', confirmButton: 'px-10 py-3.5 bg-red-600 text-white text-sm font-bold tracking-tight rounded-full hover:bg-red-700 transition-all ml-3 shadow-lg shadow-red-500/20', cancelButton: 'px-10 py-3.5 bg-white text-[#3D4E4B] border border-gray-200 text-sm font-bold tracking-tight rounded-full hover:bg-gray-50 transition-all', actions: 'mt-8' }, }); }; // Legacy compatibility object export const swal = { success: swalSuccess, error: swalError, confirm: swalConfirm, confirmDelete: swalConfirmDelete }; export default swal;