'use client' /** * Cookie Banner Configuration Page * * Konfiguriert den Cookie-Banner basierend auf dem Datenpunktkatalog. */ import { useState, useEffect, useMemo } from 'react' import { useSDK } from '@/lib/sdk' import { StepHeader, STEP_EXPLANATIONS } from '@/components/sdk/StepHeader' import { EinwilligungenProvider, useEinwilligungen, } from '@/lib/sdk/einwilligungen/context' import { generateCookieBannerConfig, generateEmbedCode, DEFAULT_COOKIE_BANNER_TEXTS, DEFAULT_COOKIE_BANNER_STYLING, } from '@/lib/sdk/einwilligungen/generator/cookie-banner' import { CookieBannerConfig, CookieBannerStyling, CookieBannerTexts, SupportedLanguage, } from '@/lib/sdk/einwilligungen/types' import { Cookie, Settings, Palette, Code, Copy, Check, Eye, ArrowLeft, Monitor, Smartphone, Tablet, ChevronDown, ChevronRight, ExternalLink, } from 'lucide-react' import Link from 'next/link' // ============================================================================= // STYLING FORM // ============================================================================= interface StylingFormProps { styling: CookieBannerStyling onChange: (styling: CookieBannerStyling) => void } function StylingForm({ styling, onChange }: StylingFormProps) { const handleChange = (field: keyof CookieBannerStyling, value: string | number) => { onChange({ ...styling, [field]: value }) } return (
{/* Position */}
{(['BOTTOM', 'TOP', 'CENTER'] as const).map((pos) => ( ))}
{/* Theme */}
{(['LIGHT', 'DARK'] as const).map((theme) => ( ))}
{/* Colors */}
handleChange('primaryColor', e.target.value)} className="w-10 h-10 rounded border border-slate-200 cursor-pointer" /> handleChange('primaryColor', e.target.value)} className="flex-1 px-3 py-2 border border-slate-300 rounded-lg text-sm" />
handleChange('secondaryColor', e.target.value)} className="w-10 h-10 rounded border border-slate-200 cursor-pointer" /> handleChange('secondaryColor', e.target.value)} className="flex-1 px-3 py-2 border border-slate-300 rounded-lg text-sm" />
{/* Border Radius & Max Width */}
handleChange('borderRadius', parseInt(e.target.value))} className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm" />
handleChange('maxWidth', parseInt(e.target.value))} className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm" />
) } // ============================================================================= // TEXTS FORM // ============================================================================= interface TextsFormProps { texts: CookieBannerTexts language: SupportedLanguage onChange: (texts: CookieBannerTexts) => void } function TextsForm({ texts, language, onChange }: TextsFormProps) { const handleChange = (field: keyof CookieBannerTexts, value: string) => { onChange({ ...texts, [field]: { ...texts[field], [language]: value }, }) } const fields: { key: keyof CookieBannerTexts; label: string; multiline?: boolean }[] = [ { key: 'title', label: 'Titel' }, { key: 'description', label: 'Beschreibung', multiline: true }, { key: 'acceptAll', label: 'Alle akzeptieren Button' }, { key: 'rejectAll', label: 'Nur notwendige Button' }, { key: 'customize', label: 'Einstellungen Button' }, { key: 'save', label: 'Speichern Button' }, { key: 'privacyPolicyLink', label: 'Datenschutz-Link Text' }, ] return (
{fields.map(({ key, label, multiline }) => (
{multiline ? (