import type { Master } from '@/lib/types'
import { MasterRow } from './MasterRow'

interface Props {
  masters: Master[]
}

export function RankingTable({ masters }: Props) {
  return (
    <div className="table-scroll-wrap">
      <table className="ranking-table-full reveal" style={{ opacity: 1, transform: 'none' }}>
        <thead>
          <tr>
            <th style={{ width: 44 }}>#</th>
            <th>Master</th>
            <th>Note globale</th>
            <th className="col-hide-sm">Sélectivité</th>
            <th className="col-hide-md">Critères (/6)</th>
          </tr>
        </thead>
        <tbody>
          {masters.map((master) => (
            <MasterRow key={master.id} master={master} />
          ))}
        </tbody>
        <tfoot>
          <tr>
            <td colSpan={5}>
              {masters.length} master{masters.length > 1 ? 's' : ''} classé{masters.length > 1 ? 's' : ''} · Mise à jour automatique
            </td>
          </tr>
        </tfoot>
      </table>
    </div>
  )
}
