import React, { memo } from 'react'; import type { DownloadQueueItem } from '../types'; import DownloadQueueItemComponent from './DownloadQueueItem'; interface DownloadQueueStatusProps { geId: string; // Deprecated - kept for backward compatibility queue: DownloadQueueItem[]; onCancelJob: (jobId: string) => void; downloadingFilesCount?: number; // Số file đang downloading thực tế } const DownloadQueueStatus: React.FC = ({ queue, onCancelJob, downloadingFilesCount = 0 }) => { // Queue items are already sorted by created_at DESC in App.tsx (convertToQueueItems) // Newest batches are already at the top, so we just use the queue as-is const sortedQueue = React.useMemo( () => queue, [queue] ); const showDetails = sortedQueue.length > 0; const waitingCount = sortedQueue.filter(q => q.status === 'waiting' || q.status === 'pending').length; return (

Hàng đợi và Trạng thái

{downloadingFilesCount > 0 && (
{downloadingFilesCount} tệp đang tải
)} {waitingCount > 0 && (
{waitingCount} đang chờ
)}
{showDetails ? (
{sortedQueue.map((item, index) => ( ))}
) : (

Không có job nào đang xử lý.

)}
); }; export default memo(DownloadQueueStatus);