Skip to content

Commit 32022f3

Browse files
committed
Siuuuuuuuuuu
1 parent 940e901 commit 32022f3

File tree

8 files changed

+44
-25
lines changed

8 files changed

+44
-25
lines changed

client/src/components/list/List.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ function List({ list, type }) {
2525
<div className="list">
2626
{type && type === "movie"
2727
? genreMapTitle(MOVIE_GENRES, list, "Movies")
28-
: genreMapTitle(TV_GENRES, list, "TV Series")}
29-
28+
: genreMapTitle(TV_GENRES, list, "TV Shows")}
3029
<span className="listTitle">{list.title}</span>
3130
<Swiper
3231
className="movieShowcase__container"

client/src/components/listItem/ListItem.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ function ListItem({ movie }) {
2525
{isClicked && (
2626
<div className={isClicked ? "listItem__active" : ""}>
2727
<div className="itemInfo">
28-
<h1 className="listItem__active_title">{movie.title}</h1>
28+
<h1 className="listItem__active_title">
29+
{movie.title || movie.name}
30+
</h1>
2931
<div className="icons">
3032
<Link to={{ pathname: "/watch" }} state={{ movie: movie }}>
3133
<PlayCircleFilledRounded className="icon" />
@@ -39,7 +41,9 @@ function ListItem({ movie }) {
3941
{movie.vote_average} Rating
4042
</span>
4143
{/* <span className="border p-1 limit">Hello</span> */}
42-
<span className="isSeries">{movie.release_date}</span>
44+
<span className="isSeries">
45+
{movie.release_date || movie.first_air_date}
46+
</span>
4347
</div>
4448
{/* <div className="itemInfoBottom pb-2">
4549
<span className="listItem__itemInfoBottom_genre">Genre</span>

client/src/components/listItem/listItem.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
.listItem__active_title {
4949
font-size: 20px;
50+
padding: 0 5px;
5051
}
5152

5253
.icon {

client/src/services/getAll.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import { shuffle } from "../utils";
2-
import { getMoviesByType } from "./getApi";
2+
import { getMoviesByType, getTVByType } from "./getApi";
33
import {
44
getLatestMovies,
5-
getMostPopularMovies,
65
getPopularMovies,
76
getTopRatedMovies,
87
getTrendingMovies,
98
getUpcomingMovies,
109
} from "./getMovies";
1110
import {
1211
getLatestTV,
13-
getMostPopularTV,
1412
getPopularTV,
1513
getTopRatedTV,
1614
getTrendingTV,
@@ -22,36 +20,38 @@ export const getAll = async (genre, setGenre, type, setIsLoading, setLists) => {
2220
let allList = [];
2321

2422
if (type) {
25-
allList.push(await getMoviesByType(genre, setGenre, type, setIsLoading));
23+
type === "movie" &&
24+
allList.push(await getMoviesByType(genre, setGenre, type, setIsLoading));
25+
26+
type === "series" &&
27+
allList.push(await getTVByType(genre, setGenre, type, setIsLoading));
2628

2729
if (type === "movie" && genre == null) {
30+
setGenre(null);
31+
2832
allList.push(
2933
await getTrendingMovies,
3034
await getUpcomingMovies,
3135
await getPopularMovies,
3236
await getTopRatedMovies,
33-
await getLatestMovies,
34-
await getMostPopularMovies
37+
await getLatestMovies
3538
);
3639
} else if (type === "series" && genre == null) {
3740
allList.push(
3841
await getTrendingTV,
3942
await getPopularTV,
40-
await getMostPopularTV,
4143
await getTopRatedTV,
4244
await getTVOnTheAir,
4345
await getTVOnTheAirToday,
4446
await getLatestTV
4547
);
46-
} else if (type === "popular" && genre == null) {
48+
} else if (type === "popular") {
4749
allList.push(
4850
await getPopularTV,
49-
await getMostPopularTV,
5051
await getLatestTV,
5152
await getUpcomingMovies,
5253
await getPopularMovies,
53-
await getLatestMovies,
54-
await getMostPopularMovies
54+
await getLatestMovies
5555
);
5656
}
5757
} else {
@@ -61,10 +61,8 @@ export const getAll = async (genre, setGenre, type, setIsLoading, setLists) => {
6161
await getPopularMovies,
6262
await getTopRatedMovies,
6363
await getLatestMovies,
64-
await getMostPopularMovies,
6564
await getTrendingTV,
6665
await getPopularTV,
67-
await getMostPopularTV,
6866
await getTopRatedTV,
6967
await getTVOnTheAir,
7068
await getTVOnTheAirToday,

client/src/services/getApi.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,27 @@ export const getByUrl = async (url, title, config) => {
7373

7474
export const getMoviesByType = async (genre, setGenre, type, setIsLoading) => {
7575
setIsLoading(true);
76-
if (genre) {
76+
try {
77+
const res = await axiosMovie.get(
78+
// `/list/${genre ? genre : type === "movie" ? 28 : 10759}`
79+
`/discover/movie?api_key=${
80+
process.env.REACT_APP_API_KEY_MOVIE
81+
}&with_genres=${genre ? genre : type === "movie" ? 28 : 10759}`
82+
);
7783
setIsLoading(false);
84+
return res.data;
85+
} catch (err) {
86+
console.log(err);
7887
}
79-
if (type) {
80-
setIsLoading(true);
81-
setGenre(null);
82-
}
88+
};
8389

90+
export const getTVByType = async (genre, setGenre, type, setIsLoading) => {
91+
setIsLoading(true);
8492
try {
8593
const res = await axiosMovie.get(
86-
`/list/${genre ? genre : type === "movie" ? 28 : 10759}`
94+
`/discover/tv?api_key=${
95+
process.env.REACT_APP_API_KEY_MOVIE
96+
}&with_genres=${genre ? genre : type === "movie" ? 28 : 10759}`
8797
);
8898
setIsLoading(false);
8999
return res.data;

client/src/services/getMovies.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export const getPopularMovies = getByUrl(
1313
"/movie/popular",
1414
"Popular on Netflix"
1515
);
16-
export const getMostPopularMovies = getByUrl("/discover/movie", "Most Popular");
1716
export const getTopRatedMovies = getByUrl(
1817
"/movie/top_rated",
1918
"Top Rated Movies"

client/src/services/getTv.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const getTrendingTV = getByUrl("/trending/tv/week", "Trending Now", {
66
},
77
});
88
export const getPopularTV = getByUrl("/tv/popular", "Popular on Netflix");
9-
export const getMostPopularTV = getByUrl("/discover/tv", "Most Popular");
109
export const getTopRatedTV = getByUrl("/tv/top_rated", "Top Rated TV Shows");
1110
export const getTVOnTheAir = getByUrl("/tv/on_the_air", "TV On The Air");
1211
export const getTVOnTheAirToday = getByUrl(

client/src/utils/constants.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,34 @@ export const NETFLIX_NETWORK_ID = 213;
44

55
export const MOVIE_GENRES = [
66
{ id: 28, name: "Action" },
7+
{ id: 12, name: "Adventure" },
8+
{ id: 16, name: "Animation" },
79
{ id: 35, name: "Comedy" },
810
{ id: 80, name: "Crime" },
911
{ id: 99, name: "Documentary" },
12+
{ id: 18, name: "Drama" },
13+
{ id: 10751, name: "Family" },
1014
{ id: 14, name: "Fantasy" },
1115
{ id: 36, name: "History" },
1216
{ id: 27, name: "Horror" },
1317
{ id: 10402, name: "Music" },
1418
{ id: 9648, name: "Mystery" },
19+
{ id: 10749, name: "Romance" },
1520
{ id: 878, name: "Science Fiction" },
21+
{ id: 10770, name: "TV Movie" },
1622
{ id: 53, name: "Thriller" },
1723
{ id: 10752, name: "War" },
1824
{ id: 37, name: "Western" },
1925
];
2026

2127
export const TV_GENRES = [
2228
{ id: 10759, name: "Action & Adventure" },
29+
{ id: 16, name: "Animation" },
2330
{ id: 35, name: "Comedy" },
2431
{ id: 80, name: "Crime" },
2532
{ id: 99, name: "Documentary" },
33+
{ id: 18, name: "Drama" },
34+
{ id: 10751, name: "Family" },
2635
{ id: 10762, name: "Kids" },
2736
{ id: 9648, name: "Mystery" },
2837
{ id: 10763, name: "News" },

0 commit comments

Comments
 (0)