Show torrents when requested in fields

This commit is contained in:
Diogo Silva 2022-12-24 02:48:33 +01:00
parent 2f8ce4174d
commit e9aeed1f92

View File

@ -137,7 +137,7 @@ export default function Component({ service }) {
} }
const leech = torrentData.length - completed; const leech = torrentData.length - completed;
const torrentsEnabled = service.widget.fields === null || service.widget.fields?.includes('torrents');
return ( return (
<> <>
<Container service={service}> <Container service={service}>
@ -146,7 +146,7 @@ export default function Component({ service }) {
<Block label="qbittorrent.seed" value={t("common.number", { value: completed })} /> <Block label="qbittorrent.seed" value={t("common.number", { value: completed })} />
<Block label="qbittorrent.upload" value={t("common.byterate", { value: rateUl, decimals: 1 })} /> <Block label="qbittorrent.upload" value={t("common.byterate", { value: rateUl, decimals: 1 })} />
</Container> </Container>
<div className={service.widget.fields?.includes('torrents') ? "flex flex-col w-full p-1" : "hidden"}> <div className={torrentsEnabled ? "flex flex-col w-full p-1" : "hidden"}>
{torrentData.map((torrent) => ( {torrentData.map((torrent) => (
<TorrentEntry key={torrent.Id} torrent={torrent} /> <TorrentEntry key={torrent.Id} torrent={torrent} />
))} ))}