"use client"; import { IconLoader2, IconPlus, IconStar } from "@tabler/icons-react"; import { motion } from "motion/react"; import Image from "next/image"; import { useRouter } from "next/navigation"; import { useState } from "react"; interface HeroBannerProps { tmdbId: number; type: "movie" | "tv"; title: string; overview: string; backdropPath: string | null; voteAverage: number; } export function HeroBanner({ tmdbId, type, title, overview, backdropPath, voteAverage, }: HeroBannerProps) { const router = useRouter(); const [importing, setImporting] = useState(false); async function handleImport() { setImporting(true); try { const res = await fetch("/api/titles/import", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ tmdbId, type }), }); const data = await res.json(); if (data.id) { router.push(`/titles/${data.id}`); } } finally { setImporting(false); } } return (
{backdropPath ? ( {title} ) : (
)} {/* Gradient overlays */}
{/* Content */}
{type} {voteAverage > 0 && ( {voteAverage.toFixed(1)} )} Trending today

{title}

{overview}

); }