import { Layers, Check, AlertTriangle, Square, CheckSquare } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import type { PlateSelectorProps } from './types'; import { formatDuration } from '../../utils/date'; import { withStreamToken } from '../../api/client'; /** * Plate selection grid for multi-plate 3MF files. * Shows thumbnails, names, objects, and print times for each plate. * In multi-select mode (add-to-queue), plates have checkboxes for selecting a subset. * In single-select mode (reprint/edit), only one plate can be selected at a time. */ export function PlateSelector({ plates, isMultiPlate, selectedPlates, onToggle, onSelectAll, onDeselectAll, multiSelect, }: PlateSelectorProps) { const { t } = useTranslation(); // Only show for multi-plate files with multiple plates if (!isMultiPlate || plates.length <= 1) { return null; } const allSelected = selectedPlates.size === plates.length; return (
Select Plate{multiSelect ? 's' : ''} to Print {selectedPlates.size === 0 && ( Selection required )} {multiSelect && onSelectAll && onDeselectAll && ( )}
{plates.map((plate) => { const isSelected = selectedPlates.has(plate.index); return ( ); })}
); }