diff --git a/src/modules/torrents/TorrentsModule.tsx b/src/modules/torrents/TorrentsModule.tsx index c7d3d5beb..a8e48a9d6 100644 --- a/src/modules/torrents/TorrentsModule.tsx +++ b/src/modules/torrents/TorrentsModule.tsx @@ -8,6 +8,7 @@ import { Skeleton, ScrollArea, Center, + Stack, } from '@mantine/core'; import { IconDownload as Download } from '@tabler/icons'; import { useEffect, useState } from 'react'; @@ -15,6 +16,7 @@ import axios from 'axios'; import { useViewportSize } from '@mantine/hooks'; import { showNotification } from '@mantine/notifications'; import { NormalizedTorrent } from '@ctrl/shared-torrent'; +import { useTranslation } from 'next-i18next'; import { IModule } from '../ModuleTypes'; import { useConfig } from '../../tools/state'; import { AddItemShelfButton } from '../../components/AppShelf/AddAppShelfItem'; @@ -22,13 +24,13 @@ import { useSetSafeInterval } from '../../tools/hooks/useSetSafeInterval'; import { humanFileSize } from '../../tools/humanFileSize'; export const TorrentsModule: IModule = { - id: 'torrent', + id: 'torrents-status', title: 'Torrent', icon: Download, component: TorrentsComponent, options: { hidecomplete: { - name: 'Hide completed torrents', + name: 'descriptor.settings.hideComplete', value: false, }, }, @@ -46,10 +48,13 @@ export default function TorrentsComponent() { ) ?? []; const hideComplete: boolean = - (config?.modules?.[TorrentsModule.title]?.options?.hidecomplete?.value as boolean) ?? false; + (config?.modules?.[TorrentsModule.id]?.options?.hidecomplete?.value as boolean) ?? false; const [torrents, setTorrents] = useState([]); const setSafeInterval = useSetSafeInterval(); const [isLoading, setIsLoading] = useState(true); + + const { t } = useTranslation(`modules/${TorrentsModule.id}`); + useEffect(() => { setIsLoading(true); if (downloadServices.length === 0) return; @@ -82,13 +87,13 @@ export default function TorrentsComponent() { if (downloadServices.length === 0) { return ( - - No supported download clients found! + + {t('card.errors.noDownloadClients.title')} - Add a download service to view your current downloads + {t('card.errors.noDownloadClients.text')} - + ); } @@ -106,12 +111,12 @@ export default function TorrentsComponent() { const DEVICE_WIDTH = 576; const ths = ( - Name - Size - {width > 576 ? Down : ''} - {width > 576 ? Up : ''} - ETA - Progress + {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')} + {t('card.table.header.progress')} ); // Convert Seconds to readable format. @@ -196,7 +201,7 @@ export default function TorrentsComponent() { ) : (
- No torrents found + {t('card.table.body.nothingFound')}
)}