39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import React from "react"
|
|
import PropTypes from "prop-types"
|
|
import { connect } from "react-redux"
|
|
import { List } from "immutable"
|
|
|
|
import { getEpisodeDetails } from "../../../actions/shows"
|
|
import { TorrentsButton } from "../../buttons/torrents"
|
|
import { prettyEpisodeName } from "../../../utils"
|
|
|
|
const episodeTorrentsButton = ({
|
|
torrents,
|
|
imdbId,
|
|
season,
|
|
episode,
|
|
showName,
|
|
searching,
|
|
getEpisodeDetails,
|
|
}) => (
|
|
<TorrentsButton
|
|
torrents={torrents}
|
|
searching={searching}
|
|
search={() => getEpisodeDetails(imdbId, season, episode)}
|
|
url={`#/torrents/search/shows/${
|
|
encodeURI(prettyEpisodeName(showName, season, episode))
|
|
}`}
|
|
/>
|
|
)
|
|
episodeTorrentsButton.propTypes = {
|
|
torrents: PropTypes.instanceOf(List),
|
|
showName: PropTypes.string.isRequired,
|
|
imdbId: PropTypes.string.isRequired,
|
|
episode: PropTypes.number.isRequired,
|
|
season: PropTypes.number.isRequired,
|
|
searching: PropTypes.bool.isRequired,
|
|
getEpisodeDetails: PropTypes.func.isRequired,
|
|
};
|
|
|
|
export const EpisodeTorrentsButton = connect(null, {getEpisodeDetails})(episodeTorrentsButton);
|