From 9704597804dad7150cc72c55235b6f460938648a Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Wed, 22 Nov 2023 20:11:46 +0000 Subject: [PATCH] Made it a table but want to get it back now --- crates/librqbit/webui/src/index.tsx | 96 +++++++++++++++++------------ 1 file changed, 56 insertions(+), 40 deletions(-) diff --git a/crates/librqbit/webui/src/index.tsx b/crates/librqbit/webui/src/index.tsx index 0dd08f0..835bd0e 100644 --- a/crates/librqbit/webui/src/index.tsx +++ b/crates/librqbit/webui/src/index.tsx @@ -1,6 +1,6 @@ import { StrictMode, createContext, memo, useContext, useEffect, useRef, useState } from 'react'; import ReactDOM from 'react-dom/client'; -import { ProgressBar, Button, Container, Row, Col, Alert, Modal, Form, Spinner } from 'react-bootstrap'; +import { ProgressBar, Button, Container, Row, Col, Alert, Modal, Form, Spinner, Table } from 'react-bootstrap'; import 'bootstrap/dist/css/bootstrap.min.css'; import './styles.scss'; @@ -96,35 +96,35 @@ interface TorrentStats { } | null; } -function TorrentRow({ detailsResponse, statsResponse }) { +const TorrentRow: React.FC<{ + detailsResponse: TorrentDetails, statsResponse: TorrentStats +}> = ({ detailsResponse, statsResponse }) => { const totalBytes = statsResponse.snapshot.total_bytes; const downloadedBytes = statsResponse.snapshot.have_bytes; + const finished = totalBytes == downloadedBytes; const downloadPercentage = (downloadedBytes / totalBytes) * 100; return ( -
- - - - - - -
+ + {getLargestFileName(detailsResponse)} + {`${formatBytes(totalBytes)}`} + + + + {statsResponse.download_speed.human_readable} + {getCompletionETA(statsResponse)} + {`${statsResponse.snapshot.peer_stats.live} / ${statsResponse.snapshot.peer_stats.seen}`} + ); } -const Column = ({ label, value }) => ( - -

{label}

-

{value}

- -); - -const ColumnWithProgressBar = ({ label, percentage }) => ( - -

{label}

- - +const Column: React.FC<{ + label: string, + children?: any +}> = ({ children }) => ( + + {children} + ); const Torrent = ({ torrent }) => { @@ -222,11 +222,24 @@ const TorrentsList = (props: { torrents: Array, loading: boolean }) = ) } return ( -
- {props.torrents.map((t: TorrentId) => - - )} -
+ + + + + + + + + + + + + {props.torrents.map((t: TorrentId) => + + )} + + +
NameSizeProgressDownload SpeedETAPeers
) }; @@ -500,7 +513,7 @@ const FileSelectionModal = (props: { show: boolean, onHide, fileList: Array + Select Files @@ -508,22 +521,25 @@ const FileSelectionModal = (props: { show: boolean, onHide, fileList: Array ) : ( - - {fileList.map((file, index) => ( - - + <> +
+ + {fileList.map((file, index) => ( + handleToggleFile(index)} - className='fs-6' - /> - - - ))} + onChange={() => handleToggleFile(index)}> + + + ))} + +
-
+ + )}