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