import { Checkbox } from '@/components/ui/checkbox'; import { Label } from '@/components/ui/label'; import { Ban, CircleCheck, Trash2 } from 'lucide-react'; import { useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; type ICheckboxSetProps = { selectAllChunk: (e: any) => void; removeChunk: (e?: any) => void; switchChunk: (available: number) => void; checked: boolean; selectedChunkIds: string[]; }; export default (props: ICheckboxSetProps) => { const { selectAllChunk, removeChunk, switchChunk, checked, selectedChunkIds, } = props; const { t } = useTranslation(); const handleSelectAllCheck = useCallback( (e: any) => { console.log('eee=', e); selectAllChunk(e); }, [selectAllChunk], ); const handleDeleteClick = useCallback(() => { removeChunk(); }, [removeChunk]); const handleEnabledClick = useCallback(() => { switchChunk(1); }, [switchChunk]); const handleDisabledClick = useCallback(() => { switchChunk(0); }, [switchChunk]); const isSelected = useMemo(() => { return selectedChunkIds?.length > 0; }, [selectedChunkIds]); return (
{isSelected && ( <>
{t('chunk.enable')}
{t('chunk.disable')}
{t('chunk.delete')}
)}
); };