file: create index.js file in the components directory that contains all the...
No files matched your search
@@ -1,38 +0,0 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<></>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -0,0 +1,12 @@
|
||||
import { configureStore } from '@reduxjs/toolkit';
|
||||
import { tmdbApi } from '../services/TMDB';
|
||||
import genreOrCategoryReducer from '../features/currentGenreOrCategory';
|
||||
import userReducer from '../features/auth';
|
||||
|
||||
export default configureStore({
|
||||
reducer: {
|
||||
[tmdbApi.reducerPath]: tmdbApi.reducer,
|
||||
currentGenreOrCategory: genreOrCategoryReducer,
|
||||
user: userReducer,
|
||||
},
|
||||
});
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,48 @@
|
||||
import action from './action.png';
|
||||
import adventure from './adventure.png';
|
||||
import animation from './animation.png';
|
||||
import comedy from './comedy.png';
|
||||
import crime from './crime.png';
|
||||
import documentary from './documentary.png';
|
||||
import drama from './drama.png';
|
||||
import family from './family.png';
|
||||
import fantasy from './fantasy.png';
|
||||
import horror from './horror.png';
|
||||
import history from './history.png';
|
||||
import mystery from './mystery.png';
|
||||
import music from './music.png';
|
||||
import romance from './romance.png';
|
||||
import scienceFiction from './science fiction.png';
|
||||
import thriller from './thriller.png';
|
||||
import tvMovie from './tv movie.png';
|
||||
import war from './war.png';
|
||||
import western from './western.png';
|
||||
|
||||
import popular from './popular.png';
|
||||
import topRated from './top rated.png';
|
||||
import upcoming from './upcoming.png';
|
||||
|
||||
export default {
|
||||
action,
|
||||
adventure,
|
||||
animation,
|
||||
comedy,
|
||||
crime,
|
||||
documentary,
|
||||
drama,
|
||||
family,
|
||||
fantasy,
|
||||
horror,
|
||||
history,
|
||||
mystery,
|
||||
music,
|
||||
romance,
|
||||
'science fiction': scienceFiction,
|
||||
thriller,
|
||||
'tv movie': tvMovie,
|
||||
war,
|
||||
western,
|
||||
popular,
|
||||
'top rated': topRated,
|
||||
upcoming,
|
||||
};
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 376 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 376 B |
|
After Width: | Height: | Size: 934 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 245 KiB |
|
After Width: | Height: | Size: 34 KiB |
@@ -0,0 +1 @@
|
||||
<svg id="a01bbba8-bc2d-4e66-a086-829e28c11719" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="719.76946" height="687.25" viewBox="0 0 719.76946 687.25"><title>home_cinema</title><path d="M908.88473,288.962V250.375h-6v38.587a8,8,0,1,0,6,0Z" transform="translate(-240.11527 -106.375)" fill="#e6e6e6"/><path d="M922.88473,678.375h-41v-498h-16v498H824.88467a36.99993,36.99993,0,0,0-36.99994,36.99994v.00006h172v-.00006A36.99994,36.99994,0,0,0,922.88473,678.375Z" transform="translate(-240.11527 -106.375)" fill="#774C60"/><path d="M787.96774,254.375h171.834L949.29391,123.03467A18.19786,18.19786,0,0,0,931.248,106.375H816.52145a18.19786,18.19786,0,0,0-18.0459,16.65967Z" transform="translate(-240.11527 -106.375)" fill="#5F3D4D"/><path d="M301.21292,563.91061H825.69163V510.36435c0-144.59875-117.6406-262.23935-262.23935-262.23935S301.21292,365.7656,301.21292,510.36435Z" transform="translate(-240.11527 -106.375)" fill="#774C60"/><path d="M301.21292,563.91061H825.69163V510.36435c0-144.59875-117.6406-262.23935-262.23935-262.23935S301.21292,365.7656,301.21292,510.36435Z" transform="translate(-240.11527 -106.375)" opacity="0.2"/><path d="M369.18754,582.44585H772.8198A81.09742,81.09742,0,0,0,691.826,502.813H450.18135A81.09742,81.09742,0,0,0,369.18754,582.44585Z" transform="translate(-240.11527 -106.375)" fill="#6c63ff"/><circle cx="81.00587" cy="386.82709" r="81.00587" fill="#3f3d56"/><circle cx="572.53304" cy="386.82709" r="81.00587" fill="#3f3d56"/><path d="M751.55066,534.39152V564.5971H377.41336V534.39152H293.66153V681.614a34.011,34.011,0,0,0,34.011,34.011H801.29139a34.011,34.011,0,0,0,34.01111-34.011V534.39152Z" transform="translate(-240.11527 -106.375)" fill="#3f3d56"/><circle cx="81.00587" cy="386.82709" r="16.47577" opacity="0.2"/><circle cx="572.53304" cy="386.82709" r="16.47577" opacity="0.2"/><path d="M593.29318,238.87148s1.61972,30.77465,12.95775,37.25352,0,50.21127,0,50.21127L552.80022,327.956l-3.23944-51.831s6.47888-21.05634,3.23944-30.77465S593.29318,238.87148,593.29318,238.87148Z" transform="translate(-240.11527 -106.375)" fill="#ffb8b8"/><polygon points="413.107 560.102 393.671 582.778 424.446 611.933 440.643 579.539 413.107 560.102" fill="#ffb8b8"/><polygon points="275.431 560.102 294.868 582.778 264.093 611.933 247.896 579.539 275.431 560.102" fill="#ffb8b8"/><path d="M642.69459,451.86444s116.61972,38.87324,110.14084,76.12676-56.69014,168.4507-56.69014,168.4507-27.53521,0-48.59155-29.15493l14.57747-32.39436s-6.47888-17.81691,4.85915-21.05634,17.8169-59.92958,17.8169-59.92958-82.60563-6.47887-100.42253-37.25352l-32.39437-77.74648Z" transform="translate(-240.11527 -106.375)" fill="#2f2e41"/><path d="M526.07487,451.86444S409.45515,490.73768,415.934,527.9912s56.69014,168.4507,56.69014,168.4507,27.53522,0,48.59155-29.15493l-14.57746-32.39436s6.47887-17.81691-4.85916-21.05634-17.8169-59.92958-17.8169-59.92958,82.60564-6.47887,100.42254-37.25352l32.39436-77.74648Z" transform="translate(-240.11527 -106.375)" fill="#2f2e41"/><path d="M658.89177,706.16021s16.19718-14.57746,17.8169-3.23944-1.61972,56.69015-1.61972,56.69015,16.19719,34.01408-8.09859,34.01408-35.6338-25.91549-32.39436-51.831-11.338-35.6338-11.338-35.6338-17.8169-35.6338,0-38.87324,24.29577,4.85916,24.29577,4.85916S641.07487,701.30106,658.89177,706.16021Z" transform="translate(-240.11527 -106.375)" fill="#2f2e41"/><path d="M509.87769,706.16021s-16.19719-14.57746-17.81691-3.23944,1.61972,56.69015,1.61972,56.69015S477.48332,793.625,501.77909,793.625s35.63381-25.91549,32.39437-51.831,11.338-35.6338,11.338-35.6338,17.8169-35.6338,0-38.87324-24.29578,4.85916-24.29578,4.85916S527.69459,701.30106,509.87769,706.16021Z" transform="translate(-240.11527 -106.375)" fill="#2f2e41"/><circle cx="328.07227" cy="113.86972" r="37.25352" fill="#ffb8b8"/><path d="M573.85656,284.22359l-22.67606-17.8169-55.07042,25.91549-1.61972,147.39437s-34.01408,16.19718-24.29577,37.25352c0,0,29.15493,6.47887,42.11267,19.43662s85.84507-4.85915,116.61972-14.57746,38.87324-21.05634,38.87324-21.05634l-30.77465-43.7324,17.8169-111.76056L599.7782,268.25887Z" transform="translate(-240.11527 -106.375)" fill="#e6e6e6"/><path d="M613.47841,194.88912a32.72327,32.72327,0,0,1-2.22094-3.4469c-1.15512-2.81332.66946-6.12871-1.03543-8.75574-1.7404-2.68175-6.15869-3.24731-9.16482-5.06919-4.63088-2.80657-5.47263-8.31373-9.81145-11.40651-3.12615-2.22838-7.58418-2.82906-11.76168-2.70194s-8.29915.88239-12.47838.96527a37.62165,37.62165,0,0,1-16.3771-3.34911l3.08305,6.03082a30.7761,30.7761,0,0,1-9.678-3.92278c-1.3636,1.69136,1.1312,4.25855-.41564,5.845a4.96343,4.96343,0,0,1-2.18434,1.01281,52.24553,52.24553,0,0,0-16.53785,8.06827,8.31019,8.31019,0,0,0-2.78289,2.93788c-.8036,1.7809-.09107,3.74785-.15191,5.64139-.11054,3.44069-2.73736,6.441-4.60127,9.54054s-2.87034,7.118-.10591,9.74867a25.13472,25.13472,0,0,1,1.9317,1.70333c2.76984,3.26725-2.1332,8.052.23,11.51909,1.02607,1.50533,3.1292,2.26716,4.95713,3.15648a19.80713,19.80713,0,0,1,8.4742,7.55282L531.42613,219.531a1.72023,1.72023,0,0,1,.2829-1.519c.Line truncated
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 2.8 MiB |
@@ -0,0 +1 @@
|
||||
<svg id="f89af28b-111d-4872-814f-cbbc169855b4" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="867.10818" height="500.05662" viewBox="0 0 867.10818 500.05662"><defs><clipPath id="a1708186-1525-433e-878d-7c35f03ac629" transform="translate(-166.44591 -199.97169)"><path d="M695.14831,283.9783l-6.77-16.49-90.27,37.06a11.15,11.15,0,0,0-6.91,10.31v97.53h17.83v-93.03Z" fill="none"/></clipPath><linearGradient id="feb2277d-7772-4d61-b1af-dc7db61f73e8" x1="916.58831" y1="601.91813" x2="916.58831" y2="667.79812" gradientTransform="matrix(1, 0, 0, -1, -166.44591, 702.02831)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-opacity="0.12"/><stop offset="0.55" stop-opacity="0.09"/><stop offset="1" stop-opacity="0.02"/></linearGradient></defs><title>movie_night</title><path d="M14.95531,192.03591H300.15287a14,14,0,0,1,14,14v22.23774a0,0,0,0,1,0,0H.95533a0,0,0,0,1,0,0V206.0359A14,14,0,0,1,14.95531,192.03591Z" fill="#3f3d56"/><path d="M461.18569,389.41919a12.84166,12.84166,0,0,0-4.13933.70477,7.75132,7.75132,0,0,0-15.27374,1.88364c0,.03871.00964.07457.01043.11312a13.30859,13.30859,0,0,0-2.85556.59165,7.794,7.794,0,0,0-3.83869-4.94648,12.98613,12.98613,0,0,0,5.60148-6.13088c6.33278-.103,11.436-4.68107,11.436-10.33468,0-5.71823-5.21489-10.35364-11.64784-10.35364a12.84177,12.84177,0,0,0-4.13934.70477,7.73969,7.73969,0,1,0-14.88067,4.20632c-.30949.21533-.59812.4572-.88739.69781a7.34987,7.34987,0,0,0-5.2931-1.76183,12.89142,12.89142,0,0,0-25.06384,4.01374,13.24765,13.24765,0,0,0-3.05478.60918,7.76417,7.76417,0,0,0-.44646-1.27745,9.72676,9.72676,0,0,0,3.2916-7.19254c0-5.71823-5.2149-10.35364-11.64784-10.35364a12.842,12.842,0,0,0-4.13934.70477,7.73969,7.73969,0,1,0-14.88067,4.20632,12.90859,12.90859,0,0,0-5.53212,10.01508c-.10949.09732-.23493.176-.33872.27932a9.2223,9.2223,0,0,0,.301-2.26344c0-5.71823-5.2149-10.35364-11.64784-10.35364a12.84172,12.84172,0,0,0-4.13934.70477,7.73969,7.73969,0,1,0-14.88067,4.20632,12.90822,12.90822,0,0,0,0,21.23873,7.05915,7.05915,0,0,0,0,4.64536,13.06918,13.06918,0,0,0-3.3115,3.34373,7.71691,7.71691,0,0,0-15.12049,1.30685,12.33158,12.33158,0,0,0-3.32777-1.34445A13.01113,13.01113,0,0,0,306.093,381.635c6.33279-.103,11.436-4.68107,11.436-10.33468,0-5.71823-5.2149-10.35364-11.64785-10.35364a12.84171,12.84171,0,0,0-4.13933.70477,7.73969,7.73969,0,1,0-14.88067,4.20632c-.166.11549-.31565.25135-.476.37426-.4038-.0376-.79639-.10853-1.21126-.10853a12.842,12.842,0,0,0-4.13934.70476c-.049-.19526-.12954-.37647-.19274-.56558a7.6278,7.6278,0,0,0-7.92637-9.23416,12.92962,12.92962,0,1,0-20.32085,14.40561,13.39192,13.39192,0,0,0-2.62095.57095A7.69523,7.69523,0,0,0,237.648,367.8419a12.10286,12.10286,0,0,0-9.41916-4.3068,12.84172,12.84172,0,0,0-4.13934.70477,7.73969,7.73969,0,1,0-14.88067,4.20632,12.91366,12.91366,0,0,0-5.56988,10.61936c0,.04013.01153.07694.01185.11691a10.73636,10.73636,0,0,0-5.4454.58786,7.73968,7.73968,0,1,0-14.88066,4.20632,12.889,12.889,0,0,0,10.1868,23.21749,12.89592,12.89592,0,0,0,24.36729,3.31039,12.8992,12.8992,0,0,0,23.50391-.397,12.87909,12.87909,0,0,0,4.45736-.86291,12.8957,12.8957,0,0,0,24.01514.86291,12.66149,12.66149,0,0,0,5.429-1.34334,12.88273,12.88273,0,0,0,23.04354-1.24507,13.04794,13.04794,0,0,0,2.06959-.2166,12.92926,12.92926,0,0,0,23.81451.2166,12.88231,12.88231,0,0,0,3.0077-.44362,12.61784,12.61784,0,0,0,14.01507-5.35218,12.93614,12.93614,0,0,0,24.39178,8.38421,12.66152,12.66152,0,0,0,5.429-1.34334,12.88273,12.88273,0,0,0,23.04354-1.24507,12.66149,12.66149,0,0,0,5.429-1.34334,12.8073,12.8073,0,0,0,19.18652,3.71879,12.887,12.887,0,0,0,23.0527,5.3457,12.85359,12.85359,0,0,0,19.63046-5.13274c6.33279-.103,11.436-4.68107,11.436-10.33468C472.83354,394.0546,467.61864,389.41919,461.18569,389.41919ZM229.8384,384.07712c-.01359.06241-.02307.12639-.03587.18927-.09447-.00348-.184-.024-.27947-.024a7.70783,7.70783,0,0,0-1.15328.11628c.021-.04661.05055-.08831.07093-.13523A12.88755,12.88755,0,0,0,229.8384,384.07712Zm108.14113-4.3068c-.03776-.15072-.10238-.28927-.14867-.43635a13.00467,13.00467,0,0,0,4.49986-5.46419,12.1173,12.1173,0,0,0,8.9994-4.075,7.78885,7.78885,0,0,0-.15182,1.50559,7.68,7.68,0,0,0,.39306,2.32268,12.98976,12.98976,0,0,0-4.81156,6.30782,12.70178,12.70178,0,0,0-8.78027-.16051Zm77.52384.96513c-.00522-.15862.01453-.32213.0041-.47964a7.72736,7.72736,0,0,0,.98646-.067,12.82884,12.82884,0,0,0,2.46581,4.56779c-.2444.06857-.5016.1098-.73952.19053A7.80593,7.80593,0,0,0,415.50337,380.73545Z" transform="translate(-166.44591 -199.97169)" fill="#f9a825"/><path d="M193.47491,404.94965a27.02565,27.02565,0,0,0-26.98872,28.47756l17.52738,241.02034a27.02449,27.02449,0,0,0,26.98871,25.58076H436.99772a27.02449,27.02449,0,0,0,26.98871-25.58076l17.52738-241.02034a27.02565,27.02565,0,0,0-26.98872-28.47756Z" transform="translate(-166.44591 -199.97169)" fill="#3f3d56"/><rect x="39.78147" y="204.97796" width="15.53046" height="295.07866" fill="#6c63ff"/><rect x="83.78442" y="204.97796" width="15.53046" height="295.07866" fill="#6c63ff"/><rect x=Line truncated
|
||||
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 38 KiB |
@@ -0,0 +1 @@
|
||||
<svg id="a01bbba8-bc2d-4e66-a086-829e28c11719" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="719.76946" height="687.25" viewBox="0 0 719.76946 687.25"><title>home_cinema</title><path d="M908.88473,288.962V250.375h-6v38.587a8,8,0,1,0,6,0Z" transform="translate(-240.11527 -106.375)" fill="#e6e6e6"/><path d="M922.88473,678.375h-41v-498h-16v498H824.88467a36.99993,36.99993,0,0,0-36.99994,36.99994v.00006h172v-.00006A36.99994,36.99994,0,0,0,922.88473,678.375Z" transform="translate(-240.11527 -106.375)" fill="#774C60"/><path d="M787.96774,254.375h171.834L949.29391,123.03467A18.19786,18.19786,0,0,0,931.248,106.375H816.52145a18.19786,18.19786,0,0,0-18.0459,16.65967Z" transform="translate(-240.11527 -106.375)" fill="#FFFF80"/><path d="M301.21292,563.91061H825.69163V510.36435c0-144.59875-117.6406-262.23935-262.23935-262.23935S301.21292,365.7656,301.21292,510.36435Z" transform="translate(-240.11527 -106.375)" fill="#774C60"/><path d="M301.21292,563.91061H825.69163V510.36435c0-144.59875-117.6406-262.23935-262.23935-262.23935S301.21292,365.7656,301.21292,510.36435Z" transform="translate(-240.11527 -106.375)" opacity="0.2"/><path d="M369.18754,582.44585H772.8198A81.09742,81.09742,0,0,0,691.826,502.813H450.18135A81.09742,81.09742,0,0,0,369.18754,582.44585Z" transform="translate(-240.11527 -106.375)" fill="#6c63ff"/><circle cx="81.00587" cy="386.82709" r="81.00587" fill="#3f3d56"/><circle cx="572.53304" cy="386.82709" r="81.00587" fill="#3f3d56"/><path d="M751.55066,534.39152V564.5971H377.41336V534.39152H293.66153V681.614a34.011,34.011,0,0,0,34.011,34.011H801.29139a34.011,34.011,0,0,0,34.01111-34.011V534.39152Z" transform="translate(-240.11527 -106.375)" fill="#3f3d56"/><circle cx="81.00587" cy="386.82709" r="16.47577" opacity="0.2"/><circle cx="572.53304" cy="386.82709" r="16.47577" opacity="0.2"/><path d="M593.29318,238.87148s1.61972,30.77465,12.95775,37.25352,0,50.21127,0,50.21127L552.80022,327.956l-3.23944-51.831s6.47888-21.05634,3.23944-30.77465S593.29318,238.87148,593.29318,238.87148Z" transform="translate(-240.11527 -106.375)" fill="#ffb8b8"/><polygon points="413.107 560.102 393.671 582.778 424.446 611.933 440.643 579.539 413.107 560.102" fill="#ffb8b8"/><polygon points="275.431 560.102 294.868 582.778 264.093 611.933 247.896 579.539 275.431 560.102" fill="#ffb8b8"/><path d="M642.69459,451.86444s116.61972,38.87324,110.14084,76.12676-56.69014,168.4507-56.69014,168.4507-27.53521,0-48.59155-29.15493l14.57747-32.39436s-6.47888-17.81691,4.85915-21.05634,17.8169-59.92958,17.8169-59.92958-82.60563-6.47887-100.42253-37.25352l-32.39437-77.74648Z" transform="translate(-240.11527 -106.375)" fill="#2f2e41"/><path d="M526.07487,451.86444S409.45515,490.73768,415.934,527.9912s56.69014,168.4507,56.69014,168.4507,27.53522,0,48.59155-29.15493l-14.57746-32.39436s6.47887-17.81691-4.85916-21.05634-17.8169-59.92958-17.8169-59.92958,82.60564-6.47887,100.42254-37.25352l32.39436-77.74648Z" transform="translate(-240.11527 -106.375)" fill="#2f2e41"/><path d="M658.89177,706.16021s16.19718-14.57746,17.8169-3.23944-1.61972,56.69015-1.61972,56.69015,16.19719,34.01408-8.09859,34.01408-35.6338-25.91549-32.39436-51.831-11.338-35.6338-11.338-35.6338-17.8169-35.6338,0-38.87324,24.29577,4.85916,24.29577,4.85916S641.07487,701.30106,658.89177,706.16021Z" transform="translate(-240.11527 -106.375)" fill="#2f2e41"/><path d="M509.87769,706.16021s-16.19719-14.57746-17.81691-3.23944,1.61972,56.69015,1.61972,56.69015S477.48332,793.625,501.77909,793.625s35.63381-25.91549,32.39437-51.831,11.338-35.6338,11.338-35.6338,17.8169-35.6338,0-38.87324-24.29578,4.85916-24.29578,4.85916S527.69459,701.30106,509.87769,706.16021Z" transform="translate(-240.11527 -106.375)" fill="#2f2e41"/><circle cx="328.07227" cy="113.86972" r="37.25352" fill="#ffb8b8"/><path d="M573.85656,284.22359l-22.67606-17.8169-55.07042,25.91549-1.61972,147.39437s-34.01408,16.19718-24.29577,37.25352c0,0,29.15493,6.47887,42.11267,19.43662s85.84507-4.85915,116.61972-14.57746,38.87324-21.05634,38.87324-21.05634l-30.77465-43.7324,17.8169-111.76056L599.7782,268.25887Z" transform="translate(-240.11527 -106.375)" fill="#e6e6e6"/><path d="M613.47841,194.88912a32.72327,32.72327,0,0,1-2.22094-3.4469c-1.15512-2.81332.66946-6.12871-1.03543-8.75574-1.7404-2.68175-6.15869-3.24731-9.16482-5.06919-4.63088-2.80657-5.47263-8.31373-9.81145-11.40651-3.12615-2.22838-7.58418-2.82906-11.76168-2.70194s-8.29915.88239-12.47838.96527a37.62165,37.62165,0,0,1-16.3771-3.34911l3.08305,6.03082a30.7761,30.7761,0,0,1-9.678-3.92278c-1.3636,1.69136,1.1312,4.25855-.41564,5.845a4.96343,4.96343,0,0,1-2.18434,1.01281,52.24553,52.24553,0,0,0-16.53785,8.06827,8.31019,8.31019,0,0,0-2.78289,2.93788c-.8036,1.7809-.09107,3.74785-.15191,5.64139-.11054,3.44069-2.73736,6.441-4.60127,9.54054s-2.87034,7.118-.10591,9.74867a25.13472,25.13472,0,0,1,1.9317,1.70333c2.76984,3.26725-2.1332,8.052.23,11.51909,1.02607,1.50533,3.1292,2.26716,4.95713,3.15648a19.80713,19.80713,0,0,1,8.4742,7.55282L531.42613,219.531a1.72023,1.72023,0,0,1,.2829-1.519c.Line truncated
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,65 @@
|
||||
import { useState } from 'react';
|
||||
import { Box, Button, CircularProgress, Grid, Typography } from '@mui/material';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { ArrowBack } from '@mui/icons-material';
|
||||
|
||||
import useStyles from './styles';
|
||||
import { useGetActorQuery, useGetMoviesByActorIdQuery } from '../../services/TMDB';
|
||||
import { MovieList, Pagination } from '../index';
|
||||
|
||||
function Actors() {
|
||||
const classes = useStyles();
|
||||
const [page, setPage] = useState(1);
|
||||
const navigate = useNavigate();
|
||||
const { id } = useParams();
|
||||
const { data, isFetching, error } = useGetActorQuery(id);
|
||||
const { data: movies } = useGetMoviesByActorIdQuery({ id, page });
|
||||
|
||||
if (isFetching) {
|
||||
return (
|
||||
<Box display="flex" alignItems="center" justifyContent="center">
|
||||
<CircularProgress size="8rem" />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Box display="flex" alignItems="center" justifyContent="center">
|
||||
<Button startIcon={<ArrowBack />} onClick={() => navigate(-1)} color="primary">
|
||||
Go Back
|
||||
</Button>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Grid container spacing={3}>
|
||||
<Grid item lg={5} xl={4}>
|
||||
<img
|
||||
className={classes.image}
|
||||
src={`https://image.tmdb.org/t/p/w780/${data?.profile_path}`}
|
||||
alt={data.name}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item lg={7} xl={8} style={{ display: 'flex', justifyContent: 'center', flexDirection: 'column' }}>
|
||||
<Typography variant="h2" gutterBottom>{data?.name}</Typography>
|
||||
<Typography variant="h5" gutterBottom>Born: {new Date(data?.birthday).toDateString()}</Typography>
|
||||
<Typography variant="body1" align="justify" paragraph>{data?.biography || 'Sorry, no biography yet...'}</Typography>
|
||||
<Box className={classes.btns}>
|
||||
<Button variant="contained" color="primary" target="_blank" href={`https://www.imdb.com/name/${data?.imdb_id}`}>IMDB</Button>
|
||||
<Button startIcon={<ArrowBack />} onClick={() => navigate(-1)} color="primary">Back</Button>
|
||||
</Box>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Box margin="2rem 0">
|
||||
<Typography variant="h2" gutterBottom align="center">Movies</Typography>
|
||||
{movies && <MovieList movies={movies} numberOfMovies={12} />}
|
||||
<Pagination currentPage={page} setPage={setPage} totalPages={movies?.total_pages} />
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Actors;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles(() => ({
|
||||
image: {
|
||||
maxWidth: '90%',
|
||||
borderRadius: '20px',
|
||||
objectFit: 'cover',
|
||||
boxShadow: '0.5em 0.5em 1em',
|
||||
},
|
||||
btns: {
|
||||
marginTop: '2rem',
|
||||
display: 'flex',
|
||||
justifyContent: 'space-around',
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,48 @@
|
||||
import { useEffect, useContext } from 'react';
|
||||
import alanBtn from '@alan-ai/alan-sdk-web';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { ColorModeContext } from '../utils/ToggleColorMode';
|
||||
import { fetchToken } from '../utils/index';
|
||||
import { selectGenreOrCategory, searchMovie } from '../features/currentGenreOrCategory';
|
||||
|
||||
function useAlan() {
|
||||
const { setMode } = useContext(ColorModeContext);
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
alanBtn({
|
||||
key: process.env.REACT_APP_ALAN_SDK_KEY,
|
||||
onCommand: ({ command, mode, genres, genreOrCategory, query }) => {
|
||||
if (command === 'chooseGenre') {
|
||||
const foundGenre = genres.find((g) => g.name.toLowerCase() === genreOrCategory.toLowerCase());
|
||||
if (foundGenre) {
|
||||
navigate('/');
|
||||
dispatch(selectGenreOrCategory(foundGenre.id));
|
||||
} else {
|
||||
const category = genreOrCategory.startsWith('top') ? 'top_rated' : genreOrCategory;
|
||||
navigate('/');
|
||||
dispatch(selectGenreOrCategory(category));
|
||||
}
|
||||
} else if (command === 'changeMode') {
|
||||
if (mode === 'light') {
|
||||
setMode('light');
|
||||
} else {
|
||||
setMode('dark');
|
||||
}
|
||||
} else if (command === 'login') {
|
||||
fetchToken();
|
||||
} else if (command === 'logout') {
|
||||
localStorage.clear();
|
||||
navigate('/');
|
||||
} else if (command === 'search') {
|
||||
dispatch(searchMovie(query));
|
||||
}
|
||||
},
|
||||
});
|
||||
}, []);
|
||||
}
|
||||
|
||||
export default useAlan;
|
||||
@@ -0,0 +1,36 @@
|
||||
import { useRef } from 'react';
|
||||
import { CssBaseline} from "@mui/material";
|
||||
import { Routes, Route } from 'react-router-dom';
|
||||
|
||||
import useStyles from './styles';
|
||||
import useAlan from './Alan';
|
||||
|
||||
import { Actors, Movies, MovieInfo, Navbar, Profile } from './index'
|
||||
|
||||
function App() {
|
||||
const classes = useStyles();
|
||||
const alanBtnContainer = useRef();
|
||||
|
||||
useAlan();
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<CssBaseline />
|
||||
<Navbar />
|
||||
<main className={classes.content}>
|
||||
<div className={classes.toolbar}>
|
||||
<Routes>
|
||||
<Route exact path={'/'} element={<Movies />}/>
|
||||
<Route exact path={'/approved'} element={<Movies />}/>
|
||||
<Route exact path={'/movie/:id'} element={<MovieInfo />}/>
|
||||
<Route exact path={'/actors/:id'} element={<Actors />}/>
|
||||
<Route exact path={'/profile/:id'} element={<Profile />}/>
|
||||
</Routes>
|
||||
</div>
|
||||
</main>
|
||||
<div ref={alanBtnContainer}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Box, Typography, Card, CardContent, CardMedia } from '@mui/material';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import useStyles from './styles';
|
||||
|
||||
function FeaturedMovie({ movie }) {
|
||||
const classes = useStyles();
|
||||
|
||||
if (!movie) return null;
|
||||
|
||||
return (
|
||||
<Box component={Link} to={`/movie/${movie.id}`} className={classes.featuredCardContainer}>
|
||||
<Card className={classes.card} classes={{ root: classes.cardRoot }}>
|
||||
<CardMedia
|
||||
media="picture"
|
||||
alt={movie.title}
|
||||
image={`https://image.tmdb.org/t/p/original/${movie?.backdrop_path}`}
|
||||
title={movie.title}
|
||||
className={classes.cardMedia}
|
||||
/>
|
||||
<Box padding="20px">
|
||||
<CardContent className={classes.cardContent} classes={{ root: classes.cardContentRoot }}>
|
||||
<Typography variant="h5" gutterBottom>{movie.title}</Typography>
|
||||
<Typography variant="body2">{movie.overview}</Typography>
|
||||
</CardContent>
|
||||
</Box>
|
||||
</Card>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default FeaturedMovie;
|
||||
@@ -0,0 +1,40 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles((theme) => ({
|
||||
featuredCardContainer: {
|
||||
marginBottom: '20px',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
height: '490px',
|
||||
textDecoration: 'none',
|
||||
},
|
||||
card: {
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
justifyContent: 'flex-end',
|
||||
flexDirection: 'column',
|
||||
},
|
||||
cardRoot: {
|
||||
position: 'relative',
|
||||
},
|
||||
cardMedia: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
backgroundColor: 'rgba(0,0,0,0.575)',
|
||||
backgroundBlendMode: 'darken',
|
||||
},
|
||||
cardContent: {
|
||||
color: '#fff',
|
||||
width: '40%',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
cardContentRoot: {
|
||||
position: 'relative',
|
||||
backgroundColor: 'transparent',
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Typography, Grid, Grow, Tooltip, Rating } from '@mui/material';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import useStyles from './styles';
|
||||
|
||||
function Movie({ movie, i }) {
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<Grid item xs={12} sm={6} md={4} lg={3} xl={2} className={classes.movie}>
|
||||
<Grow in key={i} timeout={(i + 1) * 250}>
|
||||
<Link className={classes.links} to={`/movie/${movie.id}`}>
|
||||
<img
|
||||
src={movie.poster_path ? `https://image.tmdb.org/t/p/w500/${movie.poster_path}` : 'https://www.fillmurray.com/200/300'}
|
||||
alt={movie.title}
|
||||
className={classes.image}
|
||||
/>
|
||||
<Typography className={classes.title} variant="h5">{movie.title}</Typography>
|
||||
<Tooltip disableTouchListener title={`${movie.vote_average} / 10`}>
|
||||
<div>
|
||||
<Rating readOnly value={movie.vote_average / 2} precision={0.1} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</Link>
|
||||
</Grow>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
|
||||
export default Movie;
|
||||
@@ -0,0 +1,37 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles((theme) => ({
|
||||
movie: {
|
||||
padding: '10px',
|
||||
},
|
||||
title: {
|
||||
color: theme.palette.text.primary,
|
||||
textOverflow: 'ellipsis',
|
||||
width: '230px',
|
||||
overflow: 'hidden',
|
||||
whiteSpace: 'nowrap',
|
||||
marginTop: '10px',
|
||||
marginBottom: 0,
|
||||
textAlign: 'center',
|
||||
},
|
||||
links: {
|
||||
alignItems: 'center',
|
||||
fontWeight: 'bolder',
|
||||
textDecoration: 'none',
|
||||
[theme.breakpoints.up('xs')]: {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
},
|
||||
'&:hover': {
|
||||
cursor: 'pointer',
|
||||
},
|
||||
},
|
||||
image: {
|
||||
borderRadius: '20px',
|
||||
height: '300px',
|
||||
marginBottom: '10px',
|
||||
'&:hover': {
|
||||
transform: 'scale(1.05)',
|
||||
},
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,181 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Modal, Typography, Button, ButtonGroup, Grid, Box, CircularProgress, Rating } from '@mui/material';
|
||||
import { Movie as MovieIcon, Theaters, Language, PlusOne, Favorite, FavoriteBorderOutlined, Remove, ArrowBack } from '@mui/icons-material';
|
||||
import { Link, useParams } from 'react-router-dom';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import axios from 'axios';
|
||||
|
||||
import useStyles from './styles';
|
||||
import { MovieList } from '../index';
|
||||
import { useGetMovieQuery, useGetRecommendationsQuery, useGetListQuery } from '../../services/TMDB';
|
||||
import { selectGenreOrCategory } from '../../features/currentGenreOrCategory';
|
||||
import genreIcons from '../../assets/genres';
|
||||
|
||||
function MovieInfo() {
|
||||
const classes = useStyles();
|
||||
const dispatch = useDispatch();
|
||||
const { user } = useSelector((state) => state.user);
|
||||
const { id } = useParams();
|
||||
|
||||
const { data, error, isFetching } = useGetMovieQuery(id);
|
||||
const { data: favoriteMovies } = useGetListQuery({ listName: 'favorite/movies', accountId: user.id, sessionId: localStorage.getItem('session_id'), page: 1 });
|
||||
const { data: watchlistMovies } = useGetListQuery({ listName: 'watchlist/movies', accountId: user.id, sessionId: localStorage.getItem('session_id'), page: 1 });
|
||||
const { data: recommendations } = useGetRecommendationsQuery({ list: '/recommendations', movie_id: id });
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const [isMovieFavorited, setIsMovieFavorited] = useState(false);
|
||||
const [isMovieWatchlisted, setIsMovieWatchlisted] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setIsMovieFavorited(!!favoriteMovies?.results?.find((movie) => movie?.id === data?.id));
|
||||
}, [favoriteMovies, data]);
|
||||
useEffect(() => {
|
||||
setIsMovieWatchlisted(!!watchlistMovies?.results?.find((movie) => movie?.id === data?.id));
|
||||
}, [watchlistMovies, data]);
|
||||
|
||||
const addToFavorites = async () => {
|
||||
await axios.post(`https://api.themoviedb.org/3/account/${user.id}/favorite?api_key=${process.env.REACT_APP_TMDB_KEY}&session_id=${localStorage.getItem('session_id')}`, {
|
||||
media_type: 'movie',
|
||||
media_id: id,
|
||||
favorite: !isMovieFavorited,
|
||||
});
|
||||
|
||||
setIsMovieFavorited((prev) => !prev);
|
||||
};
|
||||
|
||||
const addToWatchList = async () => {
|
||||
await axios.post(`https://api.themoviedb.org/3/account/${user.id}/watchlist?api_key=${process.env.REACT_APP_TMDB_KEY}&session_id=${localStorage.getItem('session_id')}`, {
|
||||
media_type: 'movie',
|
||||
media_id: id,
|
||||
watchlist: !isMovieWatchlisted,
|
||||
});
|
||||
|
||||
setIsMovieWatchlisted((prev) => !prev);
|
||||
};
|
||||
|
||||
if (isFetching) {
|
||||
return (
|
||||
<Box display="flex" alignItems="center" justifyContent="center">
|
||||
<CircularProgress size="8rem" />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Box display="flex" alignItems="center" justifyContent="center">
|
||||
<Link to="/">Something went wrong - Go back.</Link>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Grid container className={classes.containerSpaceAround}>
|
||||
<Grid item sm={12} lg={4} align="center">
|
||||
<img
|
||||
src={`https://image.tmdb.org/t/p/w500/${data?.poster_path}`}
|
||||
className={classes.poster}
|
||||
alt={data?.title}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item container direction="column" lg={7}>
|
||||
<Typography variant="h3" align="center" gutterBottom>
|
||||
{data?.title} ({data.release_date.split('-')[0]})
|
||||
</Typography>
|
||||
<Typography variant="h5" align="center" gutterBottom>
|
||||
{data?.tagline}
|
||||
</Typography>
|
||||
<Grid item className={classes.containerSpaceAround}>
|
||||
<Box display="flex" align="center">
|
||||
<Rating readOnly value={data.vote_average / 2} />
|
||||
<Typography gutterBottom variant="subtitle1" style={{ marginLeft: '10px' }}>
|
||||
{data?.vote_average} / 10
|
||||
</Typography>
|
||||
</Box>
|
||||
<Typography gutterBottom variant="h6" align="center">{data?.runtime}min</Typography>
|
||||
</Grid>
|
||||
<Grid item className={classes.genresContainer}>
|
||||
{data?.genres?.map((genre) => (
|
||||
<Link className={classes.links} key={genre.name} to="/" onClick={() => dispatch(selectGenreOrCategory(genre.id))}>
|
||||
<img src={genreIcons[genre.name.toLowerCase()]} className={classes.genreImage} height={30} />
|
||||
<Typography color="textPrimary" variant="subtitle1">{genre?.name}</Typography>
|
||||
</Link>
|
||||
))}
|
||||
</Grid>
|
||||
<Typography variant="h5" gutterBottom style={{ marginTop: '20px' }}>Overview</Typography>
|
||||
<Typography style={{ marginBottom: '2rem' }}>{data?.overview}</Typography>
|
||||
<Typography variant="h5" gutterBottom>Top Cast</Typography>
|
||||
<Grid item container spacing={2}>
|
||||
{data && data?.credits?.cast?.map((character, i) => (
|
||||
character.profile_path && (
|
||||
<Grid key={i} item xs={4} md={2} component={Link} to={`/actors/${character.id}`} style={{ textDecoration: 'none' }}>
|
||||
<img
|
||||
className={classes.castImage}
|
||||
src={`https://image.tmdb.org/t/p/w500/${character.profile_path}`}
|
||||
alt={character.name}
|
||||
/>
|
||||
<Typography color="textPrimary" align="center">{character?.name}</Typography>
|
||||
<Typography color="textSecondary" align="center">
|
||||
{character.character.split('/')[0]}
|
||||
</Typography>
|
||||
</Grid>
|
||||
)
|
||||
)).slice(0, 6)}
|
||||
</Grid>
|
||||
<Grid item container style={{ marginTop: '2rem' }}>
|
||||
<div className={classes.buttonContainer}>
|
||||
<Grid item xs={12} sm={6} className={classes.buttonContainer}>
|
||||
<ButtonGroup size="small" variant="outlined">
|
||||
<Button target="_blank" rel="noopener noreferrer" href={data?.homepage} endIcon={<Language />}>Website</Button>
|
||||
<Button target="_blank" rel="noopener noreferrer" href={`https://www.imdb.com/title/${data?.imdb_id}`} endIcon={<MovieIcon />}>IMDB</Button>
|
||||
<Button onClick={() => setOpen(true)} href="#" endIcon={<Theaters />}>Trailer</Button>
|
||||
</ButtonGroup>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} className={classes.buttonContainer}>
|
||||
<ButtonGroup size="small" variant="outlined">
|
||||
<Button onClick={addToFavorites} endIcon={isMovieFavorited ? <FavoriteBorderOutlined /> : <Favorite />}>
|
||||
{isMovieFavorited ? 'Unfavorite' : 'Favorite'}
|
||||
</Button>
|
||||
<Button onClick={addToWatchList} endIcon={isMovieWatchlisted ? <Remove /> : <PlusOne />}>
|
||||
Watchlist
|
||||
</Button>
|
||||
<Button endIcon={<ArrowBack />} sx={{ borderColor: 'primary.main' }}>
|
||||
<Typography variant="subtitle2" component={Link} to="/" color="inherit" sx={{ textDecoration: 'none' }}>
|
||||
Back
|
||||
</Typography>
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</Grid>
|
||||
</div>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Box marginTop="5rem" width="100%">
|
||||
<Typography variant="h3" gutterBottom align="center">
|
||||
You might also like
|
||||
</Typography>
|
||||
{recommendations
|
||||
? <MovieList movies={recommendations} numberOfMovies={12} />
|
||||
: <Box>Sorry, nothing was found.</Box>}
|
||||
</Box>
|
||||
<Modal
|
||||
closeAfterTransition
|
||||
className={classes.modal}
|
||||
open={open}
|
||||
onClose={() => setOpen(false)}
|
||||
>
|
||||
{data?.videos?.results?.length > 0 && (
|
||||
<iframe
|
||||
autoPlay
|
||||
className={classes.video}
|
||||
frameBorder="0"
|
||||
title="Trailer"
|
||||
src={`https://www.youtube.com/embed/${data.videos.results[0].key}`}
|
||||
allow="autoplay"
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
|
||||
export default MovieInfo;
|
||||
@@ -0,0 +1,75 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles((theme) => ({
|
||||
containerSpaceAround: {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-around',
|
||||
margin: '10px 0 !important',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
flexDirection: 'column',
|
||||
flexWrap: 'wrap',
|
||||
},
|
||||
},
|
||||
poster: {
|
||||
borderRadius: '20px',
|
||||
boxShadow: '0.5em 1em 1em rgb(64, 64, 70)',
|
||||
width: '80%',
|
||||
[theme.breakpoints.down('md')]: {
|
||||
margin: '0 auto !imporatant',
|
||||
width: '50%',
|
||||
},
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
margin: '0 auto !imporatant',
|
||||
width: '100%',
|
||||
height: '350px',
|
||||
marginBottom: '30px',
|
||||
},
|
||||
},
|
||||
genresContainer: {
|
||||
margin: '10px 0 !imaportant',
|
||||
display: 'flex',
|
||||
justifyContent: 'space-around',
|
||||
flexWrap: 'wrap',
|
||||
},
|
||||
genreImage: {
|
||||
filter: theme.palette.mode === 'dark' && 'invert(1)',
|
||||
marginRight: '10px',
|
||||
},
|
||||
links: {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
textDecoration: 'none',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
padding: '0.5rem 1rem',
|
||||
},
|
||||
},
|
||||
castImage: {
|
||||
width: '100%',
|
||||
maxWidth: '7em',
|
||||
height: '8em',
|
||||
objectFit: 'cover',
|
||||
borderRadius: '10px',
|
||||
},
|
||||
buttonContainer: {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
width: '100%',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
flexDirection: 'column',
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
video: {
|
||||
width: '50%',
|
||||
height: '50%',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
width: '90%',
|
||||
height: '90%',
|
||||
},
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Grid } from '@mui/material';
|
||||
|
||||
import useStyles from './styles';
|
||||
import { Movie } from '../index';
|
||||
|
||||
function MovieList({ movies, numberOfMovies, excludeFirst }) {
|
||||
const classes = useStyles();
|
||||
const startFrom = excludeFirst ? 1 : 0;
|
||||
|
||||
return (
|
||||
<Grid container className={classes.moviesContainer}>
|
||||
{movies.results.slice(startFrom, numberOfMovies).map((movie, i) => (
|
||||
<Movie key={i} movie={movie} i={i} />
|
||||
))}
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
|
||||
export default MovieList;
|
||||
@@ -0,0 +1,13 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles((theme) => ({
|
||||
movieContainer: {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
overflow: 'auto',
|
||||
flexWrap: 'wrap',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
justifyContent: 'center',
|
||||
},
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,47 @@
|
||||
import { useState } from 'react';
|
||||
import { Box, CircularProgress, useMediaQuery, Typography } from '@mui/material';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { MovieList, Pagination, FeaturedMovie } from '../index';
|
||||
import { useGetMoviesQuery } from '../../services/TMDB';
|
||||
|
||||
function Movies() {
|
||||
const [page, setPage] = useState(1);
|
||||
const { genreIdOrCategoryName, searchQuery } = useSelector((state) => state.currentGenreOrCategory);
|
||||
const { data, error, isFetching } = useGetMoviesQuery({ genreIdOrCategoryName, page, searchQuery });
|
||||
|
||||
const lg = useMediaQuery((theme) => theme.breakpoints.only('lg'));
|
||||
const numberOfMovies = lg ? 17 : 19;
|
||||
|
||||
if (isFetching) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center">
|
||||
<CircularProgress size="4rem" />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (!data.results.length) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" mt="20px">
|
||||
<Typography variant="h4">
|
||||
No movies that match that name.
|
||||
<br />
|
||||
Please searh for something else.
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) return 'An error has occured.';
|
||||
|
||||
return (
|
||||
<div>
|
||||
<FeaturedMovie movie={data.results[0]} />
|
||||
<MovieList movies={data} numberOfMovies={numberOfMovies} excludeFirst />
|
||||
<Pagination currentPage={page} setPage={setPage} totalPages={data.total_pages} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Movies;
|
||||
@@ -0,0 +1,115 @@
|
||||
import { useState, useEffect, useContext } from 'react';
|
||||
import { AppBar, IconButton, Toolbar, Drawer, Button, Avatar, useMediaQuery } from '@mui/material';
|
||||
import { Menu, AccountCircle, Brightness4, Brightness7 } from '@mui/icons-material';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import useStyles from './styles';
|
||||
import { Search, Sidebar } from '../index';
|
||||
import { setUser } from '../../features/auth';
|
||||
import { fetchToken, createSessionId, moviesApi } from '../../utils/index';
|
||||
import { ColorModeContext } from '../../utils/ToggleColorMode';
|
||||
|
||||
function Navbar() {
|
||||
const classes = useStyles();
|
||||
const isMobile = useMediaQuery('(max-width:600px)');
|
||||
const theme = useTheme();
|
||||
const dispatch = useDispatch();
|
||||
const { isAuthenticated, user } = useSelector((state) => state.user);
|
||||
const [mobileOpen, setMobileOpen] = useState(false);
|
||||
|
||||
const colorMode = useContext(ColorModeContext);
|
||||
|
||||
const token = localStorage.getItem('request_token');
|
||||
const sessionIdFromLocalStorage = localStorage.getItem('session_id');
|
||||
|
||||
useEffect(() => {
|
||||
const logInUser = async () => {
|
||||
if (token) {
|
||||
if (sessionIdFromLocalStorage) {
|
||||
const { data: userData } = await moviesApi.get(`/account?session_id=${sessionIdFromLocalStorage}`);
|
||||
dispatch(setUser(userData));
|
||||
} else {
|
||||
const sessionId = await createSessionId();
|
||||
const { data: userData } = await moviesApi.get(`/account?session_id=${sessionId}`);
|
||||
dispatch(setUser(userData));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
logInUser();
|
||||
}, [token]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBar position="fixed">
|
||||
<Toolbar className={classes.toolbar}>
|
||||
{isMobile && (
|
||||
<IconButton
|
||||
color="inherit"
|
||||
edge="start"
|
||||
style={{ outline: 'none' }}
|
||||
onClick={() => setMobileOpen((prevMobileOpen) => !prevMobileOpen)}
|
||||
className={classes.menuButton}
|
||||
>
|
||||
<Menu />
|
||||
</IconButton>
|
||||
)}
|
||||
<IconButton
|
||||
color="inherit"
|
||||
sx={{ ml: 1 }}
|
||||
onClick={colorMode.toggleColorMode}
|
||||
>
|
||||
{theme.palette.mode === 'dark' ? <Brightness7 /> : <Brightness4 />}
|
||||
</IconButton>
|
||||
{!isMobile && <Search />}
|
||||
<div>
|
||||
{!isAuthenticated ? (
|
||||
<Button color="inherit" onClick={fetchToken}>
|
||||
Login <AccountCircle />
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
color="inherit"
|
||||
component={Link}
|
||||
to={`/profile/${user.id}`}
|
||||
className={classes.linkButton}
|
||||
>
|
||||
{!isMobile && <>My Movies </>}
|
||||
<Avatar
|
||||
style={{ width: 30, height: 30 }}
|
||||
alt="Profile"
|
||||
src={`https://www.themoviedb.org/t/p/w64_and_h64_face${user?.avatar?.tmdb?.avatar?.avatar_path}`}
|
||||
/>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
{isMobile && <Search />}
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<div>
|
||||
<nav className={classes.drawer}>
|
||||
{isMobile ? (
|
||||
<Drawer
|
||||
variant="temporary"
|
||||
anchor="left"
|
||||
open={mobileOpen}
|
||||
onClose={() => setMobileOpen((prevMobileOpen) => !prevMobileOpen)}
|
||||
classes={{ paper: classes.drawerPaper }}
|
||||
ModalProps={{ keepMounted: true }}
|
||||
>
|
||||
<Sidebar setMobileOpen={setMobileOpen} />
|
||||
</Drawer>
|
||||
) : (
|
||||
<Drawer classes={{ paper: classes.drawerPaper }} variant="permanent" open>
|
||||
<Sidebar setMobileOpen={setMobileOpen} />
|
||||
</Drawer>
|
||||
)}
|
||||
</nav>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Navbar;
|
||||
@@ -0,0 +1,37 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
const drawerWidth = 240;
|
||||
|
||||
export default makeStyles((theme) => ({
|
||||
toolbar: {
|
||||
height: '80px',
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
marginLeft: '240px',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
marginLeft: 0,
|
||||
flexWrap: 'wrap',
|
||||
},
|
||||
},
|
||||
menuButton: {
|
||||
marginRight: theme.spacing(2),
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
display: 'none',
|
||||
},
|
||||
},
|
||||
drawer: {
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
width: drawerWidth,
|
||||
flexShrink: 0,
|
||||
},
|
||||
},
|
||||
drawerPaper: {
|
||||
width: drawerWidth,
|
||||
},
|
||||
linkButton: {
|
||||
'&:hover': {
|
||||
color: 'white !important',
|
||||
textDecoration: 'none',
|
||||
},
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Typography, Button } from '@mui/material';
|
||||
|
||||
import useStyles from './styles';
|
||||
|
||||
function Pagination({ currentPage, setPage, totalPages }) {
|
||||
const classes = useStyles();
|
||||
|
||||
const handlePrev = () => {
|
||||
if (currentPage !== 1) { setPage((prevPage) => prevPage - 1); }
|
||||
};
|
||||
const handleNext = () => {
|
||||
if (currentPage !== totalPages) { setPage((prevPage) => prevPage + 1); }
|
||||
};
|
||||
|
||||
if (totalPages === 0) return null;
|
||||
|
||||
return (
|
||||
<div className={classes.container}>
|
||||
<Button onClick={handlePrev} variant="contained" className={classes.button} color="primary" type="button">Prev</Button>
|
||||
<Typography variant="h4" className={classes.pageNumber}>{currentPage}</Typography>
|
||||
<Button onClick={handleNext} variant="contained" className={classes.button} color="primary" type="button">Next</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Pagination;
|
||||
@@ -0,0 +1,16 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles((theme) => ({
|
||||
container: {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
button: {
|
||||
margin: '30px 2px',
|
||||
},
|
||||
pageNumber: {
|
||||
margin: '0 20px !important',
|
||||
color: theme.palette.text.primary,
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,44 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Box, Button, Typography } from '@mui/material';
|
||||
import { ExitToApp } from '@mui/icons-material';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { useGetListQuery } from '../../services/TMDB';
|
||||
import { RatedCards } from '../index';
|
||||
|
||||
function Profile() {
|
||||
const { user } = useSelector((state) => state.user);
|
||||
const { data: favoriteMovies, refetch: refetchFavorites } = useGetListQuery({ listName: 'favorite/movies', accountId: user.id, sessionId: localStorage.getItem('session_id'), page: 1 });
|
||||
const { data: watchlistMovies, refetch: refetchWatchlisted } = useGetListQuery({ listName: 'watchlist/movies', accountId: user.id, sessionId: localStorage.getItem('session_id'), page: 1 });
|
||||
|
||||
useEffect(() => {
|
||||
refetchFavorites();
|
||||
refetchWatchlisted();
|
||||
}, []);
|
||||
|
||||
const logout = () => {
|
||||
localStorage.clear();
|
||||
window.location.href = '/';
|
||||
};
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Box display="flex" justifyContent="space-between">
|
||||
<Typography variant="h4" gutterBottom>My Profile</Typography>
|
||||
<Button color="inherit" onClick={logout}>
|
||||
Logout <ExitToApp />
|
||||
</Button>
|
||||
</Box>
|
||||
{!favoriteMovies?.results?.length && !watchlistMovies?.results?.length
|
||||
? <Typography variant="h5">Add favourite or watchlist same movies to see them here!</Typography>
|
||||
: (
|
||||
<Box>
|
||||
<RatedCards title="Favorite Movies" movies={favoriteMovies} />
|
||||
<RatedCards title="Watchlist" movies={watchlistMovies} />
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default Profile;
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Typography, Box } from '@mui/material';
|
||||
|
||||
import useStyles from './styles';
|
||||
import { Movie } from '../index';
|
||||
|
||||
function RatedCards({ title, movies }) {
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Typography variant="h5" gutterBottom>{title}</Typography>
|
||||
<Box display="flex" flexWrap="wrap" className={classes.container}>
|
||||
{movies?.results.map((movie, i) => (
|
||||
<Movie key={movie.id} movie={movie} i={i} />
|
||||
))}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default RatedCards;
|
||||
@@ -0,0 +1,7 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles(() => ({
|
||||
container: {
|
||||
margin: '20px 0',
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,13 @@
|
||||
import { useState} from "react";
|
||||
import { TextField, InputAdornment } from '@mui/material';
|
||||
import { Search as SearchIcon } from '@mui/icons-material';
|
||||
|
||||
import useStyles from './styles';
|
||||
|
||||
function Search() {
|
||||
return (
|
||||
<></>
|
||||
)
|
||||
}
|
||||
|
||||
export default Search;
|
||||
@@ -0,0 +1,19 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles((theme) => ({
|
||||
searchContainer: {
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
display: 'flex',
|
||||
justifyContainer: 'center',
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
input: {
|
||||
color: theme.palette.mode === 'light' && 'dark',
|
||||
filter: theme.palette.mode === 'light' && 'invert(1)',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
marginTop: '-10px',
|
||||
marginBottom: '10px',
|
||||
},
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,78 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Divider, List, ListItem, ListItemText, ListSubheader, ListItemIcon, Box, CircularProgress } from '@mui/material';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useTheme } from '@mui/styles';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import useStyles from './styles';
|
||||
import { useGetGenresQuery } from '../../services/TMDB';
|
||||
import { selectGenreOrCategory } from '../../features/currentGenreOrCategory';
|
||||
import genreIcons from '../../assets/genres';
|
||||
|
||||
const redLogo = 'https://fontmeme.com/permalink/210930/8531c658a743debe1e1aa1a2fc82006e.png';
|
||||
const blueLogo = 'https://fontmeme.com/permalink/210930/6854ae5c7f76597cf8680e48a2c8a50a.png';
|
||||
|
||||
const categories = [
|
||||
{ label: 'Popular', value: 'popular' },
|
||||
{ label: 'Top Rated', value: 'top_rated' },
|
||||
{ label: 'Upcoming', value: 'upcoming' },
|
||||
];
|
||||
|
||||
function Sidebar({ setMobileOpen }) {
|
||||
const theme = useTheme();
|
||||
const classes = useStyles();
|
||||
const dispatch = useDispatch();
|
||||
const { data, isFetching } = useGetGenresQuery();
|
||||
const { genreIdOrCategoryName } = useSelector((state) => state.currentGenreOrCategory);
|
||||
|
||||
useEffect(() => {
|
||||
setMobileOpen(false);
|
||||
}, [genreIdOrCategoryName]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Link to="/" className={classes.imageLink}>
|
||||
<img
|
||||
className={classes.image}
|
||||
src={theme.palette.mode === 'light' ? redLogo : blueLogo}
|
||||
alt="Filmpire Logo"
|
||||
/>
|
||||
</Link>
|
||||
<Divider />
|
||||
<List>
|
||||
<ListSubheader>Categories</ListSubheader>
|
||||
{categories.map(({ label, value }) => (
|
||||
<Link key={value} className={classes.links} to="/">
|
||||
<ListItem button onClick={() => dispatch(selectGenreOrCategory(value))}>
|
||||
<ListItemIcon>
|
||||
<img src={genreIcons[label.toLowerCase()]} className={classes.genreImages} height={30} />
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={label} />
|
||||
</ListItem>
|
||||
</Link>
|
||||
))}
|
||||
</List>
|
||||
<Divider />
|
||||
<List>
|
||||
<ListSubheader>Genres</ListSubheader>
|
||||
{isFetching ? (
|
||||
<Box display="flex" justifyContent="center">
|
||||
<CircularProgress size="4rem" />
|
||||
</Box>
|
||||
)
|
||||
: data?.genres?.map(({ name, id }) => (
|
||||
<Link key={name} className={classes.links} to="/">
|
||||
<ListItem button onClick={() => dispatch(selectGenreOrCategory(id))}>
|
||||
<ListItemIcon>
|
||||
<img src={genreIcons[name.toLowerCase()]} className={classes.genreImages} height={30} />
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={name} />
|
||||
</ListItem>
|
||||
</Link>
|
||||
))}
|
||||
</List>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Sidebar;
|
||||
@@ -0,0 +1,23 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles((theme) => ({
|
||||
imageLink: {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
padding: '10% 0',
|
||||
},
|
||||
image: {
|
||||
width: '70%',
|
||||
},
|
||||
links: {
|
||||
color: theme.palette.text.primary,
|
||||
textDecoration: 'none',
|
||||
},
|
||||
genreImages: {
|
||||
filter: theme.palette.mode === 'dark' ? 'invert(1)' : 'dark',
|
||||
},
|
||||
bigText: {
|
||||
color: 'primary',
|
||||
fontSize: 30,
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,12 @@
|
||||
export { default as Actors } from './Actors/Actors';
|
||||
export { default as Movies } from './Movies/Movies';
|
||||
export { default as MovieInfo } from './MovieInfo/MovieInfo';
|
||||
export { default as Profile } from './Profile/Profile';
|
||||
export { default as Navbar } from './Navbar/Navbar';
|
||||
export { default as Sidebar } from './Sidebar/Sidebar';
|
||||
export { default as MovieList } from './MovieList/MovieList';
|
||||
export { default as Movie } from './Movie/Movie';
|
||||
export { default as Search } from './Search/Search';
|
||||
export { default as Pagination } from './Pagination/Pagination';
|
||||
export { default as RatedCards } from './RatedCards/RatedCards';
|
||||
export { default as FeaturedMovie } from './FeaturedMovie/FeaturedMovie';
|
||||
@@ -0,0 +1,15 @@
|
||||
import { makeStyles } from '@mui/styles';
|
||||
|
||||
export default makeStyles(() => ({
|
||||
root: {
|
||||
display: 'flex',
|
||||
height: '100%',
|
||||
},
|
||||
content: {
|
||||
flexGrow: 1,
|
||||
padding: '6em 2em 2em',
|
||||
},
|
||||
toolkit: {
|
||||
height: '70px',
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,25 @@
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = {
|
||||
user: {},
|
||||
isAuthenticated: false,
|
||||
sessionId: '',
|
||||
};
|
||||
|
||||
const authSlice = createSlice({
|
||||
name: 'user',
|
||||
initialState,
|
||||
reducers: {
|
||||
setUser: (state, action) => {
|
||||
state.user = action.payload;
|
||||
state.isAuthenticated = true;
|
||||
state.sessionId = localStorage.getItem('session_id');
|
||||
|
||||
localStorage.setItem('accountId', action.payload.id);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setUser } = authSlice.actions;
|
||||
|
||||
export default authSlice.reducer;
|
||||
@@ -0,0 +1,23 @@
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
export const genreOrCategory = createSlice({
|
||||
name: 'genreOrCategory',
|
||||
initialState: {
|
||||
genreIdOrCategoryName: '',
|
||||
page: 1,
|
||||
searchQuery: '',
|
||||
},
|
||||
reducers: {
|
||||
selectGenreOrCategory: (state, action) => {
|
||||
state.genreIdOrCategoryName = action.payload;
|
||||
state.searchQuery = '';
|
||||
},
|
||||
searchMovie: (state, action) => {
|
||||
state.searchQuery = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { selectGenreOrCategory, searchMovie } = genreOrCategory.actions;
|
||||
|
||||
export default genreOrCategory.reducer;
|
||||
@@ -1,13 +1,15 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
::-webkit-scrollbar {
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
::-webkit-scrollbar-track {
|
||||
background: #cfcfcf;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #a5a5a5;
|
||||
}
|
||||
|
||||
* {
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -1,11 +1,20 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
import store from './app/store';
|
||||
import ToggleColorMode from "./utils/ToggleColorMode";
|
||||
import App from './components/App';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
<Provider store={store}>
|
||||
<ToggleColorMode>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</ToggleColorMode>
|
||||
</Provider>
|
||||
|
||||
);
|
||||
@@ -0,0 +1,73 @@
|
||||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
|
||||
|
||||
const tmdbApiKey = process.env.REACT_APP_TMDB_KEY;
|
||||
|
||||
export const tmdbApi = createApi({
|
||||
reducerPath: 'tmdbApi',
|
||||
baseQuery: fetchBaseQuery({ baseUrl: 'https://api.themoviedb.org/3' }),
|
||||
endpoints: (builder) => ({
|
||||
|
||||
// Get Genres
|
||||
getGenres: builder.query({
|
||||
query: () => `/genre/movie/list?api_key=${tmdbApiKey}`,
|
||||
}),
|
||||
|
||||
// Get Movies by [Type]
|
||||
getMovies: builder.query({
|
||||
query: ({ genreIdOrCategoryName, page, searchQuery }) => {
|
||||
// Get Movies by Search
|
||||
if (searchQuery) {
|
||||
return `/search/movie?query=${searchQuery}&page=${page}&api_key=${tmdbApiKey}`;
|
||||
}
|
||||
|
||||
// Get Movies by Category
|
||||
if (genreIdOrCategoryName && typeof genreIdOrCategoryName === 'string') {
|
||||
return `/movie/${genreIdOrCategoryName}?page=${page}&api_key=${tmdbApiKey}`;
|
||||
}
|
||||
|
||||
// Get Movies by Genre
|
||||
if (genreIdOrCategoryName && typeof genreIdOrCategoryName === 'number') {
|
||||
return `discover/movie?with_genres=${genreIdOrCategoryName}&page=${page}&api_key=${tmdbApiKey}`;
|
||||
}
|
||||
|
||||
// Get popular movies by default
|
||||
return `/movie/popular?page=${page}&api_key=${tmdbApiKey}`;
|
||||
},
|
||||
}),
|
||||
|
||||
// Get Movie
|
||||
getMovie: builder.query({
|
||||
query: (id) => `/movie/${id}?append_to_response=videos,credits&api_key=${tmdbApiKey}`,
|
||||
}),
|
||||
|
||||
// Get Recommendations
|
||||
getRecommendations: builder.query({
|
||||
query: ({ movie_id, list }) => `/movie/${movie_id}/${list}?api_key=${tmdbApiKey}`,
|
||||
}),
|
||||
|
||||
// Get Actor
|
||||
getActor: builder.query({
|
||||
query: (id) => `person/${id}?api_key=${tmdbApiKey}`,
|
||||
}),
|
||||
|
||||
// Get Movies by Actor
|
||||
getMoviesByActorId: builder.query({
|
||||
query: ({ id, page }) => `/discover/movie?with_cast=${id}&page=${page}&api_key=${tmdbApiKey}`,
|
||||
}),
|
||||
|
||||
// Get User Specific Lists
|
||||
getList: builder.query({
|
||||
query: ({ listName, accountId, sessionId, page }) => `/account/${accountId}/${listName}?api_key=${tmdbApiKey}&session_id=${sessionId}&page=${page}`,
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
export const {
|
||||
useGetGenresQuery,
|
||||
useGetMoviesQuery,
|
||||
useGetMovieQuery,
|
||||
useGetRecommendationsQuery,
|
||||
useGetActorQuery,
|
||||
useGetMoviesByActorIdQuery,
|
||||
useGetListQuery,
|
||||
} = tmdbApi;
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useState, useMemo, createContext } from 'react';
|
||||
import { ThemeProvider, createTheme } from "@mui/material/styles";
|
||||
|
||||
export const ColorModeContext = createContext();
|
||||
|
||||
function ToggleColorMode({ children }) {
|
||||
const [mode, setMode] = useState('light');
|
||||
|
||||
const toggleColorMode = () => {
|
||||
setMode((prevMode) => (prevMode === 'light' ? 'dark' : 'light'));
|
||||
};
|
||||
|
||||
const theme = useMemo(() => createTheme({
|
||||
palette: {
|
||||
mode,
|
||||
},
|
||||
}), [mode]);
|
||||
|
||||
return (
|
||||
<ColorModeContext.Provider value={{ mode, setMode, toggleColorMode }}>
|
||||
<ThemeProvider theme={theme}>
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
</ColorModeContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export default ToggleColorMode;
|
||||
@@ -0,0 +1,40 @@
|
||||
import axios from 'axios';
|
||||
|
||||
export const moviesApi = axios.create({
|
||||
baseURL: 'https://api.themoviedb.org/3',
|
||||
params: {
|
||||
api_key: process.env.REACT_APP_TMDB_KEY,
|
||||
},
|
||||
});
|
||||
|
||||
export const fetchToken = async () => {
|
||||
try {
|
||||
const { data } = await moviesApi.get('/authentication/token/new');
|
||||
|
||||
const token = data.request_token;
|
||||
|
||||
if (data.success) {
|
||||
localStorage.setItem('request_token', token);
|
||||
window.location.href = `https://www.themoviedb.org/authenticate/${token}?redirect_to=${window.location.origin}/approved`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Sorry, your token could not be created.');
|
||||
}
|
||||
};
|
||||
|
||||
export const createSessionId = async () => {
|
||||
const token = localStorage.getItem('request_token');
|
||||
|
||||
if (token) {
|
||||
try {
|
||||
const { data: { session_id } } = await moviesApi.post('authentication/session/new', {
|
||||
request_token: token,
|
||||
});
|
||||
localStorage.setItem('session_id', session_id);
|
||||
|
||||
return session_id;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
};
|
||||