import React from "react" import PropTypes from "prop-types" import { Map } from "immutable" import { DownloadAndStream } from "../buttons/download" import { ImdbBadge } from "../buttons/imdb" import { Genres } from "../details/genres" import { Plot } from "../details/plot" import { PolochonMetadata } from "../details/polochon" import { Rating } from "../details/rating" import { ReleaseDate } from "../details/releaseDate" import { Runtime } from "../details/runtime" import { Title } from "../details/title" const ListDetails = (props) => { if (props.data === undefined) { return null } if (props.loading) { return null } return (
<TrackingLabel wishlisted={props.data.get("wishlisted")} trackedSeason={props.data.get("tracked_season")} trackedEpisode={props.data.get("tracked_episode")} /> <ReleaseDate date={props.data.get("year")} /> <Runtime runtime={props.data.get("runtime")} /> <Genres genres={props.data.get("genres")} /> <Rating rating={props.data.get("rating")} votes={props.data.get("votes")} /> <div> <ImdbBadge imdbId={props.data.get("imdb_id")} /> <DownloadAndStream url={props.data.get("polochon_url")} name={props.data.get("title")} subtitles={props.data.get("subtitles")} /> </div> <PolochonMetadata quality={props.data.get("quality")} releaseGroup={props.data.get("release_group")} container={props.data.get("container")} audioCodec={props.data.get("audio_codec")} videoCodec={props.data.get("video_codec")} /> <Plot plot={props.data.get("plot")} /> {props.children} </div> </div> ); } ListDetails.propTypes = { data: PropTypes.instanceOf(Map), loading: PropTypes.bool, children: PropTypes.object, }; export default ListDetails; const TrackingLabel = (props) => { let wishlistStr = props.wishlisted ? "Wishlisted" : ""; if (props.trackedEpisode !== null && props.trackedSeason !== null && props.trackedEpisode !== undefined && props.trackedSeason !== undefined) { if ((props.trackedSeason === 0) && (props.trackedEpisode === 0)) { wishlistStr = "Whole show tracked"; } else { wishlistStr = `Tracked from season ${props.trackedSeason} episode ${props.trackedEpisode}`; } } if (wishlistStr === "") { return null; } return ( <p> <span className="badge badge-secondary"> <i className="fa fa-bookmark"></i> {wishlistStr} </span> </p> ); } TrackingLabel.propTypes = { wishlisted: PropTypes.bool, trackedSeason: PropTypes.number, trackedEpisode: PropTypes.number, };