// Rôle : configure les filtres Monster Hunter Wilds pour monstres et faune.
import { GameFiltersPanel } from "../GameFiltersPanel.jsx";
import { assetPath } from "./utils.js";

export function MhwildsFilters({ category, filterKey, options, filters, setFilters, t }) {
  const activeFilters = filters[category];

  return (
    <GameFiltersPanel
      title={category === "monsters" ? t("weaknesses", { capitalize: true }) : t("locations", { capitalize: true })}
      nameLabel={t("name", { capitalize: true })}
      resetLabel={t("reset", { capitalize: true })}
      logicLabels={{ and: t("and", { capitalize: true }), or: t("or", { capitalize: true }) }}
      filters={activeFilters}
      selectedKey={filterKey}
      options={options}
      getOptionLabel={(option) => t(option, { capitalize: true })}
      renderOptionMedia={(option) => <img src={assetPath(option)} alt="" />}
      onChange={(nextFilters) => setFilters((state) => ({ ...state, [category]: nextFilters }))}
    />
  );
}
