feat(gui): display rating in torrent line (gui part)

This commit is contained in:
Alexey Kasyanchuk
2018-06-16 12:56:38 +03:00
parent 9502e53fc1
commit a9c27083da
3 changed files with 57 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import TorrentPage from './torrent-page'
import Spinner24 from './images/spinner_24.gif'
import LinearProgress from 'material-ui/LinearProgress';
let rating = require('./rating');
const contentIcon = (type, category, fill = 'grey') => {
if(category == 'xxx')
@ -218,6 +219,10 @@ export default class Torrent extends Component {
render()
{
const torrent = this.props.torrent;
let torrentRating = -1
if(torrent.good > 0 || torrent.bad > 0)
torrentRating = Math.round(rating(torrent.good, torrent.bad) * 100);
return (
<div>
<ListItem
@ -290,6 +295,21 @@ export default class Torrent extends Component {
:
null
}
{
(torrent.good > 0 || torrent.bad > 0)
&&
<div className='row w100p inline' style={{maxWidth: 600}}>
<LinearProgress
mode="determinate"
value={torrentRating}
color={torrentRating >= 50 ? '#00E676' : '#FF3D00'}
style={{
height: '5px',
}}
/>
<div className='row center pad0-5 fs0-85 text-nowrap' style={{color: torrentRating >= 50 ? '#00E676' : '#FF3D00', width: '190px'}}>{__('Torrent rating')}: {torrentRating}%</div>
</div>
}
</div>
</a>
}