import React from 'react'; import Action from '../components/action-bar/Action'; import { addTorrent, startTorrent, stopTorrent } from '../actions/ClientActions'; import { displayModal } from '../actions/UIActions'; import { setTorrentsSort } from '../actions/UIActions'; import SortDropdown from '../components/action-bar/SortDropdown'; const methodsToBind = [ 'handleAddTorrents', 'handleSortChange', 'handleStart', 'handleStop' ]; export default class FilterBar extends React.Component { constructor() { super(); this.state = { selectedTorrents: [] }; methodsToBind.forEach((method) => { this[method] = this[method].bind(this); }); } handleAddTorrents() { this.props.dispatch(displayModal({ modal: 'add-torrents' })); } handleSortChange(sortBy) { this.props.dispatch(setTorrentsSort({ sortBy })); } handleStart() { this.props.dispatch(startTorrent(this.props.uiStore.torrentList.selected)); } handleStop() { this.props.dispatch(stopTorrent(this.props.uiStore.torrentList.selected)); } render() { return ( ); } }