исправление роутинга, отображение общей статистики
This commit is contained in:
@ -6,12 +6,17 @@ import RaisedButton from 'material-ui/RaisedButton';
|
||||
|
||||
export default class Search extends Component {
|
||||
search() {
|
||||
console.log(this.searchValue);
|
||||
window.torrentSocket.emit('search', this.searchValue, (torrents) => {
|
||||
this.searchData = torrents;
|
||||
this.forceUpdate();
|
||||
});
|
||||
}
|
||||
componentDidMount() {
|
||||
window.torrentSocket.emit('statistic', (statistic) => {
|
||||
this.stats = statistic;
|
||||
this.forceUpdate();
|
||||
});
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div className="column w100p center">
|
||||
@ -32,6 +37,13 @@ export default class Search extends Component {
|
||||
this.search()
|
||||
}} />
|
||||
</div>
|
||||
{
|
||||
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>
|
||||
:
|
||||
null
|
||||
}
|
||||
<SearchResults results={this.searchData} />
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user