'use client'; import { cn } from '@/lib/helper'; import { Icon } from '@iconify/react'; type FloatingActionsButtonProps = { actions: { action: 'DETAIL' | 'EDIT' | 'DELETE'; icon: string; label?: string; onClick?: () => void; hidden?: boolean; }[]; approvals: { action: 'APPROVED' | 'REJECTED'; icon: string; label?: string; onClick?: () => void; }[]; selectedRowIds: number[]; onClose: () => void; }; const FloatingActionsButton = ({ actions, approvals, selectedRowIds, onClose, }: FloatingActionsButtonProps) => { // Jika tidak ada baris yang dipilih, jangan tampilkan FAB const positionStyles = selectedRowIds.length > 0 ? 'bottom-[10%]' : 'bottom-[-100%]'; // Helper untuk menentukan gaya warna tombol approval const getApprovalColor = (action: 'APPROVED' | 'REJECTED') => { if (action === 'APPROVED') return 'success'; if (action === 'REJECTED') return 'error'; return 'primary'; }; const getActionColor = (action: 'DETAIL' | 'EDIT' | 'DELETE') => { if (action === 'DETAIL') return 'white'; if (action === 'EDIT') return 'warning'; if (action === 'DELETE') return 'error'; return 'primary'; }; return ( // Container utama FAB
{/* === BARIS ATAS: Status Seleksi dan Actions (Termasuk Close) === */}

{selectedRowIds.length} Selected

{/* Render Aksi dari props.actions */} {actions .filter((action) => !action.hidden) .map((action, index) => { return ( ); })}
{/* Tombol Close */}
{/* === BARIS BAWAH: Approval Buttons (Approve/Reject) === */}
{approvals.map((approval, index) => ( ))}
); }; export default FloatingActionsButton;