mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-16 18:26:20 +01:00
💄 Torrent Queue styling
This commit is contained in:
@@ -2,12 +2,16 @@
|
|||||||
import { NormalizedTorrent } from '@ctrl/shared-torrent';
|
import { NormalizedTorrent } from '@ctrl/shared-torrent';
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
|
Divider,
|
||||||
Flex,
|
Flex,
|
||||||
Group,
|
Group,
|
||||||
|
List,
|
||||||
MantineColor,
|
MantineColor,
|
||||||
Popover,
|
Popover,
|
||||||
Progress,
|
Progress,
|
||||||
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
|
Title,
|
||||||
useMantineTheme,
|
useMantineTheme,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useDisclosure, useElementSize } from '@mantine/hooks';
|
import { useDisclosure, useElementSize } from '@mantine/hooks';
|
||||||
@@ -41,7 +45,13 @@ export const BitTorrrentQueueItem = ({ torrent, app }: TorrentQueueItemProps) =>
|
|||||||
return (
|
return (
|
||||||
<tr key={torrent.id}>
|
<tr key={torrent.id}>
|
||||||
<td>
|
<td>
|
||||||
<Popover opened={popoverOpened} width={350} position="top" withinPortal>
|
<Popover
|
||||||
|
opened={popoverOpened}
|
||||||
|
radius="md"
|
||||||
|
shadow="md"
|
||||||
|
width="target"
|
||||||
|
withinPortal
|
||||||
|
>
|
||||||
<Popover.Dropdown>
|
<Popover.Dropdown>
|
||||||
<TorrentQueuePopover torrent={torrent} app={app} />
|
<TorrentQueuePopover torrent={torrent} app={app} />
|
||||||
</Popover.Dropdown>
|
</Popover.Dropdown>
|
||||||
@@ -114,7 +124,6 @@ const TorrentQueuePopover = ({ torrent, app }: TorrentQueueItemProps) => {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Group spacing="xs">
|
<Group spacing="xs">
|
||||||
<IconAffiliate size={16} />
|
|
||||||
<Group spacing={3}>
|
<Group spacing={3}>
|
||||||
<Text>Ratio -</Text>
|
<Text>Ratio -</Text>
|
||||||
|
|
||||||
@@ -127,7 +136,7 @@ const TorrentQueuePopover = ({ torrent, app }: TorrentQueueItemProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Stack spacing="xs" justify="space-evenly">
|
||||||
{app && (
|
{app && (
|
||||||
<Group spacing={3}>
|
<Group spacing={3}>
|
||||||
<Text size="xs" color="dimmed">
|
<Text size="xs" color="dimmed">
|
||||||
@@ -139,47 +148,61 @@ const TorrentQueuePopover = ({ torrent, app }: TorrentQueueItemProps) => {
|
|||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
)}
|
)}
|
||||||
<Text mb="md" weight="bold">
|
<Title order={5}>{torrent.name}</Title>
|
||||||
{torrent.name}
|
<List>
|
||||||
</Text>
|
<List.Item icon={<IconAffiliate size={16} />}>
|
||||||
|
|
||||||
<RatioMetric />
|
<RatioMetric />
|
||||||
|
</List.Item>
|
||||||
|
<List.Item icon={<IconSortDescending size={16} />}>
|
||||||
<Group spacing="xs">
|
<Group spacing="xs">
|
||||||
<IconSortDescending size={16} />
|
|
||||||
<Text>{t('card.popover.metrics.queuePosition', { position: torrent.queuePosition })}</Text>
|
|
||||||
</Group>
|
|
||||||
|
|
||||||
<Group spacing="xs">
|
|
||||||
<IconPercentage size={16} />
|
|
||||||
<Text>
|
<Text>
|
||||||
{t('card.popover.metrics.progress', { progress: (torrent.progress * 100).toFixed(2) })}
|
{t('card.popover.metrics.queuePosition', { position: torrent.queuePosition })}
|
||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
|
</List.Item>
|
||||||
|
<List.Item icon={<IconPercentage size={16} />}>
|
||||||
<Group spacing="xs">
|
<Group spacing="xs">
|
||||||
<IconDatabase size={16} />
|
<Text>
|
||||||
|
{t('card.popover.metrics.progress', {
|
||||||
|
progress: (torrent.progress * 100).toFixed(2),
|
||||||
|
})}
|
||||||
|
<Progress
|
||||||
|
color={
|
||||||
|
torrent.progress === 1 ? 'green' : torrent.state === 'paused' ? 'yellow' : 'blue'
|
||||||
|
}
|
||||||
|
radius="md"
|
||||||
|
size="sm"
|
||||||
|
value={torrent.progress * 100}
|
||||||
|
animate={torrent.state !== 'paused'}
|
||||||
|
/>
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
</List.Item>
|
||||||
|
<List.Item icon={<IconDatabase size={16} />}>
|
||||||
<Text>
|
<Text>
|
||||||
{t('card.popover.metrics.totalSelectedSize', {
|
{t('card.popover.metrics.totalSelectedSize', {
|
||||||
totalSize: humanFileSize(torrent.totalSelected),
|
totalSize: humanFileSize(torrent.totalSelected),
|
||||||
})}
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</List.Item>
|
||||||
<Group>
|
<List.Item icon={<IconDownload size={16} />}>
|
||||||
<Group spacing="xs">
|
<Group spacing="xs">
|
||||||
<IconDownload size={16} />
|
|
||||||
<Text>{humanFileSize(torrent.totalDownloaded)}</Text>
|
<Text>{humanFileSize(torrent.totalDownloaded)}</Text>
|
||||||
</Group>
|
<Divider orientation="vertical" />
|
||||||
<Group spacing="xs">
|
|
||||||
<IconUpload size={16} />
|
<IconUpload size={16} />
|
||||||
<Text>{humanFileSize(torrent.totalUploaded)}</Text>
|
<Text>{humanFileSize(torrent.totalUploaded)}</Text>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</List.Item>
|
||||||
|
<List.Item icon={<IconInfoCircle size={16} />}>
|
||||||
<Group spacing="xs">
|
<Text>
|
||||||
<IconInfoCircle size={16} />
|
{t('card.popover.metrics.state', {
|
||||||
<Text>{t('card.popover.metrics.state', { state: torrent.stateMessage })}</Text>
|
state: torrent.stateMessage !== '' ? torrent.stateMessage : torrent.state,
|
||||||
</Group>
|
})}
|
||||||
|
</Text>
|
||||||
<Flex mt="md" mb="xs" gap="sm">
|
</List.Item>
|
||||||
|
{(torrent.label || torrent.isCompleted) && (
|
||||||
|
<List.Item>
|
||||||
|
<Flex gap="sm">
|
||||||
{torrent.label && <Badge variant="outline">{torrent.label}</Badge>}
|
{torrent.label && <Badge variant="outline">{torrent.label}</Badge>}
|
||||||
{torrent.isCompleted && (
|
{torrent.isCompleted && (
|
||||||
<Badge variant="dot" color="green">
|
<Badge variant="dot" color="green">
|
||||||
@@ -187,6 +210,9 @@ const TorrentQueuePopover = ({ torrent, app }: TorrentQueueItemProps) => {
|
|||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
</>
|
</List.Item>
|
||||||
|
)}
|
||||||
|
</List>
|
||||||
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user