feat(torrents): torrent tablosunda upload hızını göster
This commit is contained in:
@@ -4,6 +4,7 @@ export interface QbitTorrentInfo {
|
|||||||
size: number;
|
size: number;
|
||||||
progress: number;
|
progress: number;
|
||||||
dlspeed: number;
|
dlspeed: number;
|
||||||
|
upspeed?: number;
|
||||||
state: string;
|
state: string;
|
||||||
magnet_uri?: string;
|
magnet_uri?: string;
|
||||||
completed?: number;
|
completed?: number;
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ const formatSpeed = (bytesPerSec: number) => {
|
|||||||
return `${kb.toFixed(1)} KB/s`;
|
return `${kb.toFixed(1)} KB/s`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isUploadState = (state: string) => /upload|stalledup|forcedup|up$/i.test(state);
|
||||||
|
|
||||||
export const TorrentTable = () => {
|
export const TorrentTable = () => {
|
||||||
const torrents = useAppStore((s) => s.torrents);
|
const torrents = useAppStore((s) => s.torrents);
|
||||||
const selected = useAppStore((s) => s.selectedHash);
|
const selected = useAppStore((s) => s.selectedHash);
|
||||||
@@ -176,7 +178,7 @@ export const TorrentTable = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span className="w-8 text-left tabular-nums">{Math.round(torrent.progress * 100)}%</span>
|
<span className="w-8 text-left tabular-nums">{Math.round(torrent.progress * 100)}%</span>
|
||||||
<span className="w-16 text-left tabular-nums">{formatSpeed(torrent.dlspeed)}</span>
|
<span className="w-16 text-left tabular-nums">{formatSpeed(isUploadState(torrent.state) ? (torrent.upspeed ?? 0) : torrent.dlspeed)}</span>
|
||||||
<span className="flex items-center gap-2 text-slate-500 group-[.is-selected]:text-white whitespace-nowrap">
|
<span className="flex items-center gap-2 text-slate-500 group-[.is-selected]:text-white whitespace-nowrap">
|
||||||
{renderState(torrent.state)}
|
{renderState(torrent.state)}
|
||||||
{getProfileName(torrent.hash) && (
|
{getProfileName(torrent.hash) && (
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export interface TorrentInfo {
|
|||||||
size: number;
|
size: number;
|
||||||
progress: number;
|
progress: number;
|
||||||
dlspeed: number;
|
dlspeed: number;
|
||||||
|
upspeed?: number;
|
||||||
state: string;
|
state: string;
|
||||||
magnet_uri?: string;
|
magnet_uri?: string;
|
||||||
tracker?: string;
|
tracker?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user