import Link from "next/link"; import { User } from "@/lib/api"; import { UserAvatar } from "@/components/user-avatar"; import { formatDistanceToNow, format } from "date-fns"; import { Card, CardContent, CardHeader } from "@/components/ui/card"; import { profileHref } from "@/lib/utils"; function isSafeImageUrl(url: string): boolean { try { const u = new URL(url); return u.protocol === "https:" || u.protocol === "http:"; } catch { return false; } } interface MovieMeta { movieTitle: string; releaseYear?: number; posterUrl?: string | null; rating?: number; comment?: string | null; watchedAt?: string | null; watchlistEntry?: boolean; } interface MovieCardProps { meta: MovieMeta; author: User; createdAt: Date; } function StarRating({ rating, max = 5 }: { rating: number; max?: number }) { return (
{meta.movieTitle} {year && {year}}
{isWatchlist ? (📋 Want to watch
) : ( <> {meta.rating !== undefined && (Watched {watchedDate}
)} > )} {meta.comment && ({meta.comment}
)}