diff --git a/src/modules/torrents/TorrentsModule.tsx b/src/modules/torrents/TorrentsModule.tsx index d81696e24..a12e4b1a2 100644 --- a/src/modules/torrents/TorrentsModule.tsx +++ b/src/modules/torrents/TorrentsModule.tsx @@ -13,7 +13,7 @@ import { import { IconDownload as Download } from '@tabler/icons'; import { useEffect, useState } from 'react'; import axios from 'axios'; -import { useViewportSize } from '@mantine/hooks'; +import { useElementSize } from '@mantine/hooks'; import { showNotification } from '@mantine/notifications'; import { NormalizedTorrent } from '@ctrl/shared-torrent'; import { useTranslation } from 'next-i18next'; @@ -34,15 +34,10 @@ export const TorrentsModule: IModule = { value: false, }, }, - padding: { - right: 0, - top: -10, - }, }; export default function TorrentsComponent() { const { config } = useConfig(); - const { height, width } = useViewportSize(); const downloadServices = config.services.filter( (service) => @@ -56,6 +51,7 @@ export default function TorrentsComponent() { const [torrents, setTorrents] = useState([]); const setSafeInterval = useSetSafeInterval(); const [isLoading, setIsLoading] = useState(true); + const { ref, width, height } = useElementSize(); const { t } = useTranslation(`modules/${TorrentsModule.id}`); @@ -112,14 +108,13 @@ export default function TorrentsComponent() { ); } - const DEVICE_WIDTH = 576; const ths = ( - + {t('card.table.header.name')} {t('card.table.header.size')} - {width > 576 ? {t('card.table.header.download')} : ''} - {width > 576 ? {t('card.table.header.upload')} : ''} - {t('card.table.header.estimatedTimeOfArrival')} + {width > 576 ? {t('card.table.header.download')} : null} + {width > 576 ? {t('card.table.header.upload')} : null} + {width > 576 ? {t('card.table.header.estimatedTimeOfArrival')} : null} {t('card.table.header.progress')} ); @@ -178,9 +173,11 @@ export default function TorrentsComponent() { ) : ( '' )} - - {torrent.eta <= 0 ? '∞' : calculateETA(torrent.eta)} - + {width > 576 ? ( + + {torrent.eta <= 0 ? '∞' : calculateETA(torrent.eta)} + + ) : null} {(torrent.progress * 100).toFixed(1)}%