'use client' import { useState } from 'react' import { useTheme } from '@/lib/ThemeContext' import { useAlerts, lehrerThemen, AlertImportance } from '@/lib/AlertsContext' import { Step1TopicSelection, Step2Instructions, Step3Forwarding, Step4Settings } from './alerts-wizard/AlertsWizardSteps' interface AlertsWizardProps { onComplete: () => void onSkip?: () => void } export function AlertsWizard({ onComplete, onSkip }: AlertsWizardProps) { const { isDark } = useTheme() const { addTopic, updateSettings } = useAlerts() const [step, setStep] = useState(1) const [selectedTopics, setSelectedTopics] = useState([]) const [customTopic, setCustomTopic] = useState({ name: '', keywords: '' }) const [rssFeedUrl, setRssFeedUrl] = useState('') const [notificationFrequency, setNotificationFrequency] = useState<'realtime' | 'hourly' | 'daily'>('daily') const [minImportance, setMinImportance] = useState('PRUEFEN') const totalSteps = 4 const handleNext = () => { if (step < totalSteps) setStep(step + 1); else completeWizard() } const handleBack = () => { if (step > 1) setStep(step - 1) } const completeWizard = () => { selectedTopics.forEach(topicId => { const topic = lehrerThemen.find(t => t.name === topicId) if (topic) { addTopic({ id: `topic-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, name: topic.name, keywords: topic.keywords, icon: topic.icon, isActive: true, rssFeedUrl: rssFeedUrl || undefined }) } }) if (customTopic.name.trim()) { addTopic({ id: `topic-${Date.now()}-custom`, name: customTopic.name, keywords: customTopic.keywords.split(',').map(k => k.trim()).filter(k => k), icon: '📌', isActive: true, rssFeedUrl: rssFeedUrl || undefined }) } updateSettings({ notificationFrequency, minImportance, wizardCompleted: true }) onComplete() } const toggleTopic = (topicName: string) => { setSelectedTopics(prev => prev.includes(topicName) ? prev.filter(t => t !== topicName) : [...prev, topicName]) } const canProceed = () => { if (step === 1) return selectedTopics.length > 0 || customTopic.name.trim().length > 0 return true } return (
🔔

Google Alerts einrichten

Bleiben Sie informiert ueber Bildungsthemen

{[1, 2, 3, 4].map((s) => (
{s < step ? '✓' : s}
))}
{step === 1 && } {step === 2 && } {step === 3 && } {step === 4 && }
{step > 1 && ()}
{onSkip && ()}
) }