import React, { Component } from 'react'; import { connect } from 'react-redux'; import { activeTorrents, selectTorrent, selectop } from '../torrent_state'; import { formatBitrate } from '../bitrate'; class TorrentTable extends Component { render() { const { torrents } = this.props; const active = activeTorrents(); return ( {Object.values(torrents).map(t => )}
name up down ratio
selectTorrent(t, e.target.checked ? selectop.UNION : selectop.SUBTRACT)} /> { e.preventDefault(); selectTorrent(t, selectop.EXCLUSIVE); }} > {t.name} {formatBitrate(t.rate_up)} {formatBitrate(t.rate_down)} {(t.transferred_up / t.transferred_down).toFixed(2)}
); } } export default connect(state => ({ torrents: state.torrents, router: state.router }))(TorrentTable);