'use client'; import Button from '@/components/Button'; import Tooltip from '@/components/Tooltip'; import { cn } from '@/lib/helper'; import { Icon } from '@iconify/react'; import { useAuth } from '@/services/hooks/useAuth'; type FloatingActionsButtonProps = { actions: { action: 'DETAIL' | 'EDIT' | 'DELETE'; icon: string; label?: string; onClick?: () => void; hidden?: boolean; disabled?: boolean; permissions?: string | string[]; }[]; approvals: { action: 'APPROVED' | 'REJECTED'; icon: string; label?: string; onClick?: () => void; disabled?: boolean; permissions?: string | string[]; }[]; selectedRowIds: number[]; onClose: () => void; }; const FloatingActionsButton = ({ actions, approvals, selectedRowIds, onClose, }: FloatingActionsButtonProps) => { const { permissionCheck } = useAuth(); // Jika tidak ada baris yang dipilih, jangan tampilkan FAB const positionStyles = selectedRowIds.length > 0 ? 'bottom-[5%] opacity-100' : 'bottom-[-5%] opacity-0'; // 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