import React, { Component } from 'react'; import { connect } from 'react-redux'; import selectTorrent, { UNION, SUBTRACT, EXCLUSIVE } from '../actions/selection'; import { formatBitrate } from '../bitrate'; import Ratio from './ratio'; import TorrentProgress from './torrent_progress'; class TorrentTable extends Component { render() { const { selection, torrents, dispatch } = this.props; return (
{ if (selection.length > 0) { dispatch(selectTorrent([], EXCLUSIVE)); } else { dispatch(selectTorrent(Object.keys(torrents), EXCLUSIVE)); } }} /> | name | up | down | ratio | progress |
---|---|---|---|---|---|
dispatch(selectTorrent([t.id], e.target.checked ? UNION : SUBTRACT)) } /> | { e.preventDefault(); dispatch(selectTorrent([t.id], EXCLUSIVE)); }} >{t.name} | {formatBitrate(t.rate_up)} | {formatBitrate(t.rate_down)} |