minor details

This commit is contained in:
andres alcocer
2018-11-19 02:32:28 -05:00
parent 3192982638
commit f4f5219133
12 changed files with 134 additions and 101 deletions

View File

@@ -69,14 +69,17 @@ makeAipCall = (searchItem) => {
/* Get the appropriate details for a specific movie that was clicked */
selectMovieHandler = (movie) => {
this.setState({toggleModal: true});
let url;
if (movie.media_type === "movie") {
const movieId = movie.id;
console.log(movie.id);
url = `https://api.themoviedb.org/3/movie/${movieId}?api_key=224ce27b38a3805ecf6f6c36eb3ba9d0`;
} else if (movie.media_type === "tv") {
const tvId = movie.id
url = `https://api.themoviedb.org/3/tv/${tvId}?api_key=224ce27b38a3805ecf6f6c36eb3ba9d0`;
}
axios.get(url)
.then(res => {
console.log(res);

View File

@@ -7,44 +7,44 @@ import { BrowserRouter } from "react-router-dom";
class Layout extends Component {
state = {
selectedMovie: {}
}
};
componentDidMount = () => {
this.getMovie();
}
// 71411
this.getMovie();
};
getMovie = () => {
const url = "https://api.themoviedb.org/3/tv/71411?api_key=224ce27b38a3805ecf6f6c36eb3ba9d0";
axios.get(url)
/**
* @param movieId narcos netflix series id
*/
const movieId = 63351;
const url = `https://api.themoviedb.org/3/tv/${movieId}?api_key=224ce27b38a3805ecf6f6c36eb3ba9d0`;
axios
.get(url)
.then(res => {
const movieData = res.data;
this.setState({ selectedMovie: movieData })
}).catch(error => {
console.log(error);
const movieData = res.data;
this.setState({ selectedMovie: movieData });
})
}
.catch(error => {
console.log(error);
});
};
render() {
return (
render() {
return (
<BrowserRouter>
<div className="container">
<Header movie={this.state.selectedMovie}/>
<MovieShowcase />
{/* <MovieOriginals /> */}
<Footer />
</div>
</BrowserRouter>)
}
<div className="container">
<Header movie={this.state.selectedMovie} />
<MovieShowcase />
<Footer />
</div>
</BrowserRouter>
);
}
}
export default Layout;

View File

@@ -58,7 +58,7 @@ class MovieShowcase extends Component {
}
if (movie.poster_path && movie.backdrop_path !== null) {
console.log(movieImageUrl);
const movieComponent = <MovieShowCaseRow
movieDetails={() => this.getMovieDetails(movie)}
key={movie.id}
@@ -82,8 +82,9 @@ class MovieShowcase extends Component {
axios.get(url)
.then(res => {
console.log(res);
const movieRows = this.getMovieRows(res, url);
this.setState({ trendingMovieRow: movieRows });
})
.catch(error => {
@@ -114,7 +115,7 @@ class MovieShowcase extends Component {
axios.get(url)
.then(res => {
console.log(res);
const movieRows = this.getMovieRows(res, url);
this.setState({ netflixOriginalsRow: movieRows });
})
@@ -128,7 +129,7 @@ class MovieShowcase extends Component {
axios.get(url)
.then(res => {
console.log(res);
console.log(res);
const movieRows = this.getMovieRows(res, url);
this.setState({ actionMovieRow: movieRows });
})
@@ -142,7 +143,7 @@ class MovieShowcase extends Component {
axios.get(url)
.then(res => {
console.log(res);
const movieRows = this.getMovieRows(res, url);
this.setState({ comedyMovieRow: movieRows });
})
@@ -156,7 +157,7 @@ class MovieShowcase extends Component {
axios.get(url)
.then(res => {
console.log(res);
const movieRows = this.getMovieRows(res, url);
this.setState({ horrorMovieRow: movieRows });
})
@@ -170,7 +171,7 @@ class MovieShowcase extends Component {
axios.get(url)
.then(res => {
console.log(res);
const movieRows = this.getMovieRows(res, url);
this.setState({ romanceMovieRow: movieRows });
})
@@ -184,7 +185,7 @@ class MovieShowcase extends Component {
axios.get(url)
.then(res => {
console.log(res);
const movieRows = this.getMovieRows(res, url);
this.setState({ animatedMovieRow: movieRows });
})
@@ -198,7 +199,7 @@ class MovieShowcase extends Component {
axios.get(url)
.then(res => {
console.log(res);
const movieRows = this.getMovieRows(res, url);
this.setState({ documentaryRow: movieRows });
})
@@ -212,7 +213,6 @@ class MovieShowcase extends Component {
return (
<div className="movieShowcase">
<h1 className="movieShowcase__heading">Netflix Originals</h1>
<div className="movieShowcase__container">
{this.state.netflixOriginalsRow}

View File

@@ -7,24 +7,17 @@ class movieShowcaseRow extends Component {
render() {
let netflixUrl = false;
const netflixStyle = {
height: "52rem",
}
if (this.props.url === "https://api.themoviedb.org/3/discover/tv?api_key=224ce27b38a3805ecf6f6c36eb3ba9d0&with_networks=213") {
netflixUrl = true;
}
return (
// style = { netflixUrl? netflixStyle : null}
<div onClick={this.props.movieDetails}
className={ "movieShowcase__container--movie" + (netflixUrl ? "__netflix" : "")}>
<img src={this.props.posterUrl} className="movieShowcase__container--movie-image"/>
</div>
);
}
}