Refactor the rqbit-web file by breaking it down into components and helper functions. Improve code organization and maintainability
This commit is contained in:
parent
a5e7a5a5f5
commit
f978ad02fe
25 changed files with 1722 additions and 926 deletions
10
crates/librqbit/webui/src/helper/getLargestFileName.ts
Normal file
10
crates/librqbit/webui/src/helper/getLargestFileName.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { TorrentDetails } from "../api-types";
|
||||
|
||||
export function getLargestFileName(torrentDetails: TorrentDetails): string {
|
||||
const largestFile = torrentDetails.files
|
||||
.filter((f) => f.included)
|
||||
.reduce((prev: any, current: any) =>
|
||||
prev.length > current.length ? prev : current
|
||||
);
|
||||
return largestFile.name;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue