'use client' import { useState, useEffect } from 'react' import { useRouter } from 'next/navigation' import { useTheme } from '@/lib/ThemeContext' import { useLanguage } from '@/lib/LanguageContext' import { useAlertsB2B, B2BHit, B2BTopic, ImportanceLabel, DecisionLabel, getImportanceLabelColor, getDecisionLabelColor, formatDeadline, getPackageIcon, getPackageLabel } from '@/lib/AlertsB2BContext' import { Sidebar } from '@/components/Sidebar' import { B2BMigrationWizard } from '@/components/B2BMigrationWizard' import { TipBox } from '@/components/InfoBox' import { Footer } from '@/components/Footer' import { LanguageDropdown } from '@/components/LanguageDropdown' import { ThemeToggle } from '@/components/ThemeToggle' // Decision Trace Modal function DecisionTraceModal({ hit, onClose }: { hit: B2BHit onClose: () => void }) { const { isDark } = useTheme() const trace = hit.decisionTrace return (

Decision Trace

{trace ? (
{/* Rules Triggered */}

Regeln ausgeloest

{trace.rulesTriggered.map((rule, idx) => ( {rule} ))}
{/* LLM Used */}
LLM verwendet {trace.llmUsed ? `Ja (${Math.round((trace.llmConfidence || 0) * 100)}% Konfidenz)` : 'Nein'}
{/* Signals */}
{/* Procurement Signals */} {trace.signals.procurementSignalsFound.length > 0 && (

Beschaffungs-Signale

{trace.signals.procurementSignalsFound.join(', ')}

)} {/* Public Buyer Signals */} {trace.signals.publicBuyerSignalsFound.length > 0 && (

Oeffentliche Auftraggeber

{trace.signals.publicBuyerSignalsFound.join(', ')}

)} {/* Product Signals */} {trace.signals.productSignalsFound.length > 0 && (

Produkt-Signale

{trace.signals.productSignalsFound.join(', ')}

)} {/* Negatives */} {trace.signals.negativesFound.length > 0 && (

Negative Signale

{trace.signals.negativesFound.join(', ')}

)}
) : (

Kein Decision Trace verfuegbar.

)}
) } // Email Import Modal function EmailImportModal({ onClose, onImport }: { onClose: () => void onImport: (content: string, subject?: string) => void }) { const { isDark } = useTheme() const [emailSubject, setEmailSubject] = useState('') const [emailContent, setEmailContent] = useState('') const [isProcessing, setIsProcessing] = useState(false) const handleImport = async () => { if (!emailContent.trim()) return setIsProcessing(true) // Simulate processing delay await new Promise(resolve => setTimeout(resolve, 800)) onImport(emailContent, emailSubject || undefined) setIsProcessing(false) onClose() } return (
📧

E-Mail manuell einfuegen

Fuegen Sie den Inhalt einer Google Alert E-Mail ein

{/* Subject (optional) */}
setEmailSubject(e.target.value)} className={`w-full px-4 py-3 rounded-xl border ${ isDark ? 'bg-white/10 border-white/20 text-white placeholder-white/40' : 'bg-white border-slate-200 text-slate-900 placeholder-slate-400' }`} />
{/* Email Content */}