import React from "react" import { connect } from "react-redux" import { bindActionCreators } from "redux" import { addTorrent, searchTorrents } from "../../actions/torrents" import Loader from "../loader/loader" import { OverlayTrigger, Tooltip } from "react-bootstrap" function mapStateToProps(state) { return { searching: state.torrentStore.get("searching"), results: state.torrentStore.get("searchResults"), }; } const mapDispatchToProps = (dispatch) => bindActionCreators({ addTorrent, searchTorrents }, dispatch) class TorrentSearch extends React.PureComponent { constructor(props) { super(props); this.handleSearchInput = this.handleSearchInput.bind(this); this.state = { search: (this.props.router.params.search || "") }; } handleSearchInput() { this.setState({ search: this.refs.search.value }); } handleClick(type) { if (this.state.search === "") { return } const url = `/torrents/search/${type}/${encodeURI(this.state.search)}`; this.props.router.push(url); } render() { const searchFromURL = this.props.router.params.search || ""; const typeFromURL = this.props.router.params.type || ""; return (
|
{props.data.get("name")} |
props.addTorrent(props.data.get("url"))}> |
|||
{props.data.get("quality")} | {props.data.get("source")} | {props.data.get("upload_user")} |
Health: {health}
Seeders: {seeders}
Leechers: {props.leechers}