Skip to content

Commit 7a28701

Browse files
committed
fix: minor issues
1 parent cf4bc71 commit 7a28701

File tree

9 files changed

+45
-547
lines changed

9 files changed

+45
-547
lines changed

package-lock.json

Lines changed: 23 additions & 537 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/entities/movie/Movie.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe('Movie', () => {
4444
mockedUseGetMovieList.mockReturnValue({
4545
movieList: mockMovies,
4646
totalResults: mockMovies.length,
47+
isInitialLoading: false,
4748
});
4849

4950
renderWithRouterProvider();

src/entities/movie/ui/Movie.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { memo, MouseEvent } from 'react';
1+
import { memo, MouseEvent, SyntheticEvent } from 'react';
22

33
import { useLocation } from 'react-router-dom';
44

@@ -31,6 +31,11 @@ const Movie = memo(function Movie({
3131
const animationDelay = `0.${String(delay)}s`;
3232
const isDetailsClose = pathname.slice(1) === '';
3333

34+
const handleError = (e: SyntheticEvent<HTMLImageElement, Event>) => {
35+
const target = e.target as HTMLImageElement;
36+
target.src = ReactLogo;
37+
}
38+
3439
return (
3540
<LinkWithQuery
3641
data-testid="movie-item"
@@ -54,6 +59,7 @@ const Movie = memo(function Movie({
5459
onBlur={handleMouseOut}
5560
className="h-full space-y-4 rounded-4xl p-2">
5661
<img
62+
onError={handleError}
5763
data-testid="movie-poster"
5864
className="h-80 w-full rounded-4xl object-cover"
5965
src={poster}

src/features/MovieList/MovieList.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('MovieList', () => {
2727
mockedUseGetMovieList.mockReturnValue({
2828
movieList: undefined,
2929
totalResults: 0,
30+
isInitialLoading: false,
3031
});
3132

3233
renderWithRouterProvider(
@@ -53,6 +54,7 @@ describe('MovieList', () => {
5354
mockedUseGetMovieList.mockReturnValue({
5455
movieList: mockMovies,
5556
totalResults: mockMovies.length,
57+
isInitialLoading: false,
5658
});
5759

5860
renderWithRouterProvider(

src/features/Pagination/Pagination.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ describe('Pagination', () => {
3333
mockedUseGetMovieList.mockReturnValue({
3434
movieList: mockMovies,
3535
totalResults,
36+
isInitialLoading: false,
3637
});
3738

3839
renderWithRouterProvider(<Pagination scroll={scroll} />);

src/pages/AppLayout/AppLayout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import MovieListHeader from '../../features/MovieList/ui/MovieListHeader.tsx';
77
import PageNum from '../../features/MovieList/ui/PageNum.tsx';
88
import Pagination from '../../features/Pagination/Pagination.tsx';
99
import Search from '../../features/Search/Search.tsx';
10+
import useGetMovieList from '../../shared/hooks/useGetMovieList.ts';
1011
import useScroll from '../../shared/hooks/useScroll.ts';
1112
import useTooltip from '../../shared/hooks/useTooltip.ts';
1213
import Tooltip from '../../shared/ui/Tooltip.tsx';
@@ -19,6 +20,7 @@ import Main from '../../widgets/Main/Main.tsx';
1920
function AppLayout() {
2021
const { containerRef, scrollRef } = useScroll<HTMLDivElement>();
2122
const { tooltipRef, hideTooltip, showTooltip } = useTooltip(scrollRef);
23+
const { isInitialLoading } = useGetMovieList();
2224

2325
return (
2426
<div
@@ -31,7 +33,7 @@ function AppLayout() {
3133
<Loader scroll={scrollRef} />
3234
<GradientBackground />
3335
<Header>
34-
<Logo />
36+
{!isInitialLoading && <Logo />}
3537
<Search scroll={scrollRef} />
3638
<TotalResults />
3739
</Header>

src/pages/AppLayout/ui/GradientBackground.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
function GradientBackground() {
22
return (
3-
<div className="absolute h-full w-full overflow-hidden">
4-
<div className="absolute left-1/2 h-1/3 w-1/2 animate-float rounded-full bg-pink-300 opacity-90 blur-3xl md:blur-[140px]" />
5-
<div className="animation-delay-2000 absolute right-2/4 top-0 h-1/4 w-2/5 animate-float rounded-full bg-violet-400 opacity-90 blur-3xl saturate-200 md:blur-[140px]" />
6-
<div className="animation-delay-4000 absolute right-2/3 top-2/4 h-1/4 w-1/5 animate-float rounded-full bg-blue-400 opacity-90 blur-3xl saturate-200 md:blur-[140px]" />
7-
<div className="animation-delay-6000 absolute bottom-1/4 left-1/2 h-1/5 w-1/5 animate-float rounded-full bg-emerald-300 opacity-90 blur-3xl md:blur-[140px]" />
8-
<div className="animation-delay-8000 absolute bottom-0 right-0 h-1/3 w-1/2 animate-float rounded-l-full bg-emerald-800 opacity-90 blur-3xl md:blur-[140px]" />
3+
<div className="absolute h-full min-h-[2000px] w-full overflow-hidden">
4+
<div className="absolute left-1/2 h-1/3 w-1/2 animate-float rounded-full bg-pink-300 blur-3xl md:blur-[100px]" />
5+
<div className="animation-delay-2000 absolute right-2/4 top-0 h-1/4 w-2/5 animate-float rounded-full bg-violet-400 blur-3xl saturate-200 md:blur-[100px]" />
6+
<div className="animation-delay-4000 absolute right-2/3 top-2/4 h-1/4 w-1/5 animate-float rounded-full bg-blue-400 blur-3xl saturate-200 md:blur-[100px]" />
7+
<div className="animation-delay-6000 absolute bottom-1/4 left-1/2 h-1/5 w-1/5 animate-float rounded-full bg-emerald-300 blur-3xl md:blur-[100px]" />
8+
<div className="animation-delay-8000 absolute bottom-0 right-0 h-1/3 w-1/2 animate-float rounded-l-full bg-emerald-800 blur-3xl md:blur-[100px]" />
99
</div>
1010
);
1111
}

src/pages/NotFound/NotFound.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import LinkWithQuery from '../../shared/ui/LinkWithQuery.tsx';
22
import Modal from '../../shared/ui/Modal.tsx';
3-
import GradientBackground from '../AppLayout/ui/GradientBackground.tsx';
3+
import GradientBackground from "../AppLayout/ui/GradientBackground.tsx";
44

55
function NotFound() {
66
return (

src/shared/hooks/useGetMovieList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function useGetMovieList() {
3838
dispatch(dataFetchedDetailsPage(isFetching || isLoading));
3939
}, [dispatch, isFetching, isLoading]);
4040

41-
return { movieList, totalResults };
41+
return { movieList, totalResults, isInitialLoading: isLoading };
4242
}
4343

4444
export default useGetMovieList;

0 commit comments

Comments
 (0)