Skip to content

Commit 456e760

Browse files
committed
Lint - prettier - eslint
1 parent 412c50d commit 456e760

File tree

3 files changed

+86
-88
lines changed

3 files changed

+86
-88
lines changed

client/src/components/movie-list/Card.tsx

+84-85
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { HiOutlinePlus } from "react-icons/hi2";
1010
import { AddUpdateMovieModal } from "..";
1111
import { NotAuthenticatedModal } from "..";
1212

13-
1413
type CardProps = {
1514
title: string;
1615
movies: Movie[];
@@ -19,7 +18,13 @@ type CardProps = {
1918
rank?: boolean;
2019
};
2120

22-
export const Card = ({ title, movies, isAuthenticated, userId, rank }: CardProps) => {
21+
export const Card = ({
22+
title,
23+
movies,
24+
isAuthenticated,
25+
userId,
26+
rank,
27+
}: CardProps) => {
2328
type ExpandedMovies = {
2429
[key: string]: boolean;
2530
};
@@ -39,99 +44,93 @@ export const Card = ({ title, movies, isAuthenticated, userId, rank }: CardProps
3944

4045
return (
4146
<>
42-
4347
<section className="bg-gray-50 dark:bg-gray-900 ">
44-
45-
<div className=" mx-auto flex flex-col items-center justify-center px-6 py-6 lg:py-0">
46-
<div className="flex justify-between space-x-5">
47-
<h3 className="p-10 text-center text-3xl font-semibold italic dark:text-white lg:text-4xl">
48-
{title}
49-
</h3>
50-
<Button
51-
title={``}
52-
color="green"
53-
size={"md"}
54-
className="h-10 w-10 self-center"
55-
isProcessing={false}
56-
onClick={() => {
57-
isAuthenticated
58-
? handleShowAddModal()
59-
: handleShowNotAuthenticatedModal();
60-
}}
61-
>
62-
<HiOutlinePlus />
63-
</Button>
64-
</div>
65-
66-
67-
68-
<div className=" w-full flex flex-wrap items-start justify-center gap-5 lg:gap-10">
69-
{movies.map((movie) => {
70-
const isExpanded = expandedMovies[movie.id as string];
71-
return (
72-
<Component
73-
horizontal
74-
key={movie.id}
75-
className="w-full rounded-md border-2 border-gray-300 shadow-xl dark:border-gray-700 lg:h-[387px]"
76-
renderImage={() => (
77-
<img
78-
loading="lazy"
79-
src={movie.poster}
80-
alt={`${movie.title} + poster picture`}
81-
className="h-64 w-auto rounded-l md:h-full lg:h-96 lg:w-64"
82-
/>
83-
)}
84-
>
85-
<div className=" flex h-full flex-col justify-start gap-5 md:gap-0 lg:gap-0">
86-
<div className="flex flex-col ">
87-
<h5 className="flex space-x-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white lg:block">
88-
{movie.title}
89-
{rank && ` (${movie._count?.reviews})`}
90-
</h5>
48+
<div className=" mx-auto flex flex-col items-center justify-center px-6 py-6 lg:py-0">
49+
<div className="flex justify-between space-x-5">
50+
<h3 className="p-10 text-center text-3xl font-semibold italic dark:text-white lg:text-4xl">
51+
{title}
52+
</h3>
53+
<Button
54+
title={``}
55+
color="green"
56+
size={"md"}
57+
className="h-10 w-10 self-center"
58+
isProcessing={false}
59+
onClick={() => {
60+
isAuthenticated
61+
? handleShowAddModal()
62+
: handleShowNotAuthenticatedModal();
63+
}}
64+
>
65+
<HiOutlinePlus />
66+
</Button>
67+
</div>
9168

69+
<div className=" flex w-full flex-wrap items-start justify-center gap-5 lg:gap-10">
70+
{movies.map((movie) => {
71+
const isExpanded = expandedMovies[movie.id as string];
72+
return (
73+
<Component
74+
horizontal
75+
key={movie.id}
76+
className="w-full rounded-md border-2 border-gray-300 shadow-xl dark:border-gray-700 lg:h-[387px]"
77+
renderImage={() => (
78+
<img
79+
loading="lazy"
80+
src={movie.poster}
81+
alt={`${movie.title} + poster picture`}
82+
className="h-64 w-auto rounded-l md:h-full lg:h-96 lg:w-64"
83+
/>
84+
)}
85+
>
86+
<div className=" flex h-full flex-col justify-start gap-5 md:gap-0 lg:gap-0">
87+
<div className="flex flex-col ">
88+
<h5 className="flex space-x-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white lg:block">
89+
{movie.title}
90+
{rank && ` (${movie._count?.reviews})`}
91+
</h5>
9292

93-
<Star />
94-
<p className="font-normal text-gray-700 dark:text-gray-400">
95-
{isExpanded
96-
? `${movie.description.substring(0, 200)}...`
97-
: `${movie.description.substring(0, 100)}...`}
98-
<button
99-
className="flex flex-col text-sm hover:underline"
100-
onClick={() =>
101-
setExpandedMovies({
102-
...expandedMovies,
103-
[movie.id as string]: !isExpanded,
104-
})
105-
}
106-
>
107-
{isExpanded ? "Read Less" : "Read More"}
108-
</button>
109-
</p>
110-
</div>
111-
<div className="mt-auto w-full ">
112-
<Button
93+
<Star />
94+
<p className="font-normal text-gray-700 dark:text-gray-400">
95+
{isExpanded
96+
? `${movie.description.substring(0, 200)}...`
97+
: `${movie.description.substring(0, 100)}...`}
98+
<button
99+
className="flex flex-col text-sm hover:underline"
113100
onClick={() =>
114-
navigate(`/movie/${titleToSlug(movie.title)}`)
101+
setExpandedMovies({
102+
...expandedMovies,
103+
[movie.id as string]: !isExpanded,
104+
})
115105
}
116-
title={"Watch Now"}
117-
color="failure"
118-
className={`w-full lg:w-[270px] rounded-md ${isExpanded ? "lg:mt-10" : "md:mt-10 lg:mt-24"
119-
}`}
120-
isProcessing={false}
121106
>
122-
<HiOutlineArrowRight className="ml-2 h-5 w-5" />
123-
</Button>
124-
</div>
107+
{isExpanded ? "Read Less" : "Read More"}
108+
</button>
109+
</p>
110+
</div>
111+
<div className="mt-auto w-full ">
112+
<Button
113+
onClick={() =>
114+
navigate(`/movie/${titleToSlug(movie.title)}`)
115+
}
116+
title={"Watch Now"}
117+
color="failure"
118+
className={`w-full rounded-md lg:w-[270px] ${
119+
isExpanded ? "lg:mt-10" : "md:mt-10 lg:mt-24"
120+
}`}
121+
isProcessing={false}
122+
>
123+
<HiOutlineArrowRight className="ml-2 h-5 w-5" />
124+
</Button>
125125
</div>
126-
</Component>
127-
);
128-
})}
129-
</div>
126+
</div>
127+
</Component>
128+
);
129+
})}
130130
</div>
131-
131+
</div>
132132
</section>
133133

134-
135134
{showAddModal && (
136135
<AddUpdateMovieModal
137136
movie={{

client/src/pages/Movies.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export const Movies = () => {
1919
isPending: isFeaturedMoviesPending,
2020
} = useFeaturedMovies();
2121

22-
2322
const {
2423
data: movies,
2524
isError: isMoviesError,

client/src/services/movie.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export type Movie = {
1313
createdAt?: Date;
1414
updatedAt?: Date;
1515
loading?: boolean;
16-
_count?:{
16+
_count?: {
1717
reviews: number;
18-
}
18+
};
1919
};
2020

2121
export const getMovies = async () => {

0 commit comments

Comments
 (0)