// Rôle : affiche les listes Monster Hunter Wilds exportables en checklist.
import { useMemo, useState } from "react";
import { GameListsPage } from "../GameListsPage.jsx";

export function MhwildsLists({ game, mhwilds, linkedToolboxId, actions }) {
  const lists = mhwilds.lists || [];
  const [selectedListId, setSelectedListId] = useState("");
  const selectedList = useMemo(
    () => lists.find((list) => list.id === selectedListId) || lists[0] || null,
    [lists, selectedListId]
  );

  return (
    <GameListsPage
      game={game}
      lists={lists}
      selectedListId={selectedList?.id || ""}
      onSelectList={setSelectedListId}
      linkedToolboxId={linkedToolboxId}
      onCreateChecklist={(list) => actions.createChecklistFromList(game.id, list)}
    />
  );
}
