chore: upratanie lint upozorneni z uloh 11-18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c2fb60fd6
commit
eb92d30dc3
3 files changed
+15
-8
No files matched your search
@@ -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 { 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';
|
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
|
// Riadok tabuľky badges v Supabase pre danú šablónu
|
||||||
function toBadgeDbPayload(badge: BadgeTemplate) {
|
function toBadgeDbPayload(badge: BadgeTemplate) {
|
||||||
return {
|
return {
|
||||||
@@ -426,7 +431,7 @@ export const BadgeEditorModal: React.FC<BadgeEditorModalProps> = ({
|
|||||||
const duplicateBadgeTemplate = async (badge: BadgeTemplate) => {
|
const duplicateBadgeTemplate = async (badge: BadgeTemplate) => {
|
||||||
const copy: BadgeTemplate = {
|
const copy: BadgeTemplate = {
|
||||||
...JSON.parse(JSON.stringify(badge)),
|
...JSON.parse(JSON.stringify(badge)),
|
||||||
id: `badge-${Date.now()}`,
|
id: newLocalBadgeId(),
|
||||||
name: `${badge.name} (kópia)`
|
name: `${badge.name} (kópia)`
|
||||||
};
|
};
|
||||||
let saved = copy;
|
let saved = copy;
|
||||||
@@ -438,7 +443,9 @@ export const BadgeEditorModal: React.FC<BadgeEditorModalProps> = ({
|
|||||||
if (!error && data && data[0]) {
|
if (!error && data && data[0]) {
|
||||||
saved = { ...copy, id: data[0].id };
|
saved = { ...copy, id: data[0].id };
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch {
|
||||||
|
// bez databázy ostane kópia v prehliadači
|
||||||
|
}
|
||||||
|
|
||||||
const list = [...badges];
|
const list = [...badges];
|
||||||
const idx = list.findIndex((b) => b.id === badge.id);
|
const idx = list.findIndex((b) => b.id === badge.id);
|
||||||
@@ -448,7 +455,9 @@ export const BadgeEditorModal: React.FC<BadgeEditorModalProps> = ({
|
|||||||
setSelectedLayerId(saved.layersConfig?.[0]?.id ?? null);
|
setSelectedLayerId(saved.layersConfig?.[0]?.id ?? null);
|
||||||
try {
|
try {
|
||||||
localStorage.setItem('coop_custom_badges', JSON.stringify(list));
|
localStorage.setItem('coop_custom_badges', JSON.stringify(list));
|
||||||
} catch (e) {}
|
} catch {
|
||||||
|
// localStorage nemusí byť dostupný
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteBadgeTemplate = async (badgeId: string) => {
|
const deleteBadgeTemplate = async (badgeId: string) => {
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ export const TopBar: React.FC<TopBarProps> = ({
|
|||||||
onExportZip,
|
onExportZip,
|
||||||
onExportBrevo,
|
onExportBrevo,
|
||||||
isExportingBrevo,
|
isExportingBrevo,
|
||||||
brevoCampaignUrl,
|
|
||||||
brevoListingUrl = 'https://app.brevo.com/campaigns/listing',
|
|
||||||
onClearBrevoId,
|
onClearBrevoId,
|
||||||
onAddModule
|
onAddModule
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -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.
|
// 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ý <img>.
|
// Outlook pre Windows (mso) pozadia nevie, dostane pôvodný <img>.
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
function hasImageAdjust(p: any): boolean {
|
function hasImageAdjust(p: ProductItem): boolean {
|
||||||
return (p.imageScale ?? 1) !== 1 || (p.imageOffsetX || 0) !== 0 || (p.imageOffsetY || 0) !== 0;
|
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
|
// Š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 scale = p.imageScale ?? 1;
|
||||||
const aspect = p.imageAspect || 1;
|
const aspect = p.imageAspect || 1;
|
||||||
const w = Math.round(baseW * scale);
|
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)
|
// 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)) {
|
if (!hasImageAdjust(p)) {
|
||||||
return `
|
return `
|
||||||
<tr height="160">
|
<tr height="160">
|
||||||
|
|||||||
Reference in new issue
Block a user