import React from "react";
import GameDataManager from "../../../../services/GameDataManager";
import { config } from "../../../../config/api";
import "./DatapackDetailsModal.css";
const DatapackDetailsModal = ({ data, onClose }) => {
if (!data) return null;
const renderStats = () => {
if (!data.stats) return null;
return (
{Object.entries(data.stats).map(([key, value]) => (
{GameDataManager.getStatName(key) || key}:
{value}
))}
);
};
const renderLoot = () => {
if (!data.loot || data.loot.length === 0) return null;
return (
Loot Table
{data.loot.map((entry, idx) => {
const itemInfo = GameDataManager.getItem(entry.id);
const countDisplay =
typeof entry.count === "object"
? `${entry.count.min}-${entry.count.max}`
: entry.count;
return (
{itemInfo?.texture ? (

) : (
?
)}
{itemInfo?.displayName || entry.id}
{Math.round(entry.chance * 100)}% chance • Amount:{" "}
{countDisplay}
);
})}
);
};
return (
e.stopPropagation()}
>
{data.texture ? (

) : (
{data.displayName?.[0]}
)}
{data.displayName}
{data.id}
{data.description && (
{data.description}
)}
Properties & Stats
{renderStats()}
{data.sectionType === "hostiles" && data.level && (
Base Level:
{data.level}
)}
{data.sectionType === "hostiles" && renderLoot()}
{data.ingredients && (
Recipe Requirements
{data.ingredients.map((ing, idx) => (
{ing.displayName}
x{ing.quantity}
))}
)}
);
};
export default DatapackDetailsModal;