diff --git a/src/app/api/brevo/export/route.ts b/src/app/api/brevo/export/route.ts index 7848e4e..5acec9f 100644 --- a/src/app/api/brevo/export/route.ts +++ b/src/app/api/brevo/export/route.ts @@ -63,8 +63,8 @@ export async function POST(req: NextRequest) { success: true, updated: true, campaignId: Number(existingCampaignId), - brevoUrl: 'https://app.brevo.com/campaigns', - brevoListingUrl: 'https://app.brevo.com/campaigns', + brevoUrl: 'https://app.brevo.com/campaigns/listing', + brevoListingUrl: 'https://app.brevo.com/campaigns/listing', message: 'Kampaň bola úspešne aktualizovaná v Brevo!' }); } @@ -113,8 +113,8 @@ export async function POST(req: NextRequest) { success: true, updated: false, campaignId: data.id, - brevoUrl: 'https://app.brevo.com/campaigns', - brevoListingUrl: 'https://app.brevo.com/campaigns', + brevoUrl: 'https://app.brevo.com/campaigns/listing', + brevoListingUrl: 'https://app.brevo.com/campaigns/listing', message: 'Kampaň bola úspešne vytvorená v Brevo!' }); } catch (error: any) { diff --git a/src/app/api/brevo/verify/route.ts b/src/app/api/brevo/verify/route.ts index 5d9845b..8f13501 100644 --- a/src/app/api/brevo/verify/route.ts +++ b/src/app/api/brevo/verify/route.ts @@ -51,8 +51,8 @@ export async function GET(req: NextRequest) { name: data.name, status: data.status, subject: data.subject, - brevoUrl: 'https://app.brevo.com/campaigns', - brevoListingUrl: 'https://app.brevo.com/campaigns' + brevoUrl: 'https://app.brevo.com/campaigns/listing', + brevoListingUrl: 'https://app.brevo.com/campaigns/listing' }); } catch (err: any) { console.error('Brevo verify error:', err); diff --git a/src/app/page.tsx b/src/app/page.tsx index bec7256..47f88e3 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -144,7 +144,7 @@ export default function Home() { modules: enforceAnchors(dbItem.data.modules) }); if (dbItem.brevo_campaign_id) { - setBrevoUrl('https://app.brevo.com/campaigns'); + setBrevoUrl('https://app.brevo.com/campaigns/listing'); } } } diff --git a/src/components/editor/ConfigPanel.tsx b/src/components/editor/ConfigPanel.tsx index 498a3ef..87af19d 100644 --- a/src/components/editor/ConfigPanel.tsx +++ b/src/components/editor/ConfigPanel.tsx @@ -2,10 +2,19 @@ import React from 'react'; import { NewsletterModule, ProductItem, BadgeTemplate } from '@/types/newsletter'; -import { Plus, Trash2, Image as ImageIcon, Tag, Store, Globe } from 'lucide-react'; +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; @@ -40,11 +49,20 @@ export const ConfigPanel: React.FC = ({ return (
-
- - {module.type} - -

{module.title}

+
+
+ + {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 */} @@ -307,6 +325,99 @@ export const ConfigPanel: React.FC = ({ />
+ {/* Farba pozadia skupiny produktov */} +
+
+
+ + +
+ + {module.data.cardBgColor || '#feeaea'} + +
+ + {/* Rýchle predvoľby */} +
+ {PRODUCT_BG_PRESETS.map((preset) => { + const currentBg = (module.data.cardBgColor || '#feeaea').toLowerCase(); + const isSelected = currentBg === preset.color.toLowerCase(); + return ( + + ); + })} +
+ + {/* Vlastná farba (Color Picker + HEX input) */} +
+ Vlastná: +
+ { + const newColor = e.target.value; + const updatedProducts = (module.data.products || []).map((p: ProductItem) => ({ + ...p, + cardBgColor: newColor, + })); + updateData({ + cardBgColor: newColor, + products: updatedProducts, + }); + }} + className="w-7 h-7 rounded border border-gray-300 cursor-pointer p-0.5 bg-white shrink-0" + /> + { + const newColor = e.target.value; + const updatedProducts = (module.data.products || []).map((p: ProductItem) => ({ + ...p, + cardBgColor: newColor, + })); + updateData({ + cardBgColor: newColor, + products: updatedProducts, + }); + }} + placeholder="#feeaea" + className="w-full text-xs font-mono border border-gray-300 rounded px-2 py-1 bg-white uppercase text-gray-800 font-bold" + /> +
+
+
+ {/* Zoznam produktov */}
@@ -324,7 +435,7 @@ export const ConfigPanel: React.FC = ({ unitPrice: '1kg = 4,99 €', discountText: '20%', badgeText: 'zľava', - cardBgColor: '#feeaea', + cardBgColor: module.data.cardBgColor || '#feeaea', stores: { potraviny: true, supermarket: true, tempo: true } }; updateData({ products: [...(module.data.products || []), newP] }); @@ -791,6 +902,97 @@ export const ConfigPanel: React.FC = ({ />
+ {/* Farba pozadia vernostných kariet */} +
+
+
+ + +
+ + {module.data.cardBgColor || '#e6e1d9'} + +
+ + {/* Rýchle predvoľby */} +
+ {PRODUCT_BG_PRESETS.map((preset) => { + const currentBg = (module.data.cardBgColor || '#e6e1d9').toLowerCase(); + const isSelected = currentBg === preset.color.toLowerCase(); + return ( + + ); + })} +
+ + {/* Vlastná farba (Color Picker + HEX input) */} +
+ Vlastná: +
+ { + const newColor = e.target.value; + const updatedProducts = (module.data.products || []).map((p: any) => ({ + ...p, + cardBgColor: newColor, + })); + updateData({ + cardBgColor: newColor, + products: updatedProducts, + }); + }} + className="w-7 h-7 rounded border border-gray-300 cursor-pointer p-0.5 bg-white shrink-0" + /> + { + const newColor = e.target.value; + const updatedProducts = (module.data.products || []).map((p: any) => ({ + ...p, + cardBgColor: newColor, + })); + updateData({ + cardBgColor: newColor, + products: updatedProducts, + }); + }} + placeholder="#e6e1d9" + className="w-full text-xs font-mono border border-gray-300 rounded px-2 py-1 bg-white uppercase text-gray-800 font-bold" + /> +
+
+
+ {/* 2 Vernostné produkty */}
diff --git a/src/components/editor/TopBar.tsx b/src/components/editor/TopBar.tsx index 3878b2b..70d7782 100644 --- a/src/components/editor/TopBar.tsx +++ b/src/components/editor/TopBar.tsx @@ -212,9 +212,9 @@ export const TopBar: React.FC = ({ ) : isVerifiedInBrevo && campaign.brevoCampaignId ? ( /* Kampaň je overená priamo v Brevo: Ponúkame úpravu, aktualizáciu alebo odoslanie ako novú */
- {/* Odkaz na úpravu v Brevo */} + {/* Odkaz na zoznam / úpravu v Brevo */} = ({ {isExportingBrevo ? 'Ukladám...' : 'Aktualizovať'} + {/* Tlačidlo na odoslanie ako úplne novej kampane */} + + {/* Tlačidlo na overenie stavu */}