From 4c67ee29027fb2adb1e82f28930cf235364c2068 Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Fri, 15 Sep 2023 18:11:40 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Added=20modal=20on=20usenet=20wi?= =?UTF-8?q?dget=20(#1398)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widgets/useNet/UsenetHistoryList.tsx | 82 +++++++++----- src/widgets/useNet/UsenetQueueList.tsx | 136 ++++++++++++++--------- 2 files changed, 138 insertions(+), 80 deletions(-) diff --git a/src/widgets/useNet/UsenetHistoryList.tsx b/src/widgets/useNet/UsenetHistoryList.tsx index 7d57e6e10..b68ad89ab 100644 --- a/src/widgets/useNet/UsenetHistoryList.tsx +++ b/src/widgets/useNet/UsenetHistoryList.tsx @@ -3,25 +3,26 @@ import { Center, Code, Group, + List, Pagination, + Popover, Skeleton, Stack, Table, Text, Title, - Tooltip, } from '@mantine/core'; import { useElementSize } from '@mantine/hooks'; -import { IconAlertCircle } from '@tabler/icons-react'; +import { IconAlertCircle, IconClock, IconFileDownload, IconFileInfo } from '@tabler/icons-react'; import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration'; import { useTranslation } from 'next-i18next'; import { FunctionComponent, useState } from 'react'; - -import { useGetUsenetHistory } from '../dashDot/api'; import { parseDuration } from '~/tools/client/parseDuration'; import { humanFileSize } from '~/tools/humanFileSize'; +import { useGetUsenetHistory } from '../dashDot/api'; + dayjs.extend(duration); interface UsenetHistoryListProps { @@ -87,37 +88,58 @@ export const UsenetHistoryList: FunctionComponent = ({ a {t('modules/usenet:history.header.name')} {t('modules/usenet:history.header.size')} - {durationBreakpoint < width ? ( + {durationBreakpoint < width && ( {t('modules/usenet:history.header.duration')} - ) : null} + )} {data.items.map((history) => ( - - - - - {history.name} - - - - - {humanFileSize(history.size)} - - {durationBreakpoint < width ? ( - - {parseDuration(history.time, t)} - - ) : null} - + + + + + + {history.name} + + + + {humanFileSize(history.size)} + + {durationBreakpoint < width && ( + + {parseDuration(history.time, t)} + + )} + + + + + }>{history.name} + }> + {parseDuration(history.time, t)} + + }> + {humanFileSize(history.size)} + + + + ))} diff --git a/src/widgets/useNet/UsenetQueueList.tsx b/src/widgets/useNet/UsenetQueueList.tsx index 136a999a5..dcb590769 100644 --- a/src/widgets/useNet/UsenetQueueList.tsx +++ b/src/widgets/useNet/UsenetQueueList.tsx @@ -1,27 +1,35 @@ import { - ActionIcon, Alert, Center, Code, Group, + List, Pagination, + Popover, Progress, Skeleton, Stack, Table, Text, Title, - Tooltip, useMantineTheme, } from '@mantine/core'; import { useElementSize } from '@mantine/hooks'; -import { IconAlertCircle, IconPlayerPause, IconPlayerPlay } from '@tabler/icons-react'; +import { + IconAlertCircle, + IconClock, + IconClockPause, + IconFileDownload, + IconFileInfo, + IconPercentage, +} from '@tabler/icons-react'; import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration'; import { useTranslation } from 'next-i18next'; import { FunctionComponent, useState } from 'react'; - +import { parseDuration } from '~/tools/client/parseDuration'; import { humanFileSize } from '~/tools/humanFileSize'; + import { useGetUsenetDownloads } from '../dashDot/api'; dayjs.extend(duration); @@ -105,53 +113,81 @@ export const UsenetQueueList: FunctionComponent = ({ appId {data.items.map((nzb) => ( - - - - - {nzb.name} - - - - {sizeBreakpoint < width ? ( - - {humanFileSize(nzb.size)} - - ) : null} - - {nzb.eta <= 0 ? ( - - {t('queue.paused')} - - ) : ( - {dayjs.duration(nzb.eta, 's').format('H:mm:ss')} - )} - - {progressBreakpoint < width ? ( - - - {nzb.progress.toFixed(1)}% - - {width > progressbarBreakpoint ? ( - 0 ? theme.primaryColor : 'lightgrey'} - value={nzb.progress} - size="lg" - style={{ width: '100%' }} - /> + + + + + + {nzb.name} + + + {sizeBreakpoint < width ? ( + + {humanFileSize(nzb.size)} + ) : null} - - ) : null} - + + {nzb.eta <= 0 ? ( + + {t('queue.paused')} + + ) : ( + {dayjs.duration(nzb.eta, 's').format('H:mm:ss')} + )} + + {progressBreakpoint < width ? ( + + + {nzb.progress.toFixed(1)}% + + {width > progressbarBreakpoint ? ( + 0 ? theme.primaryColor : 'lightgrey'} + value={nzb.progress} + size="lg" + style={{ width: '100%' }} + /> + ) : null} + + ) : null} + + + + + }>{nzb.name} + }> + {nzb.progress.toFixed(1)}% + + {nzb.state === 'downloading' ? ( + }> + {parseDuration(nzb.eta, t)} + + ) : ( + }>{t('queue.paused')} + )} + }> + {humanFileSize(nzb.size)} + + + + ))}