diff --git a/src/app/(withGlobalData)/layout.tsx b/src/app/(withGlobalData)/layout.tsx index 2b4cc9f..6b26bb9 100644 --- a/src/app/(withGlobalData)/layout.tsx +++ b/src/app/(withGlobalData)/layout.tsx @@ -13,9 +13,7 @@ export default async function WithGlobalDataLayout({ return ( -
- {children} -
+
{children}
); } diff --git a/src/app/(withGlobalData)/o-mnie/page.tsx b/src/app/(withGlobalData)/o-mnie/page.tsx deleted file mode 100644 index 78e99fd..0000000 --- a/src/app/(withGlobalData)/o-mnie/page.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { MovieList } from "@/components/molecules/MovieList"; - -export default async function Home() { - return ( - <> - - - - - - ); -} diff --git a/src/app/(withGlobalData)/odkrywaj/page.tsx b/src/app/(withGlobalData)/odkrywaj/page.tsx new file mode 100644 index 0000000..d76067e --- /dev/null +++ b/src/app/(withGlobalData)/odkrywaj/page.tsx @@ -0,0 +1,31 @@ +import { getNowPlayingMovies } from "@/lib/tmdb/server"; +import { Hero } from "@/components/organisms/Hero"; + +// 12 hours +export const revalidate = 43200; + +export default async function Home() { + // Get trending movies and popular movies for hero carousel. + const data = await getNowPlayingMovies(); + + // Combine first 3 trending and first 2 popular movies for variety. + const dataRaw = data.results.slice(0, 5); + + // Convert TMDB movie format to our Movie type. + const heroMovies = dataRaw.map((movie) => ({ + ...movie, + genre_ids: JSON.stringify(movie.genre_ids), + seen: false, + favorite: false, + })); + + return ( + <> + +
+

Popularne filmy

+ {/* Add other homepage content here */} +
+ + ); +} diff --git a/src/app/(withGlobalData)/page.tsx b/src/app/(withGlobalData)/page.tsx index 07c0d52..78e99fd 100644 --- a/src/app/(withGlobalData)/page.tsx +++ b/src/app/(withGlobalData)/page.tsx @@ -1,7 +1,21 @@ +import { MovieList } from "@/components/molecules/MovieList"; + export default async function Home() { return ( <> -

Strona główna

+ + + + ); } diff --git a/src/components/atoms/MovieCard/index.tsx b/src/components/atoms/MovieCard/index.tsx index 8107faa..d275744 100644 --- a/src/components/atoms/MovieCard/index.tsx +++ b/src/components/atoms/MovieCard/index.tsx @@ -29,7 +29,15 @@ export const MovieCard: FC = ({ deleteMovie: deleteMovieFromStore, updateMovie: updateMovieInStore, } = useGlobalStore(); - const { id, title, overview, popularity, release_date, poster_path } = movie; + const { + id, + title, + overview, + popularity, + release_date, + poster_path, + vote_average, + } = movie; const alreadyInStore = movies.find((m) => m.id === id); const isReleased = new Date(release_date) < new Date(); @@ -147,6 +155,13 @@ export const MovieCard: FC = ({

{title}

+ + {!!vote_average && ( +

+ + {vote_average.toFixed(1)}/10 +

+ )}

{ return await fetchTmbd(`/search/movie?${params.toString()}`); } + +export async function getPopularMovies( + page: number = 1 +): Promise { + return await fetchTmbd(`/movie/popular?language=pl-PL&page=${page}`); +} + +export async function getTrendingMovies(): Promise { + return await fetchTmbd("/trending/movie/day?language=pl-PL"); +} + +export async function getUpcomingMovies(): Promise { + return await fetchTmbd("/movie/upcoming?language=pl-PL"); +} + +export async function getNowPlayingMovies(): Promise { + return await fetchTmbd("/movie/now_playing?language=pl-PL®ion=PL"); +}