From 090fd8d1cecbcc61d826bf2b0fcaa7c5f0a408ea Mon Sep 17 00:00:00 2001 From: Jandl-hostacny Date: Mon, 19 Oct 2026 16:48:42 +0200 Subject: [PATCH] feat: tri styly textu produktu podla vzoru coop_nws_009 - nazov 15px/700, gramaz 15px/400 v tom istom riadku, jednotkova cena 11px #555 pod nazvom, volitelna poznamka 10px #888 (napr. Ilustracne foto) - text zarovnany vlavo s odsadenim 14px; jednotkova cena sa presunula spod cenovky - nove polia Gramaz / mnozstvo a Poznamka pri produkte aj vernostnom produkte Co-Authored-By: Claude Opus 5.5 --- src/components/editor/ConfigPanel.tsx | 65 ++++++++++++++++++++++++++- src/lib/emailRenderer.ts | 32 +++++++------ src/types/newsletter.ts | 6 ++- 3 files changed, 87 insertions(+), 16 deletions(-) diff --git a/src/components/editor/ConfigPanel.tsx b/src/components/editor/ConfigPanel.tsx index f0a515e..4d77a66 100644 --- a/src/components/editor/ConfigPanel.tsx +++ b/src/components/editor/ConfigPanel.tsx @@ -805,6 +805,37 @@ export const ConfigPanel: React.FC = ({ /> +
+
+ + { + const products = [...module.data.products]; + products[pIdx].quantity = e.target.value; + updateData({ products }); + }} + placeholder="napr. 35 g" + className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white" + /> +
+
+ + { + const products = [...module.data.products]; + products[pIdx].note = e.target.value; + updateData({ products }); + }} + placeholder="napr. Ilustračné foto" + className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white" + /> +
+
+ = ({ />
- + = ({ products[pIdx].unitPrice = e.target.value; updateData({ products }); }} + placeholder="jednotková cena 9,43 EUR/kg" className="w-full text-xs border border-gray-300 rounded p-1 bg-white text-[10px]" />
@@ -1457,6 +1489,37 @@ export const ConfigPanel: React.FC = ({ /> +
+
+ + { + const products = [...module.data.products]; + products[pIdx].quantity = e.target.value; + updateData({ products }); + }} + placeholder="napr. 35 g" + className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white" + /> +
+
+ + { + const products = [...module.data.products]; + products[pIdx].note = e.target.value; + updateData({ products }); + }} + placeholder="napr. Ilustračné foto" + className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white" + /> +
+
+ `; } +// Popis produktu podľa vzoru coop_nws_009: 3 štýly textu (+ voliteľná poznámka) +// názov 15px/700 · gramáž 15px/400 (v tom istom riadku) · jednotková cena 11px #555 · poznámka 10px #888 +const PRODUCT_TEXT_FONT = "font-family: 'Poppins', Helvetica, Arial, sans-serif;"; +function renderProductTextBlock(p: { title?: string; quantity?: string; note?: string }, unitPrice?: string): string { + return `

${escapeHtml(p.title || '')}${p.quantity ? ` ${escapeHtml(p.quantity)}` : ''}

${ + unitPrice ? ` +
${escapeHtml(unitPrice)}
` : ''}${ + p.note ? ` +
${escapeHtml(p.note)}
` : ''}`; +} + // Štítky dostupnosti v predajniach (Potraviny / Supermarket / Tempo); prázdne, ak nie je zvolená žiadna function renderStoresHtml(p: { stores?: Partial }): string { const tag = (color: string, file: string, alt: string) => @@ -866,7 +877,6 @@ function renderExactProductCard( `; const badgeCell = ` ${renderBadgeContent(bWidth, bAlign, padTop, padBottom, marginStyle)} - ${p.unitPrice ? `
${escapeHtml(p.unitPrice)}
` : ''} `; if (!hasImageAdjust(p)) { return `${imgCell}${badgeCell}`; @@ -890,8 +900,8 @@ function renderExactProductCard( `; })()} - -

${escapeHtml(p.title)}

+ + ${renderProductTextBlock(p, p.unitPrice)} `; @@ -918,8 +928,8 @@ function renderExactProductCard( pickAlt(p.imageAlt, p.title, sectionTitle, 'Produkt') )} - -

${escapeHtml(p.title)}

+ + ${renderProductTextBlock(p, p.unitPrice)} @@ -940,9 +950,7 @@ function renderExactProductCard( - - ${p.unitPrice ? `
${escapeHtml(p.unitPrice)}
` : '
 
'} - +   `; } @@ -979,8 +987,8 @@ function renderExactLoyaltyCard(p: any, validity: string, storesOffset: StoresOf `} - -

${escapeHtml(p.title)}

+ + ${renderProductTextBlock(p, p.badgeCustomTemplate || p.customBadgePngUrl ? p.cardUnitPrice || p.unitPrice : '')} @@ -1082,9 +1090,7 @@ function renderExactLoyaltyCard(p: any, validity: string, storesOffset: StoresOf ${p.badgeCustomTemplate || p.customBadgePngUrl ? ` - - ${p.cardUnitPrice || p.unitPrice ? `
${escapeHtml(p.cardUnitPrice || p.unitPrice)}
` : '
 
'} - +   ` : ''} `; } diff --git a/src/types/newsletter.ts b/src/types/newsletter.ts index 0f165f1..b1bd34c 100644 --- a/src/types/newsletter.ts +++ b/src/types/newsletter.ts @@ -19,11 +19,13 @@ export interface StoreTag { export interface ProductItem { id: string; - title: string; + title: string; // názov (tučne), napr. "Deli tyčinka 3 druhy" + quantity?: string; // gramáž / množstvo (normálne písmo za názvom), napr. "35 g" + note?: string; // poznámka pod jednotkovou cenou, napr. "Ilustračné foto" imageUrl: string; priceMain: string; // napr. "1" alebo "0" priceSub: string; // napr. "99" alebo "89" - unitPrice: string; // napr. "1kg = 4,91 €" + unitPrice: string; // jednotková cena pod názvom, napr. "jednotková cena 9,43 EUR/kg" discountText: string; // napr. "-23%" alebo "23%" cardPriceMain?: string; // cena s kartou (vernostná), celé eurá cardPriceSub?: string; // cena s kartou, centy