import React from "react"; import dayjs from "dayjs"; import prettyBytes from "pretty-bytes"; export const TorrentDownloads = (props) => { const { data } = props; console.log(Object.values(data)); return ( <> {data.map(({ torrent }) => { return (
{torrent.hash}
Added on {dayjs.unix(torrent.added_on).format("ddd, D MMM, YYYY")}
{torrent.progress > 0 ? ( <> {Math.floor(torrent.progress * 100)}% {/* downloaded/left */}
{prettyBytes(torrent.downloaded)} {/* uploaded */} {prettyBytes(torrent.uploaded)}
> ) : null}