format files

This commit is contained in:
maxDorninger
2025-07-10 01:31:48 +02:00
parent 3c6f5710de
commit ee9575bb2b
4 changed files with 19 additions and 9 deletions

View File

@@ -6,7 +6,11 @@
import { toast } from 'svelte-sonner';
import type { PublicIndexerQueryResult } from '$lib/types.js';
import { convertTorrentSeasonRangeToIntegerRange, getFullyQualifiedMediaName, formatSecondsToOptimalUnit } from '$lib/utils';
import {
convertTorrentSeasonRangeToIntegerRange,
formatSecondsToOptimalUnit,
getFullyQualifiedMediaName
} from '$lib/utils';
import { LoaderCircle } from 'lucide-svelte';
import * as Dialog from '$lib/components/ui/dialog/index.js';
import * as Tabs from '$lib/components/ui/tabs/index.js';
@@ -283,8 +287,10 @@
<Table.Cell class="max-w-[300px] font-medium">{torrent.title}</Table.Cell>
<Table.Cell>{(torrent.size / 1024 / 1024 / 1024).toFixed(2)}GB</Table.Cell>
<Table.Cell>{torrent.usenet}</Table.Cell>
<Table.Cell>{torrent.usenet ? "N/A" : torrent.seeders}</Table.Cell>
<Table.Cell>{torrent.usenet ? formatSecondsToOptimalUnit(torrent.age) : "N/A"}</Table.Cell>
<Table.Cell>{torrent.usenet ? 'N/A' : torrent.seeders}</Table.Cell>
<Table.Cell
>{torrent.usenet ? formatSecondsToOptimalUnit(torrent.age) : 'N/A'}</Table.Cell
>
<Table.Cell>
{#each torrent.flags as flag}
<Badge variant="outline">{flag}</Badge>

View File

@@ -81,10 +81,10 @@ export function formatSecondsToOptimalUnit(seconds: number): string {
const units = [
{ name: 'y', seconds: 365.25 * 24 * 60 * 60 }, // year (accounting for leap years)
{ name: 'mo', seconds: 30.44 * 24 * 60 * 60 }, // month (average)
{ name: 'd', seconds: 24 * 60 * 60 }, // day
{ name: 'h', seconds: 60 * 60 }, // hour
{ name: 'm', seconds: 60 }, // minute
{ name: 's', seconds: 1 } // second
{ name: 'd', seconds: 24 * 60 * 60 }, // day
{ name: 'h', seconds: 60 * 60 }, // hour
{ name: 'm', seconds: 60 }, // minute
{ name: 's', seconds: 1 } // second
];
for (const unit of units) {