/* ProductDetail — fullscreen overlay; zoomed hero + tabs (Overview/Specs/HowTo/Assembly) */ const ProductDetail = ({ lang, product, onClose }) => { const [tab, setTab] = React.useState('overview'); const [currentImageIndex, setCurrentImageIndex] = React.useState(0); // Image carousel state if (!product) return null; const cat = window.CATALOG.categories[product.category]; // Determine if this is an accessory product const isAccessory = cat && cat.folder === 'accessories'; const specLabel = (s) => lang === 'el' ? (s.label_el || s.label) : (s.label_en || s.label); const specValue = (s) => lang === 'el' ? (s.value_el || s.value) : (s.value_en || s.value); const sectionLabel = (sec) => { const map = { 'ΠΡΟΔΙΑΓΡΑΦΕΣ': lang === 'el' ? 'Προδιαγραφές' : 'Specifications', 'ΔΙΑΣΤΑΣΕΙΣ': lang === 'el' ? 'Διαστάσεις' : 'Dimensions', 'ΥΠΟΛΟΓΙΣΤΗΣ': lang === 'el' ? 'Υπολογιστής' : 'Computer', 'ΠΛΗΡΟΦΟΡΙΕΣ': lang === 'el' ? 'Πληροφορίες' : 'Information', }; return map[sec] || sec; }; // Get all images for carousel const images = product.images || [product.hero]; const currentImage = images[currentImageIndex] || product.hero; // Group specs by section for the table const grouped = {}; product.specs.forEach(s => { const sec = s.section || '—'; if (!grouped[sec]) grouped[sec] = []; grouped[sec].push(s); }); // Pick a few highlight specs for overview const wantedHighlights = [ 'Μέγιστο βάρος εξασκούμενου','Βάρος εξασκούμενου','Μέγιστη ταχύτητα', 'Ιπποδύναμη μοτέρ','Επίπεδα αντίστασης','Διαστάσεις τάπητα τρεξίματος', 'Μέγιστο βάρος φόρτωσης','Διαστάσεις, συναρμολογημένο', 'Πεντάλ με ιμάντα','Αναδίπλωση','Εγγύηση','ΕΓΓΥΗΣΗ ' ]; const highlights = []; wantedHighlights.forEach(lbl => { const s = product.specs.find(x => (x.label_el || x.label) === lbl); if (s && !highlights.find(h => (h.label_el || h.label) === lbl)) highlights.push(s); }); while (highlights.length < 4 && highlights.length < product.specs.length) { const next = product.specs[highlights.length]; if (!highlights.find(h => (h.label_el || h.label) === (next.label_el || next.label))) highlights.push(next); else break; } const stop = (e) => e.stopPropagation(); // Get bilingual product name const productName = lang === 'el' ? (product.name_el || product.name || product.code) : (product.name_en || product.name || product.code); return (
ENERGETICS {lang === 'el' ? cat.label_el : cat.label_en}

{productName}

{t('code_label', lang)}: {product.code}
{product.hero_folded && !currentImageIndex ? (
{productName}
{`${productName}
) : ( {productName} )}
{product.code}
{/* Image carousel navigation */} {images.length > 1 && (
{currentImageIndex + 1} / {images.length}
)}
{(['overview','specs','howto'].concat(isAccessory ? [] : ['assembly'])).map(k => ( ))}
{tab === 'overview' && (
{t('certified', lang)} {t('warranty', lang)}: 2 {t('warranty_years', lang)}
    {highlights.map((h,i) => (
  • {specLabel(h)} {specValue(h)}
  • ))}
{t('price_label', lang)} {lang==='el' ? product.priceLabel_el : product.priceLabel_en}
)} {tab === 'specs' && (
{Object.keys(grouped).map(sec => (
{sec !== '—' &&

{sectionLabel(sec)}

} {grouped[sec].map((s,i) => ( ))}
{specLabel(s)} {specValue(s)}
))}
)} {tab === 'howto' && ( )} {tab === 'assembly' && ( )}
); }; const VideoPlaceholder = ({ lang, kind, src }) => { if (src) { return (
); } return (

{t('video_placeholder', lang)}

{t('tab_' + kind, lang)}
); }; window.ProductDetail = ProductDetail;