увеличена скорость получание информации о размерах

This commit is contained in:
Alexey Kasyanchuk
2017-01-03 06:14:23 +03:00
parent c13534fe68
commit d8239466ce
4 changed files with 63 additions and 10 deletions

View File

@ -73,6 +73,9 @@ export default class RecentTorrents extends Component {
});
}
render() {
if(!this.torrents || this.torrents.length == 0)
return null;
return (
<List className='animated'>
<Subheader inset={true}>Most recent torrents</Subheader>
@ -82,7 +85,7 @@ export default class RecentTorrents extends Component {
return <TorrentLine key={index} torrent={torrent} />;
})
}
</List>
</List>
);
}
}

View File

@ -5,6 +5,8 @@ import TextField from 'material-ui/TextField';
import RaisedButton from 'material-ui/RaisedButton';
import RefreshIndicator from 'material-ui/RefreshIndicator';
import formatBytes from './format-bytes'
export default class Search extends Component {
constructor(props)
{
@ -28,6 +30,10 @@ export default class Search extends Component {
this.stats = statistic;
this.forceUpdate();
});
window.torrentSocket.on('newStatistic', (statistic) => {
this.stats = statistic;
this.forceUpdate();
});
}
render() {
const style = {
@ -59,7 +65,7 @@ export default class Search extends Component {
{
this.stats
?
<div className='fs0-75' style={{color: 'rgba(0, 0, 0, 0.541176)'}}>we have {this.stats.torrents} torrents and around {this.stats.files} files here</div>
<div className='fs0-75' style={{color: 'rgba(0, 0, 0, 0.541176)'}}>we have information about {this.stats.torrents} torrents and around {this.stats.files} files and { formatBytes(this.stats.size, 1) } of data</div>
:
null
}