"use client"; import Image from "next/image"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import type { AvailabilityOffer } from "@/lib/types/title"; const offerLabels: Record = { flatrate: "Stream", rent: "Rent", buy: "Buy", free: "Free", ads: "With Ads", }; function ProviderBadge({ name, logoPath, }: { name: string; logoPath: string | null; }) { return ( {logoPath ? ( {name} ) : ( {name.slice(0, 2)} )} {name} ); } export function TitleAvailability({ availability, }: { availability: AvailabilityOffer[]; }) { const availByType: Record = {}; for (const offer of availability) { if (!availByType[offer.offerType]) availByType[offer.offerType] = []; availByType[offer.offerType].push(offer); } if (Object.keys(availByType).length === 0) return null; return (

Where to Watch

{Object.entries(availByType).map(([type, offers]) => (
{offerLabels[type] ?? type}
{offers.map((offer) => ( ))}
))}
); }