♻️ PR feedback

This commit is contained in:
Manuel
2023-01-19 22:23:37 +01:00
parent 5e50c56feb
commit 7a72457971
2 changed files with 19 additions and 22 deletions

View File

@@ -29,6 +29,9 @@
"estimatedTimeOfArrival": "ETA", "estimatedTimeOfArrival": "ETA",
"progress": "Progress" "progress": "Progress"
}, },
"item": {
"text": "Managed by {{appName}}, {{ratio}} ratio"
},
"body": { "body": {
"nothingFound": "No torrents found" "nothingFound": "No torrents found"
} }
@@ -61,6 +64,7 @@
"progress": "Progress - {{progress}}%", "progress": "Progress - {{progress}}%",
"totalSelectedSize": "Total - {{totalSize}}", "totalSelectedSize": "Total - {{totalSize}}",
"state": "State - {{state}}", "state": "State - {{state}}",
"ratio": "Ratio -",
"completed": "Completed" "completed": "Completed"
} }
} }

View File

@@ -38,6 +38,7 @@ export const BitTorrrentQueueItem = ({ torrent, app }: TorrentQueueItemProps) =>
const [popoverOpened, { open: openPopover, close: closePopover }] = useDisclosure(false); const [popoverOpened, { open: openPopover, close: closePopover }] = useDisclosure(false);
const MIN_WIDTH_MOBILE = useMantineTheme().breakpoints.xs; const MIN_WIDTH_MOBILE = useMantineTheme().breakpoints.xs;
const { width } = useElementSize(); const { width } = useElementSize();
const { t } = useTranslation('modules/torrents-status');
const downloadSpeed = torrent.downloadSpeed / 1024 / 1024; const downloadSpeed = torrent.downloadSpeed / 1024 / 1024;
const uploadSpeed = torrent.uploadSpeed / 1024 / 1024; const uploadSpeed = torrent.uploadSpeed / 1024 / 1024;
@@ -45,13 +46,7 @@ export const BitTorrrentQueueItem = ({ torrent, app }: TorrentQueueItemProps) =>
return ( return (
<tr key={torrent.id}> <tr key={torrent.id}>
<td> <td>
<Popover <Popover opened={popoverOpened} radius="md" shadow="md" width={350} withinPortal>
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>
@@ -68,7 +63,10 @@ export const BitTorrrentQueueItem = ({ torrent, app }: TorrentQueueItemProps) =>
</Text> </Text>
{app && ( {app && (
<Text size="xs" color="dimmed"> <Text size="xs" color="dimmed">
Managed by {app.name}, {torrent.ratio.toFixed(2)} ratio {t('card.table.item.text', {
appName: app.name,
ratio: torrent.ratio.toFixed(2),
})}
</Text> </Text>
)} )}
</div> </div>
@@ -125,7 +123,7 @@ const TorrentQueuePopover = ({ torrent, app }: TorrentQueueItemProps) => {
return ( return (
<Group spacing="xs"> <Group spacing="xs">
<Group spacing={3}> <Group spacing={3}>
<Text>Ratio -</Text> <Text>{t('card.popover.metrics.ratio')}</Text>
<Text color={color()} weight="bold"> <Text color={color()} weight="bold">
{torrent.ratio.toFixed(2)} {torrent.ratio.toFixed(2)}
@@ -188,7 +186,6 @@ const TorrentQueuePopover = ({ torrent, app }: TorrentQueueItemProps) => {
<List.Item icon={<IconDownload size={16} />}> <List.Item icon={<IconDownload size={16} />}>
<Group spacing="xs"> <Group spacing="xs">
<Text>{humanFileSize(torrent.totalDownloaded)}</Text> <Text>{humanFileSize(torrent.totalDownloaded)}</Text>
<Divider orientation="vertical" />
<IconUpload size={16} /> <IconUpload size={16} />
<Text>{humanFileSize(torrent.totalUploaded)}</Text> <Text>{humanFileSize(torrent.totalUploaded)}</Text>
</Group> </Group>
@@ -200,18 +197,14 @@ const TorrentQueuePopover = ({ torrent, app }: TorrentQueueItemProps) => {
})} })}
</Text> </Text>
</List.Item> </List.Item>
{(torrent.label || torrent.isCompleted) && ( <Flex gap="sm" mt="md">
<List.Item> {torrent.label && <Badge variant="outline">{torrent.label}</Badge>}
<Flex gap="sm"> {torrent.isCompleted && (
{torrent.label && <Badge variant="outline">{torrent.label}</Badge>} <Badge variant="dot" color="green">
{torrent.isCompleted && ( {t('card.popover.metrics.completed')}
<Badge variant="dot" color="green"> </Badge>
{t('card.popover.metrics.completed')} )}
</Badge> </Flex>
)}
</Flex>
</List.Item>
)}
</List> </List>
</Stack> </Stack>
); );