'use client'; import React from 'react'; import { NewsletterModule, ProductItem, BadgeTemplate } from '@/types/newsletter'; import { Plus, Trash2, Image as ImageIcon, Tag, Store, Globe, Palette, Check } from 'lucide-react'; import { SUPABASE_ASSETS_BASE } from '@/lib/defaultCampaign'; import { ImageUploadInput } from './ImageUploadInput'; const PRODUCT_BG_PRESETS = [ { label: 'Červená', sub: 'Fantasticky', color: '#feeaea', border: '#f5d4d4' }, { label: 'Žltá', sub: 'Domáce', color: '#fef0c7', border: '#e6d49a' }, { label: 'Hnedá', sub: 'Gril', color: '#dcb085', border: '#c49a6c' }, { label: 'Sivá', sub: 'Neutrálna', color: '#e6e1d9', border: '#d5cfc5' }, { label: 'Zelená', sub: 'Bio', color: '#e8f5e9', border: '#c8e6c9' }, { label: 'Biela', sub: 'Čistá', color: '#ffffff', border: '#e5e7eb' }, ]; interface ConfigPanelProps { module: NewsletterModule | null; onUpdateModule: (updated: NewsletterModule) => void; onApplyBadgeToAll?: (badge: BadgeTemplate) => void; onOpenBadgeManager?: (productId: string) => void; onOpenImport?: () => void; availableBadges?: BadgeTemplate[]; } export const ConfigPanel: React.FC = ({ module, onUpdateModule, onApplyBadgeToAll, onOpenBadgeManager, onOpenImport, availableBadges = [] }) => { if (!module) { return (

Vyberte modul v náhľade e-mailu pre úpravu jeho vlastností.

); } const updateData = (newData: any) => { onUpdateModule({ ...module, data: { ...module.data, ...newData } }); }; return (
{module.type} Názov modulu v editore
onUpdateModule({ ...module, title: e.target.value })} placeholder="Názov modulu..." className="w-full text-base font-bold text-gray-900 border border-gray-200 hover:border-gray-300 focus:border-red-500 rounded-lg px-2.5 py-1.5 bg-gray-50/50 hover:bg-white focus:bg-white focus:outline-none focus:ring-1 focus:ring-red-500 transition-all" />
{/* TOP ANNOUNCEMENT */} {module.type === 'announcement' && (
{/* Toggle zapnuté / vypnuté */}
Zobraziť v e-maile Top oznamovacia lišta
updateData({ tipBadge: e.target.value })} className="w-full text-sm border border-gray-300 rounded-lg p-2" />
updateData({ text: e.target.value })} className="w-full text-sm border border-gray-300 rounded-lg p-2" />
updateData({ linkText: e.target.value })} className="w-full text-sm border border-gray-300 rounded-lg p-2" />
updateData({ linkUrl: e.target.value })} className="w-full text-sm border border-gray-300 rounded-lg p-2" />
)} {/* HEADER */} {module.type === 'header' && (() => { const navLinks = module.data.navLinks || [ { label: 'Letáky', url: 'https://www.coop.sk/sk/letaky', variant: 'outline' }, { label: 'COOP Klub', url: 'https://www.coopklub.sk', variant: 'filled' } ]; const updateNavLink = (index: number, patch: Partial) => { const updated = [...navLinks]; updated[index] = { ...updated[index], ...patch }; updateData({ navLinks: updated }); }; return (
updateData({ logoUrl: url })} />
updateData({ logoLink: e.target.value })} className="w-full text-sm border border-gray-300 rounded-lg p-2" placeholder="https://www.coop.sk" />
{/* Tlačidlá v hlavičke */}
Tlačidlá v hlavičke {/* Tlačidlo 1 (Letáky) */}
Tlačidlo 1 (Letáky) {navLinks[0]?.variant === 'filled' ? 'Plné' : 'Obrys'}
updateNavLink(0, { label: e.target.value })} className="w-full text-xs font-bold border border-gray-300 rounded-lg p-2 bg-white" placeholder="Letáky" />
updateNavLink(0, { url: e.target.value })} className="w-full text-xs border border-gray-300 rounded-lg p-2 bg-white" placeholder="https://www.coop.sk/sk/letaky" />
{/* Tlačidlo 2 (COOP Klub) */}
Tlačidlo 2 (COOP Klub) {navLinks[1]?.variant === 'filled' ? 'Plné modré' : 'Obrys'}
updateNavLink(1, { label: e.target.value })} className="w-full text-xs font-bold border border-gray-300 rounded-lg p-2 bg-white" placeholder="COOP Klub" />
updateNavLink(1, { url: e.target.value })} className="w-full text-xs border border-gray-300 rounded-lg p-2 bg-white" placeholder="https://www.coopklub.sk" />
); })()} {/* BANNER */} {module.type === 'banner' && (
updateData({ imageUrl: url })} />
updateData({ linkUrl: e.target.value })} className="w-full text-sm border border-gray-300 rounded-lg p-2" />
updateData({ title: e.target.value })} className="w-full text-sm border border-gray-300 rounded-lg p-2" />