import React from 'react';
import ReviewItem from './ReviewItem';

// ReviewList now expects reviews and optionally reviewCharacteristics and isProfilePage
function ReviewList({ reviews, reviewCharacteristics = {}, isProfilePage = false }) {
  return (
    <div className="mt-8 space-y-6">
      {reviews.length === 0 ? (
        <div className="text-center py-8 text-campfire-light">
          Рецензий пока нет. Будьте первым!
        </div>
      ) : (
        reviews.map(review => (
          <ReviewItem
            key={review.id}
            review={review}
            // Pass expanded media and season data from the review's expand field
            media={review.expand?.media_id}
            season={review.expand?.season_id}
            // Pass characteristics from the expanded media (if available)
            // ReviewItem will use this or fallback to review.expand.media_id.characteristics
            reviewCharacteristics={review.expand?.media_id?.characteristics || reviewCharacteristics}
            isProfilePage={isProfilePage} // Pass down the prop
          />
        ))
      )}
    </div>
  );
}

export default ReviewList;
