import { Box, Button, Divider, LinearProgress, Skeleton, Typography } from "@mui/material"; import React from "react"; import useStore from "../../../hooks/useStore"; import useDownloadManager from "../DownloadManager/DownloadManager"; const Queue: React.FC = () => { const data = useDownloadManager(); const [{ queue, currentDownload }, dispatch] = useStore(); return data || queue.length > 0 ? <> {data && <> Thumbnail {data.downloadInfo.title} Language: {data.downloadInfo.language.name} {data.downloadInfo.parent.title} {data.progress.cur} / {(data.progress.total)} parts ({data.progress.percent}% | {formatTime(data.progress.time)} | {(data.progress.downloadSpeed / 1024 / 1024).toFixed(2)} MB/s | {(data.progress.bytes / 1024 / 1024).toFixed(2)}MB) } { !data && currentDownload && <> Thumbnail {currentDownload.title} Languages: {currentDownload.dubLang} {currentDownload.parent.title} Waiting for download to start } {queue.length && data && } {queue.map((queueItem, index, { length }) => { return Thumbnail {queueItem.title} Languages: {queueItem.dubLang.join(', ')} {queueItem.parent.title} S{queueItem.parent.season}E{queueItem.episode}
Quality: {queueItem.q}
{index < length - 1 && }
; })} : Selected episodes will be shown here } const formatTime = (time: number) => { time = Math.floor(time / 1000); const minutes = Math.floor(time / 60); time = time % 60; return `${minutes.toFixed(0).length < 2 ? `0${minutes}` : minutes}m${time.toFixed(0).length < 2 ? `0${time}` : time}s`; } export default Queue;