// Rôle : affiche une carte de faune endémique Monster Hunter Wilds.
import { IconRow } from "./IconRow.jsx";
import { assetPath, getConditionValues, normalizeText } from "../utils.js";

export function EndemicCard({ item, t }) {
  const locations = getConditionValues(item.locations);
  const description = t(item.description);
  const normalizedDescription = normalizeText(description);
  const hasDescription = normalizedDescription
    && normalizedDescription !== normalizeText("à compléter")
    && normalizedDescription !== normalizeText("to be completed");

  return (
    <article className="mhwilds-card endemic-card">
      <div className="mhwilds-card-art">
        <img src={assetPath(item.name)} alt={t(item.name, { capitalize: true })} loading="lazy" />
      </div>
      <div className="mhwilds-card-body">
        <h2>{t(item.name, { capitalize: true })}</h2>
        <IconRow label={t("locations", { capitalize: true })} values={locations} t={t} />
        {hasDescription && <p>{description}</p>}
      </div>
    </article>
  );
}
