diff --git a/src/modules/scheduling/SuggestionDetail.tsx b/src/modules/scheduling/SuggestionDetail.tsx index 172167b..19b17e3 100644 --- a/src/modules/scheduling/SuggestionDetail.tsx +++ b/src/modules/scheduling/SuggestionDetail.tsx @@ -28,7 +28,7 @@ function fmtRate(rate: number): string { export default function SuggestionDetail({ suggestion: s, onClose, onNotifySuccess }: Props) { const [previewCandidate, setPreviewCandidate] = useState(null); const [sentPlates, setSentPlates] = useState>(new Set()); - const [batchFilter, setBatchFilter] = useState(''); + const [batchFilter, setBatchFilter] = useState>(new Set()); const [sortKey, setSortKey] = useState('predicted'); const [sortDir, setSortDir] = useState('desc'); @@ -45,7 +45,7 @@ export default function SuggestionDetail({ suggestion: s, onClose, onNotifySucce // Filtered + sorted candidates const displayCandidates = useMemo(() => { let list = s.candidates; - if (batchFilter) list = list.filter(c => c.targetName === batchFilter); + if (batchFilter.size > 0) list = list.filter(c => c.targetName != null && batchFilter.has(c.targetName)); return [...list].sort((a, b) => { const va = sortKey === 'predicted' ? a.predictedAfterSwap : a.totalMileage; const vb = sortKey === 'predicted' ? b.predictedAfterSwap : b.totalMileage; @@ -164,15 +164,35 @@ export default function SuggestionDetail({ suggestion: s, onClose, onNotifySucce {/* Filter + Sort controls */}
- {/* Batch filter */} - + {/* Batch multi-select pills */} +
+ + {batchOptions.map(b => { + const active = batchFilter.has(b); + return ( + + ); + })} +
{/* Sort buttons */}