update web

This commit is contained in:
YouROK
2021-01-20 10:13:29 +03:00
parent 8d973a54b9
commit 0fe9fe63de
3 changed files with 10 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,7 @@ import React, { useEffect } from 'react'
import Typography from '@material-ui/core/Typography'
import { Button, ButtonGroup, Grid, List, ListItem } from '@material-ui/core'
import CachedIcon from '@material-ui/icons/Cached'
import LinearProgress from '@material-ui/core/LinearProgress';
import { getPeerString, humanizeSize } from '../utils/Utils'
import { playlistTorrHost, streamHost } from '../utils/Hosts'
@@ -18,14 +19,18 @@ const style = {
poster: {
display: 'flex',
flexDirection: 'row',
borderRadius:'5px',
},
}
export default function DialogTorrentInfo(props) {
const [torrent, setTorrent] = React.useState(props.torrent)
const [progress, setProgress] = React.useState(-1)
useEffect(() => {
setTorrent(props.torrent)
if(torrent.stat==2)
setProgress(torrent.preloaded_bytes * 100 / torrent.preload_size)
}, [props.torrent, props.open])
return (
@@ -47,6 +52,7 @@ export default function DialogTorrentInfo(props) {
</Typography>
</Grid>
</Grid>
{torrent.stat==2 && <LinearProgress style={{marginTop:'10px'}} variant="determinate" value={progress} />}
</DialogTitle>
<DialogContent>
<List>

View File

@@ -17,12 +17,6 @@ import { torrentsHost } from '../utils/Hosts'
import DialogCacheInfo from './DialogCacheInfo'
import DataUsageIcon from '@material-ui/icons/DataUsage'
const style = {
width100: {
width: '100%',
},
}
export default function Torrent(props) {
const [open, setOpen] = React.useState(false)
const [showCache, setShowCache] = React.useState(false)
@@ -53,14 +47,14 @@ export default function Torrent(props) {
<ListItem>
<ButtonGroup style={{width:'100%',boxShadow:'2px 2px 2px gray'}} disableElevation variant="contained" color="primary">
<Button
style={style.width100}
style={{width: '100%', justifyContent:'start'}}
onClick={() => {
setShowCache(false)
setOpen(true)
}}
>
{torrent.poster &&
<img src={torrent.poster} alt={torrent.title} style={{width: 'auto',height:'100px',margin:'0 10px 0 0',borderRadius:'5px'}}/>
<img src={torrent.poster} alt={torrent.title} align="left" style={{width: 'auto',height:'100px',margin:'0 10px 0 0',borderRadius:'5px'}}/>
}
<Typography>
{torrent.name ? torrent.name : torrent.title}