diff --git a/src/components/MoviesSearchInput.tsx b/src/components/MoviesSearchInput.tsx index eda929c..bd29c10 100644 --- a/src/components/MoviesSearchInput.tsx +++ b/src/components/MoviesSearchInput.tsx @@ -16,7 +16,7 @@ export default function MoviesSearchInput({ searchUrl }: MoviesSearchInput) { function handleOnKeyDown(e: React.KeyboardEvent) { if (e.key === "Enter") { - window.location.href = `${searchUrl}?q=${value}`; + window.location.href = `${searchUrl}?query=${value}`; } } diff --git a/src/components/lists/movies/CardMoviesListItem.tsx b/src/components/lists/movies/CardMoviesListItem.tsx index e49329e..4f6015b 100644 --- a/src/components/lists/movies/CardMoviesListItem.tsx +++ b/src/components/lists/movies/CardMoviesListItem.tsx @@ -38,7 +38,7 @@ export default function CardMoviesListItem({ movie }: CardMoviesListItemProps) { Disponible ) : ( - + Bientot dispo. )} diff --git a/src/pages/home/index.astro b/src/pages/home/index.astro index 348de6e..a982a8b 100644 --- a/src/pages/home/index.astro +++ b/src/pages/home/index.astro @@ -2,13 +2,17 @@ import MoviesSearchInput from "../../components/MoviesSearchInput"; import CardMoviesList from "../../components/lists/movies/CardMoviesList"; import HomeLayout from "../../layouts/HomeLayout.astro"; -import type { Movie, MovieDetail } from "../../types"; +import type { MovieDetail } from "../../types"; const jwt = Astro.cookies.get("jwt")?.value as string; -const url = new URL(Astro.request.url); -const queryParams = new URLSearchParams(); -const query = url.searchParams.get("q"); +const url = new URL(Astro.request.url); +const query = url.searchParams.get("query"); +const limit = url.searchParams.get("limit") ?? "18"; + +const queryParams = new URLSearchParams({ + limit: limit, +}); if (query) { queryParams.append("query", query); @@ -26,7 +30,6 @@ const res = await fetch( ); const resBody = (await res.json()) as { movies: MovieDetail[] }; -const account = Astro.locals.account; --- diff --git a/src/pages/home/movies/[id].astro b/src/pages/home/movies/[id].astro index c653df5..a893bbe 100644 --- a/src/pages/home/movies/[id].astro +++ b/src/pages/home/movies/[id].astro @@ -35,12 +35,20 @@ const item = (await res.json()).movie as MovieDetail;
- - Watch - + { + item.stats ? ( + + Watch + + ) : ( + + Bientot disponible + + ) + }