import { BulkCategorySelect } from '@/components/transactions/bulk-category-select'; import { BulkLabelSelect } from '@/components/transactions/bulk-label-select'; import { Button } from '@/components/ui/button'; import { ButtonGroup } from '@/components/ui/button-group'; import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip'; import { isAdmin } from '@/hooks/use-admin'; import { type Category } from '@/types/category'; import { type Label } from '@/types/label'; import { __ } from '@/utils/i18n'; import { CheckCheck, MoreHorizontal, Trash2, WandSparkles, X, } from 'lucide-react'; interface BulkActionsBarProps { selectedCount: number; totalFilteredCount?: number; isSelectingAll?: boolean; categories: Category[]; labels: Label[]; onCategoryChange: (categoryId: number | null) => void; onLabelsChange: (labelIds: string[]) => void; onDelete: () => void; onReEvaluateRules: () => void; onSelectAll?: () => void; onClear: () => void; isUpdating?: boolean; } export function BulkActionsBar({ selectedCount, totalFilteredCount, isSelectingAll = false, categories, labels, onCategoryChange, onLabelsChange, onDelete, onReEvaluateRules, onSelectAll, onClear, isUpdating = false, }: BulkActionsBarProps) { if (selectedCount < 1) { return null; } const isDeleteEnabled = isAdmin(); const displayCount = isSelectingAll ? totalFilteredCount : selectedCount; const canSelectAll = !isSelectingAll && totalFilteredCount && selectedCount < totalFilteredCount && onSelectAll; return (
{isSelectingAll ? ( <> {__('All')} {displayCount} transaction {displayCount !== 1 ? 's' : ''} selected ) : ( <> {displayCount} transaction {displayCount !== 1 ? 's' : ''} selected )} {canSelectAll && ( <> {__('Select all')} {totalFilteredCount}{' '} {__( 'transactions matching current filter', )} )}
{__('Re-evaluate rules')} {isDeleteEnabled && ( {__('Delete')} )}
); }