Skip to content

Commit

Permalink
More comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mtalirevic1 committed Sep 6, 2021
1 parent f57d2d2 commit 20d3634
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
1 change: 1 addition & 0 deletions src/components/Actor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
//Styles
import {Wrapper, Image} from "./Actor.styles";

//Shows an actor of a movie/series
const Actor = ({name, character, imageUrl}) => (
<Wrapper>
<Image src={imageUrl} alt='actor-thumb' />
Expand Down
2 changes: 2 additions & 0 deletions src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const Home = ({fetchingMovies, setFetchingMovies, searchTerm, setSearchTerm}) =>

if (error) return <div>Something went wrong...</div>;

//Search will only happen after 3 letters are written, until then only the top movies/series are shown
//fetchingMovies determines if we are searching for movies or series
return (
<>
{state.results[0] ?
Expand Down
1 change: 1 addition & 0 deletions src/components/Thumbnail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Link} from "react-router-dom";
//Styles
import {Image, TitleBox, Wrapper} from "./Thumbnail.styles";

//Displays the movie/series image and title
const Thumbnail = ({image, movieId, movieName, clickable}) => (
<Wrapper>
{clickable ? (
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useHomeFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const useHomeFetch = (fetchingMovies, searchTerm) => {
fetchMovies(1, search);
}, [searchTerm]);

//Render when switching from movies to series
useEffect(() => {
setState(initialState);
fetchMovies(1, searchTerm);
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useMovieFetch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {useState, useEffect} from "react";
import API from "../API";

//Also fetches series if isMovie is false
export const useMovieFetch = (movieId, isMovie) => {
const [state, setState] = useState({});
const [loading, setLoading] = useState(true);
Expand All @@ -11,7 +12,7 @@ export const useMovieFetch = (movieId, isMovie) => {
try {
setLoading(true);
setError(false);
console.log(isMovie);
//Check if a movie or series has to be fetched
const movie = isMovie ? await API.fetchMovie(movieId) : await API.fetchShow(movieId);
const credits = isMovie ? await API.fetchMovieCredits(movieId) : await API.fetchShowCredits(movieId);
//Get directors
Expand Down

0 comments on commit 20d3634

Please sign in to comment.