canape/frontend/js/components/movies/torrentsButton.js

32 lines
808 B
JavaScript

import React from "react"
import PropTypes from "prop-types"
import { List } from "immutable"
import { connect } from "react-redux"
import { getMovieDetails } from "../../actions/movies"
import { TorrentsButton } from "../buttons/torrents"
const movieTorrentsButton = ({
torrents,
imdbId,
title,
searching,
getMovieDetails,
}) => (
<TorrentsButton
torrents={torrents}
searching={searching}
search={() => getMovieDetails(imdbId)}
url={`#/torrents/search/movies/${encodeURI(title)}`}
/>
)
movieTorrentsButton.propTypes = {
torrents: PropTypes.instanceOf(List),
imdbId: PropTypes.string,
title: PropTypes.string,
searching: PropTypes.bool,
getMovieDetails: PropTypes.func,
};
export const MovieTorrentsButton = connect(null, {getMovieDetails})(movieTorrentsButton);