import React, { useState } from 'react'; interface BuyBoxWarningBadgeProps { asin: string; buyBoxLostMap?: Map }>; } const COUNTRY_FLAGS: Record = { DE: '🇩🇪', FR: '🇫🇷', IT: '🇮🇹', UK: '🇬🇧', ES: '🇪🇸', }; export const BuyBoxWarningBadge: React.FC = ({ asin, buyBoxLostMap }) => { const [isHovered, setIsHovered] = useState(false); if (!buyBoxLostMap || !asin) return null; const data = buyBoxLostMap.get(asin.toUpperCase()); if (!data || data.countries.length === 0) return null; return (
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} >
⚠️ BB Lost {data.countries.join(', ')}
{/* Hover Popup */} {isHovered && (
⚠️ Buy Box Lost Reason
{data.countries.map(country => (
{COUNTRY_FLAGS[country] || '🏳️'}
{country} {data.reasons[country] || 'Unknown'}
))}
)}
); };