refactor: enhance movie details and UI components for better user experience
This commit is contained in:
parent
5f2077a4ec
commit
f498f2d217
|
|
@ -1,11 +1,8 @@
|
||||||
import { HeroMovie } from "@/components/molecules/HeroMovie";
|
import { HeroMovie } from "@/components/molecules/HeroMovie";
|
||||||
import { MovieCast } from "@/components/molecules/MovieCast";
|
import { MovieCast } from "@/components/molecules/MovieCast";
|
||||||
import { SimilarMovies } from "@/components/molecules/SimilarMovies";
|
|
||||||
import { RecommendedMovies } from "@/components/molecules/RecommendedMovies";
|
import { RecommendedMovies } from "@/components/molecules/RecommendedMovies";
|
||||||
import { MovieGallery } from "@/components/molecules/MovieGallery";
|
|
||||||
import { TMDB } from "@/lib/tmdb";
|
import { TMDB } from "@/lib/tmdb";
|
||||||
|
|
||||||
// Main movie details component.
|
|
||||||
export default async function Page({
|
export default async function Page({
|
||||||
params,
|
params,
|
||||||
}: {
|
}: {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export const Button: FC<Props> = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Component
|
<Component
|
||||||
className={`block cursor-pointer text-white rounded-xl font-semibold shadow-2xl transition-all duration-300 hover:scale-105
|
className={`flex items-center justify-center gap-2 cursor-pointer text-white rounded-xl font-semibold shadow-2xl transition-all duration-300 hover:scale-105
|
||||||
bg-gradient-to-r ${buttonColor?.from} ${buttonColor?.to} cursor-pointer ${sizes[size]} ${className}`}
|
bg-gradient-to-r ${buttonColor?.from} ${buttonColor?.to} cursor-pointer ${sizes[size]} ${className}`}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
{...(href && { href })}
|
{...(href && { href })}
|
||||||
|
|
@ -49,9 +49,13 @@ const sizes = {
|
||||||
|
|
||||||
const colors = {
|
const colors = {
|
||||||
primary: {
|
primary: {
|
||||||
from: "from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500",
|
from: "from-purple-600 hover:from-purple-500",
|
||||||
to: "to-emerald-600 hover:to-emerald-500",
|
to: "to-emerald-600 hover:to-emerald-500",
|
||||||
},
|
},
|
||||||
|
secondary: {
|
||||||
|
from: "from-purple-600 hover:from-purple-500",
|
||||||
|
to: "to-pink-600 hover:to-pink-500",
|
||||||
|
},
|
||||||
glass: {
|
glass: {
|
||||||
from: "from-white/15 via-white/8 to-white/12",
|
from: "from-white/15 via-white/8 to-white/12",
|
||||||
to: "to-white/15 hover:to-white/10",
|
to: "to-white/15 hover:to-white/10",
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,17 @@ export const MovieCast: FC<Props> = ({ movieDetails }) => {
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{movieDetails.budget > 0 && movieDetails.revenue > 0 && (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<FaDollarSign className="text-green-400" />
|
||||||
|
<span className="text-gray-400">Zysk:</span>
|
||||||
|
<span className="text-white">
|
||||||
|
{formatCurrency(
|
||||||
|
movieDetails.revenue - movieDetails.budget
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ import { RiCalendarCheckLine, RiCalendarScheduleLine } from "react-icons/ri";
|
||||||
import { useGlobalStore } from "@/app/store/globalStore";
|
import { useGlobalStore } from "@/app/store/globalStore";
|
||||||
import { addMovie, deleteMovie } from "@/lib/db";
|
import { addMovie, deleteMovie } from "@/lib/db";
|
||||||
import { ReadMore } from "@/components/atoms/ReadMore";
|
import { ReadMore } from "@/components/atoms/ReadMore";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { Button } from "@/components/atoms/Button";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
movies: Movie[];
|
movies: Movie[];
|
||||||
|
|
@ -153,11 +155,13 @@ export const Hero: FC<Props> = ({
|
||||||
>
|
>
|
||||||
{/* Poster */}
|
{/* Poster */}
|
||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0">
|
||||||
<img
|
<Link href={`/film/${id}`}>
|
||||||
src={`http://image.tmdb.org/t/p/w500${poster_path}`}
|
<img
|
||||||
alt={title}
|
src={`http://image.tmdb.org/t/p/w500${poster_path}`}
|
||||||
className="w-64 h-96 object-cover rounded-lg shadow-2xl"
|
alt={title}
|
||||||
/>
|
className="w-64 h-96 object-cover rounded-lg shadow-2xl hover:scale-105 transition-transform duration-300"
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Movie details */}
|
{/* Movie details */}
|
||||||
|
|
@ -167,8 +171,8 @@ export const Hero: FC<Props> = ({
|
||||||
{preheading}
|
{preheading}
|
||||||
</h3>
|
</h3>
|
||||||
)}
|
)}
|
||||||
<h2 className="text-4xl lg:text-6xl font-bold text-white mb-4 leading-tight">
|
<h2 className="text-4xl lg:text-6xl font-bold text-white mb-4 leading-tight hover:text-secondary transition-colors duration-300">
|
||||||
{title}
|
<Link href={`/film/${id}`}>{title}</Link>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{/* Movie meta info */}
|
{/* Movie meta info */}
|
||||||
|
|
@ -204,23 +208,21 @@ export const Hero: FC<Props> = ({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Overview */}
|
{/* Overview */}
|
||||||
<div className="text-lg lg:text-xl text-white/90 mb-8 max-w-2xl leading-relaxed">
|
<p className="text-lg lg:text-xl text-white/90 mb-8 max-w-2xl leading-relaxed line-clamp-3 hover:text-secondary transition-all duration-300">
|
||||||
<ReadMore text={overview} />
|
<Link href={`/film/${id}`}>{overview}</Link>
|
||||||
</div>
|
</p>
|
||||||
|
|
||||||
{/* Action buttons */}
|
{/* Action buttons */}
|
||||||
<div className="flex flex-col sm:flex-row gap-4 justify-center lg:justify-start">
|
<div className="flex flex-col sm:flex-row gap-4 justify-center lg:justify-start">
|
||||||
<button
|
<Button
|
||||||
|
theme={alreadyInStore ? "primary" : "secondary"}
|
||||||
onClick={alreadyInStore ? handleRemove : handleAdd}
|
onClick={alreadyInStore ? handleRemove : handleAdd}
|
||||||
className={`flex items-center justify-center gap-3 px-8 py-3 rounded-lg font-semibold text-lg text-white transition-colors cursor-pointer ${
|
|
||||||
alreadyInStore
|
|
||||||
? "bg-red-500 hover:bg-red-600"
|
|
||||||
: "bg-primary hover:bg-primary/80"
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{alreadyInStore ? <FaMinus /> : <FaPlus />}
|
{alreadyInStore ? <FaMinus /> : <FaPlus />}
|
||||||
{alreadyInStore ? "Usuń z listy" : "Dodaj do listy"}
|
<span>
|
||||||
</button>
|
{alreadyInStore ? "Usuń z listy" : "Dodaj do listy"}
|
||||||
|
</span>
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue