diff --git a/src/public/js/components/shows/details.js b/src/public/js/components/shows/details.js index 389c2d9..6f0207b 100644 --- a/src/public/js/components/shows/details.js +++ b/src/public/js/components/shows/details.js @@ -12,6 +12,7 @@ import ImdbButton from "../buttons/imdb" import RefreshIndicator from "../buttons/refresh" import { OverlayTrigger, Tooltip } from "react-bootstrap" +import { Button, Dropdown, MenuItem } from "react-bootstrap" function mapStateToProps(state) { return { @@ -39,6 +40,7 @@ class ShowDetails extends React.Component { /> @@ -336,23 +344,40 @@ class TrackButton extends React.PureComponent { class GetDetailsButton extends React.PureComponent { constructor(props) { super(props); - this.handleClick = this.handleClick.bind(this); + this.handleFetchClick = this.handleFetchClick.bind(this); + this.handleAdvanceTorrentSearchClick = this.handleAdvanceTorrentSearchClick.bind(this); + this.state = { + imdbId: this.props.data.get("show_imdb_id"), + season: this.props.data.get("season"), + episode: this.props.data.get("episode"), + }; } - handleClick(e) { - e.preventDefault(); - if (this.props.data.get("fetching")) { - return - } - const imdbId = this.props.data.get("show_imdb_id"); - const season = this.props.data.get("season"); - const episode = this.props.data.get("episode"); - this.props.getEpisodeDetails(imdbId, season, episode); + handleFetchClick() { + if (this.props.data.get("fetching")) { return } + this.props.getEpisodeDetails(this.state.imdbId, this.state.season, this.state.episode); + } + handleAdvanceTorrentSearchClick() { + const pad = (d) => (d < 10) ? "0" + d.toString() : d.toString(); + const search = `${this.props.showName} S${pad(this.state.season)}E${pad(this.state.episode)}`; + const url = `/torrents/search/shows/${encodeURI(search)}`; + this.props.router.push(url); } render() { + const id = `${this.state.imdbId}-${this.state.season}-${this.state.episode}-refresh-dropdown`; return ( - this.handleClick(e)}> - - + + + + + + + Advanced torrent search + + + + ); } }