import StarRating from './StarRating'; interface Review { id: string; rating: number; title?: string; comment: string; user: { name: string; avatar_url?: string }; created_at: string; images?: string[]; } interface ReviewListProps { reviews: Review[]; productId?: string; onLoadMore?: () => void; hasMore?: boolean; isLoading?: boolean; } export default function ReviewList({ reviews, productId, onLoadMore, hasMore = false, isLoading = false }: ReviewListProps) { if (!reviews?.length) { return (

ยังไม่มีรีวิว

เป็นคนแรกที่รีวิวสินค้านี้

เขียนรีวิว
); } return (
{reviews.map(review => (
{review.user.avatar_url ? ( {review.user.name} ) : ( {review.user.name.charAt(0).toUpperCase()} )}

{review.user.name}

{new Date(review.created_at).toLocaleDateString('th-TH', { year: 'numeric', month: 'long', day: 'numeric' })}
{review.title && (

{review.title}

)}

{review.comment}

{review.images && review.images.length > 0 && (
{review.images.map((img, i) => ( {`รูปรีวิว ))}
)}
))} {hasMore && (
)}
); }