implement objectstats in movie detail page
This commit is contained in:
parent
a43a77d158
commit
c25e2af4c1
4 changed files with 24 additions and 13 deletions
|
@ -16,7 +16,7 @@ export default function MoviesSearchInput({ searchUrl }: MoviesSearchInput) {
|
|||
|
||||
function handleOnKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {
|
||||
if (e.key === "Enter") {
|
||||
window.location.href = `${searchUrl}?q=${value}`;
|
||||
window.location.href = `${searchUrl}?query=${value}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ export default function CardMoviesListItem({ movie }: CardMoviesListItemProps) {
|
|||
Disponible
|
||||
</span>
|
||||
) : (
|
||||
<span className="badge text-bg-secondary mb-2">
|
||||
<span className="badge text-bg-warning mb-2">
|
||||
Bientot dispo.
|
||||
</span>
|
||||
)}
|
||||
|
|
|
@ -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;
|
||||
---
|
||||
|
||||
<HomeLayout title="Movies">
|
||||
|
|
|
@ -35,12 +35,20 @@ const item = (await res.json()).movie as MovieDetail;
|
|||
</div>
|
||||
<div class="col align-self-center">
|
||||
<div class="d-grid">
|
||||
<a
|
||||
href={`/home/movies/${item.movie.id}`}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
Watch
|
||||
</a>
|
||||
{
|
||||
item.stats ? (
|
||||
<a
|
||||
href={`/home/movies/${item.movie.id}`}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
Watch
|
||||
</a>
|
||||
) : (
|
||||
<span class="badge text-bg-warning">
|
||||
Bientot disponible
|
||||
</span>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
|
|
Loading…
Reference in a new issue