import DeleteIcon from '@mui/icons-material/Delete' import DownloadIcon from '@mui/icons-material/Download' import DownloadDoneIcon from '@mui/icons-material/DownloadDone' import FileDownloadIcon from '@mui/icons-material/FileDownload' import SmartDisplayIcon from '@mui/icons-material/SmartDisplay' import StopCircleIcon from '@mui/icons-material/StopCircle' import { Box, ButtonGroup, IconButton, LinearProgress, LinearProgressProps, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography } from "@mui/material" import { useRecoilValue } from 'recoil' import { activeDownloadsState } from '../atoms/downloads' import { serverURL } from '../atoms/settings' import { useRPC } from '../hooks/useRPC' import { base64URLEncode, formatSize, formatSpeedMiB } from "../utils" function LinearProgressWithLabel(props: LinearProgressProps & { value: number }) { return ( {`${Math.round( props.value, )}%`} ) } const DownloadsTableView: React.FC = () => { const serverAddr = useRecoilValue(serverURL) const downloads = useRecoilValue(activeDownloadsState) const { client } = useRPC() const abort = (id: string) => client.kill(id) const viewFile = (path: string) => { const encoded = base64URLEncode(path) window.open(`${serverAddr}/archive/v/${encoded}?token=${localStorage.getItem('token')}`) } const downloadFile = (path: string) => { const encoded = base64URLEncode(path) window.open(`${serverAddr}/archive/d/${encoded}?token=${localStorage.getItem('token')}`) } return ( ) } export default DownloadsTableView