39 lines
992 B
JavaScript
39 lines
992 B
JavaScript
import React, { useEffect } from "react";
|
|
import PropTypes from "prop-types";
|
|
import { useSelector, useDispatch } from "react-redux";
|
|
|
|
import Loader from "../loader/loader";
|
|
|
|
import { Fanart } from "../details/fanart";
|
|
import { Header } from "./details/header";
|
|
import { SeasonsList } from "./details/seasons";
|
|
|
|
import { fetchShowDetails } from "../../actions/shows";
|
|
|
|
export const ShowDetails = ({ match }) => {
|
|
const dispatch = useDispatch();
|
|
const loading = useSelector((state) => state.show.loading);
|
|
const fanartUrl = useSelector((state) => state.show.show.fanart_url);
|
|
|
|
useEffect(() => {
|
|
dispatch(fetchShowDetails(match.params.imdbId));
|
|
}, [dispatch, match]);
|
|
|
|
if (loading === true) {
|
|
return <Loader />;
|
|
}
|
|
|
|
return (
|
|
<React.Fragment>
|
|
<Fanart url={fanartUrl} />
|
|
<div className="row no-gutters">
|
|
<Header />
|
|
<SeasonsList />
|
|
</div>
|
|
</React.Fragment>
|
|
);
|
|
};
|
|
ShowDetails.propTypes = {
|
|
match: PropTypes.object.isRequired,
|
|
};
|