Address PR comments

This commit is contained in:
ajnart
2022-11-22 18:17:05 +09:00
parent fb78736a83
commit 24c50dda29

View File

@@ -1,4 +1,14 @@
import { Badge, Button, Group, Select, Stack, Tabs, Text, Title } from '@mantine/core'; import {
Badge,
Button,
Group,
Select,
Stack,
Tabs,
Text,
Title,
useMantineTheme,
} from '@mantine/core';
import { IconDownload, IconPlayerPause, IconPlayerPlay } from '@tabler/icons'; import { IconDownload, IconPlayerPause, IconPlayerPlay } from '@tabler/icons';
import { FunctionComponent, useEffect, useState } from 'react'; import { FunctionComponent, useEffect, useState } from 'react';
@@ -50,6 +60,7 @@ export const UsenetComponent: FunctionComponent = () => {
} }
const { ref, width, height } = useElementSize(); const { ref, width, height } = useElementSize();
const MIN_WIDTH_MOBILE = useMantineTheme().breakpoints.xs;
return ( return (
<Tabs keepMounted={false} defaultValue="queue"> <Tabs keepMounted={false} defaultValue="queue">
@@ -58,17 +69,14 @@ export const UsenetComponent: FunctionComponent = () => {
<Tabs.Tab value="history">{t('tabs.history')}</Tabs.Tab> <Tabs.Tab value="history">{t('tabs.history')}</Tabs.Tab>
{data && ( {data && (
<Group position="right" ml="auto"> <Group position="right" ml="auto">
{ {width > MIN_WIDTH_MOBILE && (
// Only show if the width is > 400px
width > 400 && (
<> <>
<Badge>{humanFileSize(data?.speed)}/s</Badge> <Badge>{humanFileSize(data?.speed)}/s</Badge>
<Badge> <Badge>
{t('info.sizeLeft')}: {humanFileSize(data?.sizeLeft)} {t('info.sizeLeft')}: {humanFileSize(data?.sizeLeft)}
</Badge> </Badge>
</> </>
) )}
}
{data.paused ? ( {data.paused ? (
<Button uppercase onClick={() => resume()} radius="xl" size="xs"> <Button uppercase onClick={() => resume()} radius="xl" size="xs">