import React, { useEffect } from "react";
import PropTypes from "prop-types";
import { useSelector, useDispatch } from "react-redux";
import {
fetchMovieDetails,
getMovieDetails,
movieWishlistToggle,
} from "../../actions/movies";
import { searchMovieSubtitle } from "../../actions/subtitles";
import Loader from "../loader/loader";
import { Fanart } from "../details/fanart";
import { Plot } from "../details/plot";
import { Rating } from "../details/rating";
import { ReleaseDate } from "../details/releaseDate";
import { Title } from "../details/title";
import { PolochonMetadata } from "../details/polochon";
import { TrackingLabel } from "../details/tracking";
import { Genres } from "../details/genres";
import { Runtime } from "../details/runtime";
import { DownloadProgress } from "../details/downloadProgress";
import { DownloadAndStream } from "../buttons/download";
import { ImdbBadge } from "../buttons/imdb";
import { TorrentsButton } from "../buttons/torrents";
import { SubtitlesButton } from "../buttons/subtitles";
import { ShowMore } from "../buttons/showMore";
export const MovieDetails = ({ match }) => {
const dispatch = useDispatch();
const loading = useSelector((state) => state.movie.loading);
const fanartUrl = useSelector((state) => state.movie.movie.fanart);
useEffect(() => {
dispatch(fetchMovieDetails(match.params.imdbId));
}, [dispatch, match]);
if (loading) {
return