'use client' import type { ReactNode } from 'react' import { Toolbar } from '@heroui/react' import type { Selection } from '@/types/heroui' import Button from '@/components/formElements/Button' import AngleDownIcon from '@/components/icons/AngleDownIcon' interface Props { activeFilterCount: number backBtnUrl?: string bulkActions?: ReactNode dynamicButtonText: string dynamicTopSection?: ReactNode hasDynamicButton?: boolean hasFilters: boolean selectedKeys: Selection selectionMode: 'single' | 'multiple' | 'none' onBack: (url: string) => void onDynamicButtonClick?: () => void onOpenFilters: () => void onClearSelection: () => void } export default function PaginatedListToolbar({ activeFilterCount, backBtnUrl, bulkActions, dynamicButtonText, dynamicTopSection, hasDynamicButton, hasFilters, selectedKeys, selectionMode, onBack, onDynamicButtonClick, onOpenFilters, onClearSelection, }: Props) { const hasSelection = selectionMode !== 'none' && (selectedKeys === 'all' || selectedKeys.size > 0) const hasDesktopToolbarContent = Boolean(backBtnUrl || dynamicTopSection || hasDynamicButton || hasSelection) const hasToolbarContent = hasDesktopToolbarContent || hasFilters || hasSelection if (!hasToolbarContent) return null return (
{backBtnUrl ? (
) : null}
{hasSelection ? (
{selectedKeys === 'all' ? 'همه سطرها انتخاب شده‌اند' : `${selectedKeys.size.toLocaleString('fa-IR')} سطر انتخاب شده`} {bulkActions}
) : null} {hasFilters ? ( ) : null} {dynamicTopSection} {hasDynamicButton && }
) }