import type { Table } from '@tanstack/react-table' import { AnimatePresence, motion } from 'framer-motion' import { Copy, X } from 'lucide-react' import { toast } from 'sonner' import { copyToClipboard } from 'ui' import { ButtonTooltip } from '@/components/ui/ButtonTooltip' import type { AuditLog } from '@/data/organizations/organization-audit-logs-query' interface AuditLogsSelectionHeaderProps { table: Table } export const AuditLogsSelectionHeader = ({ table }: AuditLogsSelectionHeaderProps) => { const selectedRows = table.getSelectedRowModel().rows.map((row) => row.original) const hasSelection = selectedRows.length > 0 const handleCopy = () => { const text = JSON.stringify(selectedRows, null, 2) copyToClipboard(text, () => { toast.success(`Copied ${selectedRows.length} log${selectedRows.length !== 1 ? 's' : ''}`) }) } return ( {hasSelection && (

{selectedRows.length} row{selectedRows.length > 1 ? 's' : ''} selected

} className="w-7" onClick={handleCopy} tooltip={{ content: { side: 'bottom', text: 'Copy selected logs' } }} /> } className="px-1" onClick={() => table.resetRowSelection()} tooltip={{ content: { side: 'bottom', text: 'Clear selection' } }} />
)}
) }