import { Rating } from '../../gql'

const Ratings = ({ ratings }: { ratings?: Rating[] }) => {
  return (
    <>
      <h2>Ratings</h2>
      {ratings ? (
        <ul>
          {ratings.map(rating => (
            <li key={rating.id}>
              {rating.comment} {rating.value} {rating.user.name}
            </li>
          ))}
        </ul>
      ) : (
        <p>No ratings found</p>
      )}
    </>
  )
}

export default Ratings
