From eb92d30dc3b04ad161211f1e0d68a9581366f1c5 Mon Sep 17 00:00:00 2001 From: Jandl-hostacny Date: Mon, 19 Oct 2026 10:42:34 +0200 Subject: [PATCH] chore: upratanie lint upozorneni z uloh 11-18 Co-Authored-By: Claude Opus 5.5 --- src/components/editor/BadgeEditorModal.tsx | 15 ++++++++++++--- src/components/editor/TopBar.tsx | 2 -- src/lib/emailRenderer.ts | 6 +++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/editor/BadgeEditorModal.tsx b/src/components/editor/BadgeEditorModal.tsx index ba83896..2025edd 100644 --- a/src/components/editor/BadgeEditorModal.tsx +++ b/src/components/editor/BadgeEditorModal.tsx @@ -6,6 +6,11 @@ import { supabase } from '@/lib/supabase'; import { DEFAULT_BADGE_TEMPLATES, renderCleanBadgeSvg, svgToCleanPng, BADGE_PRICE_TOKEN_RE, badgePriceParts, replaceBadgeTextVars } from '@/lib/badgeUtils'; import { Tag, Plus, Check, Trash2, X, Upload, Eye, Move, AlignLeft, AlignCenter, AlignRight, ZoomIn, ZoomOut, Copy } from 'lucide-react'; +// Dočasné ID šablóny pred uložením do databázy (prefix badge- = ešte nie je v Supabase) +function newLocalBadgeId(): string { + return `badge-${Date.now()}`; +} + // Riadok tabuľky badges v Supabase pre danú šablónu function toBadgeDbPayload(badge: BadgeTemplate) { return { @@ -426,7 +431,7 @@ export const BadgeEditorModal: React.FC = ({ const duplicateBadgeTemplate = async (badge: BadgeTemplate) => { const copy: BadgeTemplate = { ...JSON.parse(JSON.stringify(badge)), - id: `badge-${Date.now()}`, + id: newLocalBadgeId(), name: `${badge.name} (kópia)` }; let saved = copy; @@ -438,7 +443,9 @@ export const BadgeEditorModal: React.FC = ({ if (!error && data && data[0]) { saved = { ...copy, id: data[0].id }; } - } catch (e) {} + } catch { + // bez databázy ostane kópia v prehliadači + } const list = [...badges]; const idx = list.findIndex((b) => b.id === badge.id); @@ -448,7 +455,9 @@ export const BadgeEditorModal: React.FC = ({ setSelectedLayerId(saved.layersConfig?.[0]?.id ?? null); try { localStorage.setItem('coop_custom_badges', JSON.stringify(list)); - } catch (e) {} + } catch { + // localStorage nemusí byť dostupný + } }; const deleteBadgeTemplate = async (badgeId: string) => { diff --git a/src/components/editor/TopBar.tsx b/src/components/editor/TopBar.tsx index 1e0a472..96b7cba 100644 --- a/src/components/editor/TopBar.tsx +++ b/src/components/editor/TopBar.tsx @@ -44,8 +44,6 @@ export const TopBar: React.FC = ({ onExportZip, onExportBrevo, isExportingBrevo, - brevoCampaignUrl, - brevoListingUrl = 'https://app.brevo.com/campaigns/listing', onClearBrevoId, onAddModule }) => { diff --git a/src/lib/emailRenderer.ts b/src/lib/emailRenderer.ts index 13e4f16..1842358 100644 --- a/src/lib/emailRenderer.ts +++ b/src/lib/emailRenderer.ts @@ -636,7 +636,7 @@ function renderModule(m: any, campaign: NewsletterCampaign): string { // fungujú aj v Gmaile, ktorý transform/position odstraňuje); čo presahuje rámik, sa oreže. // Outlook pre Windows (mso) pozadia nevie, dostane pôvodný . // --------------------------------------------------------------------------- -function hasImageAdjust(p: any): boolean { +function hasImageAdjust(p: ProductItem): boolean { return (p.imageScale ?? 1) !== 1 || (p.imageOffsetX || 0) !== 0 || (p.imageOffsetY || 0) !== 0; } @@ -646,7 +646,7 @@ function stripHtmlComments(html: string): string { } // Štýl pozadia: fotka so základnou šírkou baseW, vycentrovaná na (centerX, centerY) rámika, plus zoom a posun -function adjustedImageBgStyle(p: any, baseW: number, centerX: number, centerY: number): string { +function adjustedImageBgStyle(p: ProductItem, baseW: number, centerX: number, centerY: number): string { const scale = p.imageScale ?? 1; const aspect = p.imageAspect || 1; const w = Math.round(baseW * scale); @@ -657,7 +657,7 @@ function adjustedImageBgStyle(p: any, baseW: number, centerX: number, centerY: n } // Riadok s fotkou pod sebou (rozloženie "pod obrázkom" a vernostné karty) -function renderStackedImageRow(p: any, imgHtml: string, cellStyle: string, cardWidth: number, maxImgW: number, alt: string): string { +function renderStackedImageRow(p: ProductItem, imgHtml: string, cellStyle: string, cardWidth: number, maxImgW: number, alt: string): string { if (!hasImageAdjust(p)) { return `