perf(top): fix unnecessary drawing on top page

This commit is contained in:
Alexey Kasyanchuk
2018-08-26 16:22:59 +03:00
parent 1e09243756
commit ff4b98bd1f
7 changed files with 82 additions and 34 deletions

10
src/app/LinearProgress.js Normal file
View File

@ -0,0 +1,10 @@
import LinearProgressOriginal from 'material-ui/LinearProgress';
export default class LinearProgress extends LinearProgressOriginal
{
barUpdate(id, ...args)
{
super.barUpdate(id, ...args)
return this.timers[id]
}
}

View File

@ -4,7 +4,7 @@ import TorrentLine from './torrent'
import {List, ListItem} from 'material-ui/List';
import Subheader from 'material-ui/Subheader';
import Divider from 'material-ui/Divider';
import LinearProgress from 'material-ui/LinearProgress';
import LinearProgress from './LinearProgress';
export default class SearchResults extends Component {
render() {

View File

@ -6,7 +6,7 @@ import {List, ListItem} from 'material-ui/List';
import Divider from 'material-ui/Divider';
import Subheader from 'material-ui/Subheader';
import RaisedButton from 'material-ui/RaisedButton';
import LinearProgress from 'material-ui/LinearProgress';
import LinearProgress from './LinearProgress';
import {Tabs, Tab} from 'material-ui/Tabs';
import _ from 'lodash'
@ -150,6 +150,12 @@ export default class TopPage extends Page {
Object.keys(this.times).map((time, index) => {
const {torrents} = this.topTorrents[type][time] || {torrents: undefined};
// dont draw top on other page rather than focused
if(this.state.type !== type || this.state.time !== time)
{
return <Tab buttonStyle={time === this.state.time ? {fontWeight: 'bold'} : undefined} style={{minWidth: 150}} key={index} label={this.times[time]} value={time}></Tab>
}
if(!torrents)
return (
<Tab buttonStyle={time === this.state.time ? {fontWeight: 'bold'} : undefined} style={{minWidth: 150}} key={index} label={this.times[time]} value={time}>

View File

@ -14,7 +14,7 @@ import NoImage from './images/no-image-icon.png'
var moment = require('moment');
import RefreshIndicator from 'material-ui/RefreshIndicator';
let rating = require('./rating');
import LinearProgress from 'material-ui/LinearProgress';
import LinearProgress from './LinearProgress';
import FlatButton from 'material-ui/FlatButton';
import {fileTypeDetect} from './content'
import {contentIcon} from './torrent'

View File

@ -7,7 +7,7 @@ import ToolTip from './tooltip';
import PagesPie from './pages-pie.js';
import TorrentPage from './torrent-page'
import LinearProgress from 'material-ui/LinearProgress';
import LinearProgress from './LinearProgress';
let rating = require('./rating');
import scrollBack from './remember-scroll'
import TrackersImages from './trackers-images'