import React from 'react' import { Paper, Typography, Button, List, ListItem, ListItemText, IconButton, Divider } from '@mui/material' import { Download, FolderZip } from '@mui/icons-material' import { useTaskStore } from '../stores/taskStore' import { getDownloadZipUrl } from '../api/client' import { formatFileSize } from '../utils/formatters' export const DownloadSection: React.FC = () => { const { taskId, tracks, status } = useTaskStore() console.log('[DownloadSection] Rendering:', { status, tracks, taskId }) // Check if we should show the download section if (status !== 'done' || !tracks || tracks.length === 0 || !taskId) { return null } // If we get here, we have tracks console.log('[DownloadSection] Showing tracks:', tracks) const handleDownloadZip = () => { const url = getDownloadZipUrl(taskId) window.open(url, '_blank') } const handleDownloadTrack = (filename: string) => { const url = `/api/download/${taskId}/${filename}` window.open(url, '_blank') } return ( 📥 Download Results Individual Tracks {tracks.map((track, index) => ( handleDownloadTrack(track.filename)} size="small"> } > ))} ) }