Add button to download episode torrent
This commit is contained in:
parent
70014189d5
commit
9497995cf5
@ -13,7 +13,10 @@ export default class ShowDetails extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div className="row" id="container">
|
<div className="row" id="container">
|
||||||
<Header data={this.props.showStore.show} />
|
<Header data={this.props.showStore.show} />
|
||||||
<SeasonsList data={this.props.showStore.show} />
|
<SeasonsList
|
||||||
|
data={this.props.showStore.show}
|
||||||
|
addTorrent={this.props.addTorrent}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -35,7 +38,8 @@ function Header(props){
|
|||||||
function HeaderThumbnail(props){
|
function HeaderThumbnail(props){
|
||||||
return (
|
return (
|
||||||
<div className="col-xs-12 col-sm-2 text-center">
|
<div className="col-xs-12 col-sm-2 text-center">
|
||||||
<img src={props.data.poster_url} className="show-thumbnail thumbnail-selected img-thumbnail img-responsive"/>
|
<img src={props.data.poster_url}
|
||||||
|
className="show-thumbnail thumbnail-selected img-thumbnail img-responsive"/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -70,7 +74,10 @@ function SeasonsList(props){
|
|||||||
{props.data.seasons.length > 0 && props.data.seasons.map(function(season, index) {
|
{props.data.seasons.length > 0 && props.data.seasons.map(function(season, index) {
|
||||||
return (
|
return (
|
||||||
<div className="col-xs-12 col-sm-10 col-sm-offset-1 col-md-10 col-md-offset-1" key={index}>
|
<div className="col-xs-12 col-sm-10 col-sm-offset-1 col-md-10 col-md-offset-1" key={index}>
|
||||||
<Season data={season} />
|
<Season
|
||||||
|
data={season}
|
||||||
|
addTorrent={props.addTorrent}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
@ -109,9 +116,13 @@ class Season extends React.Component {
|
|||||||
{this.props.data.episodes.map(function(episode, index) {
|
{this.props.data.episodes.map(function(episode, index) {
|
||||||
let key = `${episode.season}-${episode.episode}`;
|
let key = `${episode.season}-${episode.episode}`;
|
||||||
return (
|
return (
|
||||||
<Episode key={key} data={episode} />
|
<Episode
|
||||||
|
key={key}
|
||||||
|
data={episode}
|
||||||
|
addTorrent={this.props.addTorrent}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
})}
|
}, this)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
}
|
}
|
||||||
@ -130,7 +141,11 @@ function Episode(props) {
|
|||||||
{props.data.torrents && props.data.torrents.map(function(torrent, index) {
|
{props.data.torrents && props.data.torrents.map(function(torrent, index) {
|
||||||
let key = `${props.data.season}-${props.data.episode}-${torrent.source}-${torrent.quality}`;
|
let key = `${props.data.season}-${props.data.episode}-${torrent.source}-${torrent.quality}`;
|
||||||
return (
|
return (
|
||||||
<Torrent data={torrent} key={key} />
|
<Torrent
|
||||||
|
data={torrent}
|
||||||
|
key={key}
|
||||||
|
addTorrent={props.addTorrent}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</span>
|
</span>
|
||||||
@ -139,12 +154,25 @@ function Episode(props) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Torrent(props) {
|
class Torrent extends React.Component {
|
||||||
return (
|
constructor(props) {
|
||||||
<span className="episode-button">
|
super(props);
|
||||||
<a type="button" className="btn btn-primary btn-xs" href={props.data.url}>
|
this.handleClick = this.handleClick.bind(this);
|
||||||
<i className="fa fa-download"></i> {props.data.quality}
|
}
|
||||||
</a>
|
handleClick(e, url) {
|
||||||
</span>
|
e.preventDefault();
|
||||||
)
|
this.props.addTorrent(url);
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<span className="episode-button">
|
||||||
|
<a type="button"
|
||||||
|
className="btn btn-primary btn-xs"
|
||||||
|
onClick={(e) => this.handleClick(e, this.props.data.url)}
|
||||||
|
href={this.props.data.url} >
|
||||||
|
<i className="fa fa-download"></i> {this.props.data.quality}
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user