From f498f2d2177c8ef668d19514b79f147923317861 Mon Sep 17 00:00:00 2001 From: Norbert Maciaszek Date: Sun, 17 Aug 2025 23:41:22 +0200 Subject: [PATCH] refactor: enhance movie details and UI components for better user experience --- src/app/film/[id]/page.tsx | 3 -- src/components/atoms/Button/index.tsx | 8 +++-- src/components/molecules/MovieCast/index.tsx | 11 ++++++ src/components/organisms/Hero/index.tsx | 38 ++++++++++---------- 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/app/film/[id]/page.tsx b/src/app/film/[id]/page.tsx index 95b0493..9a66754 100644 --- a/src/app/film/[id]/page.tsx +++ b/src/app/film/[id]/page.tsx @@ -1,11 +1,8 @@ import { HeroMovie } from "@/components/molecules/HeroMovie"; import { MovieCast } from "@/components/molecules/MovieCast"; -import { SimilarMovies } from "@/components/molecules/SimilarMovies"; import { RecommendedMovies } from "@/components/molecules/RecommendedMovies"; -import { MovieGallery } from "@/components/molecules/MovieGallery"; import { TMDB } from "@/lib/tmdb"; -// Main movie details component. export default async function Page({ params, }: { diff --git a/src/components/atoms/Button/index.tsx b/src/components/atoms/Button/index.tsx index 1b3fd68..4721f45 100644 --- a/src/components/atoms/Button/index.tsx +++ b/src/components/atoms/Button/index.tsx @@ -31,7 +31,7 @@ export const Button: FC = ({ return ( = ({ movieDetails }) => { )} + {movieDetails.budget > 0 && movieDetails.revenue > 0 && ( +
+ + Zysk: + + {formatCurrency( + movieDetails.revenue - movieDetails.budget + )} + +
+ )} )} diff --git a/src/components/organisms/Hero/index.tsx b/src/components/organisms/Hero/index.tsx index 4bc6354..2a383d6 100644 --- a/src/components/organisms/Hero/index.tsx +++ b/src/components/organisms/Hero/index.tsx @@ -12,6 +12,8 @@ import { RiCalendarCheckLine, RiCalendarScheduleLine } from "react-icons/ri"; import { useGlobalStore } from "@/app/store/globalStore"; import { addMovie, deleteMovie } from "@/lib/db"; import { ReadMore } from "@/components/atoms/ReadMore"; +import Link from "next/link"; +import { Button } from "@/components/atoms/Button"; type Props = { movies: Movie[]; @@ -153,11 +155,13 @@ export const Hero: FC = ({ > {/* Poster */}
- {title} + + {title} +
{/* Movie details */} @@ -167,8 +171,8 @@ export const Hero: FC = ({ {preheading} )} -

- {title} +

+ {title}

{/* Movie meta info */} @@ -204,23 +208,21 @@ export const Hero: FC = ({ {/* Overview */} -
- -
+

+ {overview} +

{/* Action buttons */}
- + + {alreadyInStore ? "Usuń z listy" : "Dodaj do listy"} + +