Skip to content

Commit

Permalink
Merge pull request #23 from Mridul2820/update-site
Browse files Browse the repository at this point in the history
Bug Fixes
  • Loading branch information
Mridul2820 authored Jun 3, 2022
2 parents d7ff477 + 4f58e64 commit 28e41ec
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 94 deletions.
19 changes: 4 additions & 15 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { lazy, Suspense } from 'react';
import Loader from 'react-loader-spinner';
import DocumentMeta from 'react-document-meta';

import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
Expand All @@ -9,11 +8,13 @@ import UserContext from './context/user';
import useAuthListner from './hooks/useAuthListner';
import IsUserLoggedIn from './helpers/IsUserLoggedIn';

import { ogDefault, ogImage, twitterData } from './constants/constant';
import LoaderCustom from './components/widget/LoaderCustom';

import Header from './components/nav/Header';
import Navbar from './components/nav/Navbar';
import Footer from './components/footer/Footer';
import ScrollTop from './components/widget/ScrollTop';
import { ogDefault, ogImage, twitterData } from './constants/constant';

const Login = lazy(() => import('./pages/Login'));
const Dashboard = lazy(() => import('./pages/Dashboard'));
Expand Down Expand Up @@ -68,19 +69,7 @@ const App = () => {
<UserContext.Provider value={{ user }}>
<DocumentMeta {...meta}>
<Router>
<Suspense
fallback={
<div className="flex flex-col justify-center items-center w-full min-h-screen">
<Loader
type="Circles"
color="#00BFFF"
height={50}
width={200}
className="m-5"
/>
</div>
}
>
<Suspense fallback={<LoaderCustom />}>
<Switch>
<IsUserLoggedIn
user={user}
Expand Down
33 changes: 16 additions & 17 deletions src/components/details/BannerInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,17 @@ const BannerInfo = ({ content, type, runtime }) => {

<div className="flex items-center flex-wrap gap-3 justify-center sm:justify-start">
{content.genres?.map((genre) => (
<a
<ChipLink
key={uuidv4()}
href={`/genre/${type}/${genre.name}/${genre.id}`}
>
<div className="cursor-pointer">
<Chip
className="chip"
label={genre.name}
color="primary"
size="small"
/>
</div>
</a>
<Chip
className="chip"
label={genre.name}
color="primary"
size="small"
/>
</ChipLink>
))}
</div>

Expand All @@ -110,8 +108,8 @@ const BannerInfo = ({ content, type, runtime }) => {
}
}}
>
<BiListPlus size="24px" />
<p>Add to watchlist</p>
<BiListPlus size={24} />
<p className="text-base ml-2 leading-4">Add to watchlist</p>
</Watch>
</Details>
</section>
Expand Down Expand Up @@ -143,11 +141,6 @@ const Watch = styled.div`
font-size: 10px;
color: #fff;
margin-top: 5px;
p {
font-size: 17px;
margin-left: 8px;
}
`;

const Rating = styled.div`
Expand All @@ -161,4 +154,10 @@ const Rating = styled.div`
background-color: ${({ vote_average, voteColor }) => voteColor(vote_average)};
`;

const ChipLink = styled.a`
.MuiChip-root {
cursor: pointer !important;
}
`;

export default BannerInfo;
15 changes: 2 additions & 13 deletions src/components/details/CollectionData.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useEffect, useState } from 'react';
import axios from 'axios';
import Loader from 'react-loader-spinner';

import { img300 } from '../../helpers/config';
import { Container } from '../../styles/Styles';
import { API_URL } from '../../constants/constant';
import ContentGrid from '../widget/ContentGrid';
import LoaderCustom from '../widget/LoaderCustom';

const apiKey = `api_key=${process.env.REACT_APP_TMDB}`;

Expand All @@ -29,17 +28,7 @@ const CollectionData = ({ collectionId, type }) => {
}, []);

if (loading) {
return (
<Container className="flex flex-col justify-center items-center w-full">
<Loader
type="Circles"
color="#00BFFF"
height={50}
width={200}
className="m-5"
/>
</Container>
);
return <LoaderCustom />;
}

return (
Expand Down
51 changes: 34 additions & 17 deletions src/components/details/FactBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const FactBox = ({ content, type }) => {
networks,
title,
seasons,
release_date,
last_air_date,
first_air_date,
belongs_to_collection,
Expand Down Expand Up @@ -102,6 +103,18 @@ const FactBox = ({ content, type }) => {
</p>
</div>
)}

{release_date && (
<div className="fact-wrap">
<p className="fact-item">
<span className="fact-type">Release Date : </span>
<span className="fact-detail">
{new Date(release_date).toLocaleDateString('en-US', dateData)}
</span>
</p>
</div>
)}

{release && (
<div className="fact-wrap">
<p className="fact-item">
Expand All @@ -113,45 +126,49 @@ const FactBox = ({ content, type }) => {
</div>
)}

{runtime ? (
{first_air_date && (
<div className="fact-wrap">
<p className="fact-item">
<span>Runtime : </span>
<span className="fact-detail">{formatTime(runtime)}</span>
<span className="fact-type">First Air Date : </span>
<span className="fact-detail">
{new Date(first_air_date).toLocaleDateString('en-US', dateData)}
</span>
</p>
</div>
) : (
' '
)}

{lang && (
{last_air_date && (
<div className="fact-wrap">
<p className="fact-item">
<span className="fact-type">Original Language : </span>
<span className="fact-type">Last Air Date : </span>
<span className="fact-detail">
{getLangDetail(lang).name}
{getLangDetail(lang).nativeName &&
getLangDetail(lang).nativeName !== ' ' &&
` (${getLangDetail(lang).nativeName})`}
{new Date(last_air_date).toLocaleDateString('en-US', dateData)}
</span>
</p>
</div>
)}

{first_air_date && (
{runtime ? (
<div className="fact-wrap">
<p className="fact-item">
<span className="fact-type">First Air Date : </span>
<span className="fact-detail">{first_air_date}</span>
<span>Runtime : </span>
<span className="fact-detail">{formatTime(runtime)}</span>
</p>
</div>
) : (
' '
)}

{last_air_date && (
{lang && (
<div className="fact-wrap">
<p className="fact-item">
<span className="fact-type">Last Air Date : </span>
<span className="fact-detail">{last_air_date}</span>
<span className="fact-type">Original Language : </span>
<span className="fact-detail">
{getLangDetail(lang).name}
{getLangDetail(lang).nativeName &&
getLangDetail(lang).nativeName !== ' ' &&
` (${getLangDetail(lang).nativeName})`}
</span>
</p>
</div>
)}
Expand Down
12 changes: 8 additions & 4 deletions src/components/widget/LightBoxPop.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import React from 'react';
import Lightbox from 'react-image-lightbox';
import 'react-image-lightbox/style.css';
import LoaderCustom from './LoaderCustom';

const LightBoxPop = ({ imageArray, photoIndex, setPhotoIndex, setIsOpen }) => {
return (
<Lightbox
mainSrc={imageArray[photoIndex]}
onCloseRequest={() => setIsOpen(false)}
nextSrc={imageArray[(photoIndex + 1) % imageArray.length]}
prevSrc={
imageArray[(photoIndex + imageArray.length - 1) % imageArray.length]
}
onCloseRequest={() => setIsOpen(false)}
onMovePrevRequest={() =>
setPhotoIndex(photoIndex + imageArray.length - 1) % imageArray.length
}
onMoveNextRequest={() =>
setPhotoIndex((photoIndex + 1) % imageArray.length)
}
onMovePrevRequest={() =>
setPhotoIndex((photoIndex + imageArray.length - 1) % imageArray.length)
}
loader={<LoaderCustom />}
imagePadding={50}
closeLabel="Close Modal"
/>
);
};
Expand Down
19 changes: 19 additions & 0 deletions src/components/widget/LoaderCustom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import Loader from 'react-loader-spinner';
import { Container } from '../../styles/Styles';

const LoaderCustom = () => {
return (
<Container className="flex flex-col justify-center items-center w-full">
<Loader
type="Circles"
color="#00BFFF"
height={50}
width={200}
className="m-5"
/>
</Container>
);
};

export default LoaderCustom;
2 changes: 1 addition & 1 deletion src/constants/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const PROFILE = '/p/:username';

export const Trending = '/trending';
export const Genres = '/genres';
export const Search = '/search';
export const Search = '/search-movie-tv';

// Movies
export const Movies_Discover = '/discover-movies';
Expand Down
4 changes: 2 additions & 2 deletions src/data/menuData.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ export const optionsNav = [

export const optionsAll = [
{
title: 'Trending',
title: 'Trending List',
route: ROUTES.Trending,
},
{
title: 'Genres',
title: 'Genres List',
route: ROUTES.Genres,
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/pages/search/MovieTVSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const MovieTVSearch = () => {

const fetchSearch = async () => {
const { data } = await axios.get(
`${searchURL}${type}?${apiKey}&language=en-US&query=${searchText}&page=${page}$`
`${searchURL}${type}?${apiKey}&language=en-US&query=${searchText}&page=${page}`
);

setContents(data.results);
Expand Down
14 changes: 2 additions & 12 deletions src/pages/withid/DetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import axios from 'axios';
import DocumentMeta from 'react-document-meta';
import { useParams } from 'react-router-dom';
import styled from 'styled-components';
import Loader from 'react-loader-spinner';

import BannerInfo from '../../components/details/BannerInfo';
import CastnCrew from '../../components/details/CastnCrew';
Expand All @@ -16,6 +15,7 @@ import { API_URL, BASE_URL } from '../../constants/constant';
import { img500 } from '../../helpers/config';

import { Container } from '../../styles/Styles';
import LoaderCustom from '../../components/widget/LoaderCustom';

const detailURL = `${API_URL}/`;
const apiKey = `api_key=${process.env.REACT_APP_TMDB}`;
Expand Down Expand Up @@ -94,17 +94,7 @@ const DetailsPage = () => {
};

if (loading) {
return (
<Container className="flex flex-col justify-center items-center w-full">
<Loader
type="Circles"
color="#00BFFF"
height={50}
width={200}
className="m-5"
/>
</Container>
);
return <LoaderCustom />;
}

return (
Expand Down
14 changes: 2 additions & 12 deletions src/pages/withid/PersonDetail.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios from 'axios';
import React, { useEffect, useState } from 'react';
import Loader from 'react-loader-spinner';
import DocumentMeta from 'react-document-meta';
import { useParams } from 'react-router-dom';
import DetailCard from '../../components/person/DetailCard';
Expand All @@ -10,6 +9,7 @@ import { API_URL, BASE_URL } from '../../constants/constant';

import { Container } from '../../styles/Styles';
import { img500 } from '../../helpers/config';
import LoaderCustom from '../../components/widget/LoaderCustom';

const detailURL = `${API_URL}/`;
const apiKey = `api_key=${process.env.REACT_APP_TMDB}`;
Expand Down Expand Up @@ -56,17 +56,7 @@ const PersonDetail = () => {
};

if (loading) {
return (
<Container className="flex flex-col justify-center items-center w-full">
<Loader
type="Circles"
color="#00BFFF"
height={50}
width={200}
className="m-5"
/>
</Container>
);
return <LoaderCustom />;
}

return (
Expand Down

1 comment on commit 28e41ec

@vercel
Copy link

@vercel vercel bot commented on 28e41ec Jun 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.