import { Star } from "lucide-react"; export type EventRatingsSummary = { average: number; count: number; }; export function EventRatingBadge({ ratings }: { ratings: EventRatingsSummary | null | undefined }) { const count = ratings?.count ?? 0; const average = ratings?.average ?? 0; if (!count || count <= 0 || !Number.isFinite(average) || average <= 0) return null; const full = Math.floor(average); const hasHalf = average % 1 >= 0.4; return ( <>
{[1, 2, 3, 4, 5].map((i) => { const filled = i <= full || (i === full + 1 && hasHalf); return ( ); })}
{average.toFixed(1)} ({count}) ); }