feat(app): p2p peers indicator
This commit is contained in:
		| @ -82,10 +82,18 @@ window.isReady = () => { | ||||
| 	return (appReady && loadersCount === 0) | ||||
| } | ||||
|  | ||||
| window.peers = 0; | ||||
|  | ||||
| class App extends Component { | ||||
| 	componentDidMount() { | ||||
| 		window.router() | ||||
| 		appReady = true; | ||||
|  | ||||
| 		window.torrentSocket.on('peer', (numOfPeers) => { | ||||
| 			window.peers = numOfPeers | ||||
| 			console.log(window.peers) | ||||
| 			this.forceUpdate() | ||||
| 		}) | ||||
| 	} | ||||
| 	componentWillUnmount() { | ||||
| 		appReady = false; | ||||
| @ -94,6 +102,9 @@ class App extends Component { | ||||
| 		return ( | ||||
| 			<MuiThemeProvider> | ||||
| 				<PagesPie /> | ||||
| 				<div className='fs0-85 pad0-75' style={{position: 'fixed', bottom: 0, left: 0, color: window.peers > 0 ? 'green' : 'grey'}}> | ||||
| 					rats peers: {window.peers} {window.peers > 0 ? ' (p2p rats search enabled)' : ' (p2p rats search not available at this moment)'} | ||||
| 				</div> | ||||
| 			</MuiThemeProvider> | ||||
| 		); | ||||
| 	} | ||||
|  | ||||
		Reference in New Issue
	
	Block a user