import React from 'react' import Loader from '../loader/loader' import { OverlayTrigger, Tooltip } from 'react-bootstrap' export default class ShowDetails extends React.Component { componentWillMount() { this.props.fetchShowDetails(this.props.params.imdbId); } render() { // Loading if (this.props.showStore.loading) { return (); } return (
); } } function Header(props){ return (
); } function HeaderThumbnail(props){ return (
); } function HeaderDetails(props){ const imdbLink = `http://www.imdb.com/title/${props.data.imdb_id}`; return (
Title
{props.data.title}
Plot
{props.data.plot}
IMDB
Open in IMDB
Year
{props.data.year}
Rating
{props.data.rating}
); } function SeasonsList(props){ return (
{props.data.seasons.length > 0 && props.data.seasons.map(function(season, index) { return (
) })}
) } class Season extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); this.state = { colapsed: true }; } handleClick(e) { e.preventDefault(); this.setState({ colapsed: !this.state.colapsed }); } render() { return (
this.handleClick(e)}> Season {this.props.data.season} — ({this.props.data.episodes.length} episodes) {this.state.colapsed || } {this.state.colapsed && }
{this.state.colapsed || {this.props.data.episodes.map(function(episode, index) { let key = `${episode.season}-${episode.episode}`; return ( ) }, this)}
}
) } } function Episode(props) { return ( {props.data.episode} {props.data.title} {props.data.torrents && props.data.torrents.map(function(torrent, index) { let key = `${props.data.season}-${props.data.episode}-${torrent.source}-${torrent.quality}`; return ( ) })} ) } class Torrent extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick(e, url) { e.preventDefault(); this.props.addTorrent(url); } render() { return ( this.handleClick(e, this.props.data.url)} href={this.props.data.url} > {this.props.data.quality} ) } } class TrackHeader extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick(e, url) { e.preventDefault(); let wishlisted = (this.props.data.tracked_season !== null && this.props.data.tracked_episode !== null); if (wishlisted) { this.props.deleteFromWishlist(this.props.data.imdb_id); } else { this.props.addToWishlist(this.props.data.imdb_id); } } render() { let wishlisted = (this.props.data.tracked_season !== null && this.props.data.tracked_episode !== null); if (wishlisted) { let msg; if (this.props.data.tracked_season !== 0 && this.props.data.tracked_episode !== 0) { msg = (
Show tracked from season {this.props.data.tracked_season} episode {this.props.data.tracked_episode}
); } else { msg = (
Whole show tracked
); } return (
Tracking active
{msg}
this.handleClick(e)}> Untrack the show
); } else { return (
Tracking inactive
this.handleClick(e)}> Track the whole show
); } } } class TrackButton extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick(e, url) { e.preventDefault(); this.props.addToWishlist(this.props.data.show_imdb_id, this.props.data.season, this.props.data.episode); } render() { const tooltipId = `tooltip-${this.props.data.season}-${this.props.data.episode}`; const tooltip = ( Track show from here ); return ( this.handleClick(e)}> ); } } function DownloadButton(props) { if (props.data.polochon_url === "") { return null } return ( Download ); } class GetDetailsButton extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick(e, url) { e.preventDefault(); if (this.props.data.fetching) { return } this.props.updateEpisodeDetailsStore(this.props.data.show_imdb_id, this.props.data.season, this.props.data.episode); this.props.getEpisodeDetails(this.props.data.show_imdb_id, this.props.data.season, this.props.data.episode); } render() { return ( this.handleClick(e)}> {this.props.data.fetching || Refresh } {this.props.data.fetching && Refreshing } ); } }