add react web project

This commit is contained in:
YouROK
2020-12-24 12:59:16 +03:00
parent 4e816f2cae
commit a404545133
26 changed files with 20515 additions and 2 deletions

10
web/src/utils/Utils.js Normal file
View File

@@ -0,0 +1,10 @@
export function humanizeSize(size) {
if (!size) return ''
var i = Math.floor(Math.log(size) / Math.log(1024))
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]
}
export function getPeerString(torrent) {
if (!torrent || !torrent.connected_seeders) return '[0] 0 / 0'
return '[' + torrent.connected_seeders + '] ' + torrent.active_peers + ' / ' + torrent.total_peers
}