import React, { useEffect } from "react"; import "./ItemModal.css"; import { getServerUrl } from "../../../../config/api"; const ItemModal = ({ item, onClose, onEquip, onUnequip, isEquipped, getStatIcon, formatStatName, }) => { useEffect(() => { const handleKeyDown = (event) => { if (event.keyCode === 69) { if (isEquipped) { onUnequip(item.currentSlot); } else if (item && item.canEquip) { onEquip(item); } onClose(); } }; window.addEventListener("keydown", handleKeyDown); return () => { window.removeEventListener("keydown", handleKeyDown); }; }, [item, isEquipped, onEquip, onUnequip, onClose]); if (!item) return null; const CONNECT_URL = getServerUrl(); const ASSET_BASE_URL = `${CONNECT_URL}/static/`; const getFullTextureUrl = (path) => { if (!path) return "/assets/no-image.png"; if (path.startsWith("http")) return path; return `${ASSET_BASE_URL}${path}`; }; return (
{item.description}