Usenet styling and fixes

This commit is contained in:
ajnart
2023-01-05 22:42:56 +09:00
parent d0c016aab6
commit 930a17843f
3 changed files with 9 additions and 6 deletions

View File

@@ -17,7 +17,11 @@ import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration'; import duration from 'dayjs/plugin/duration';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useConfigContext } from '../../config/provider'; import { useConfigContext } from '../../config/provider';
import { useGetUsenetInfo, usePauseUsenetQueue, useResumeUsenetQueue } from '../../hooks/widgets/dashDot/api'; import {
useGetUsenetInfo,
usePauseUsenetQueue,
useResumeUsenetQueue,
} from '../../hooks/widgets/dashDot/api';
import { humanFileSize } from '../../tools/humanFileSize'; import { humanFileSize } from '../../tools/humanFileSize';
import { AppIntegrationType } from '../../types/app'; import { AppIntegrationType } from '../../types/app';
import { defineWidget } from '../helper'; import { defineWidget } from '../helper';
@@ -52,6 +56,8 @@ function UseNetTile({}: UseNetTileProps) {
const downloadApps = const downloadApps =
config?.apps.filter((x) => x.integration && downloadAppTypes.includes(x.integration.type)) ?? config?.apps.filter((x) => x.integration && downloadAppTypes.includes(x.integration.type)) ??
[]; [];
const { ref, width, height } = useElementSize();
const MIN_WIDTH_MOBILE = useMantineTheme().breakpoints.xs;
const [selectedAppId, setSelectedApp] = useState<string | null>(downloadApps[0]?.id); const [selectedAppId, setSelectedApp] = useState<string | null>(downloadApps[0]?.id);
const { data } = useGetUsenetInfo({ appId: selectedAppId! }); const { data } = useGetUsenetInfo({ appId: selectedAppId! });
@@ -80,9 +86,6 @@ function UseNetTile({}: UseNetTileProps) {
return null; return null;
} }
const { ref, width, height } = useElementSize();
const MIN_WIDTH_MOBILE = useMantineTheme().breakpoints.xs;
return ( return (
<Tabs keepMounted={false} defaultValue="queue"> <Tabs keepMounted={false} defaultValue="queue">
<Tabs.List ref={ref} mb="md" style={{ flex: 1 }} grow> <Tabs.List ref={ref} mb="md" style={{ flex: 1 }} grow>

View File

@@ -39,7 +39,7 @@ export const UsenetHistoryList: FunctionComponent<UsenetHistoryListProps> = ({ a
const { data, isLoading, isError, error } = useGetUsenetHistory({ const { data, isLoading, isError, error } = useGetUsenetHistory({
limit: PAGE_SIZE, limit: PAGE_SIZE,
offset: (page - 1) * PAGE_SIZE, offset: (page - 1) * PAGE_SIZE,
appId: appId, appId,
}); });
const totalPages = Math.ceil((data?.total || 1) / PAGE_SIZE); const totalPages = Math.ceil((data?.total || 1) / PAGE_SIZE);

View File

@@ -44,7 +44,7 @@ export const UsenetQueueList: FunctionComponent<UsenetQueueListProps> = ({ appId
const { data, isLoading, isError, error } = useGetUsenetDownloads({ const { data, isLoading, isError, error } = useGetUsenetDownloads({
limit: PAGE_SIZE, limit: PAGE_SIZE,
offset: (page - 1) * PAGE_SIZE, offset: (page - 1) * PAGE_SIZE,
appId: appId, appId,
}); });
const totalPages = Math.ceil((data?.total || 1) / PAGE_SIZE); const totalPages = Math.ceil((data?.total || 1) / PAGE_SIZE);