// aerOS Guest v2 — product cards in 4 layouts. Exports G2Card. // Outer element is a
(not ); // kcal + prep time shown directly on the card (no need to open the detail). const metaChip = (icon, val, unit) => ( {icon({ size: 12, style: { color: C.muted } })}{val}{unit ? ' ' + unit : ''} ); // Show kcal + prep whenever the product has them (tenant entered a value); // not gated by the showCal tweak — "girilmişse görünsün". const hasCal = p.cal != null, hasPrep = p.prep != null; // Allergen icons only on the card (names shown in the detail sheet). const _icoKey = window.G2DATA && window.G2DATA.ALLERGEN_ICOKEY || {}; const _algNames = window.G2DATA && window.G2DATA.ALLERGENS || {}; const allergenIco = (p.allergens && p.allergens.length) ? ( {p.allergens.slice(0, 5).map(aid => { const ic = ALLERGEN_ICON[_icoKey[aid] || aid] || Icon.info; return {ic({ size: 14 })}; })} ) : null; const calChip = (hasCal || hasPrep || allergenIco) ? ( {hasCal && metaChip(Icon.flame, p.cal, t.cal)} {hasPrep && metaChip(Icon.clock, p.prep, t.prepTime)} {allergenIco} ) : null; // ── GALLERY (2-col grid) ── if (layout === 'gallery') { return (
{showBadge && p.badge &&
} {showDiet &&
}
{name}
{desc}
{calChip &&
{calChip}
}
{showPrice ? price : ''} {addBtn(30)}
); } // ── MAGAZINE (full-width photo) ── if (layout === 'magazine') { return (
{showBadge && p.badge && }
{showPrice &&
{price}
}
{name}
{desc}
{showDiet && }{calChip}
{addBtn(34)}
); } // ── TEXT (no photo, compact menu) ── if (layout === 'text') { return (
{name} {showBadge && p.badge && }
{desc}
{showDiet && }{calChip}
{showPrice && {price}} {addBtn(30)}
); } // ── LIST (default) ── return (
{showBadge && p.badge &&
}
{name}
{desc}
{showDiet && }{calChip}
{showPrice ? price : ''} {addBtn(32)}
); } window.G2Card = G2Card;