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

27 lines
777 B
JavaScript

import React from "react";
import PropTypes from "prop-types";
import { List } from "immutable";
import { useDispatch } from "react-redux";
import { getMovieDetails } from "../../actions/movies";
import { TorrentsButton } from "../buttons/torrents";
export const MovieTorrentsButton = ({ torrents, imdbId, title, searching }) => {
const dispatch = useDispatch();
return (
<TorrentsButton
torrents={torrents}
searching={searching}
search={() => dispatch(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,
};