Files
Showy/react_frontend/src/components/home/MiniPosterCard.tsx
T
X4Lo 8671184dc5 Fix home page navigation and add TMDB cast page
Home page cards now check library store and link directly to EntryDetailsPage
when the entry is already added. Created useTmdbEntryLink hook for shared
library-check logic. Added TmdbCastsPage with filter/search/sort for
TMDB preview cast & crew, and limited credits to 12 on TmdbPreviewPage.
2026-06-18 13:37:39 +01:00

39 lines
1.1 KiB
TypeScript

import { Link } from "react-router-dom";
import type { TmdbEntry } from "@/types";
import { useTmdbEntryLink } from "@/hooks/useTmdbEntryLink";
interface MiniPosterCardProps {
entry: TmdbEntry;
hideTitle?: boolean;
}
export function MiniPosterCard({ entry, hideTitle }: MiniPosterCardProps) {
const title = entry.title || entry.name || "Untitled";
const poster = entry.poster_path
? `https://image.tmdb.org/t/p/w342${entry.poster_path}`
: null;
const { linkTo } = useTmdbEntryLink(entry);
return (
<Link to={linkTo} className="group space-y-2">
<div
className="relative overflow-hidden rounded-lg bg-muted"
style={{ aspectRatio: "2/3" }}
>
{poster ? (
<img
src={poster}
alt={title}
className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
/>
) : (
<div className="flex h-full w-full items-center justify-center text-xs text-muted-foreground">
No Image
</div>
)}
</div>
{!hideTitle && <p className="truncate text-xs font-medium">{title}</p>}
</Link>
);
}