'use client' import { useRouter } from 'next/navigation' import { useLanguage } from '@/lib/LanguageContext' import { useTheme } from '@/lib/ThemeContext' import { useAlerts } from '@/lib/AlertsContext' import { useMessages, formatMessageTime, getContactInitials } from '@/lib/MessagesContext' import { useActivity, formatDurationCompact } from '@/lib/ActivityContext' interface StatsItem { labelKey: string value: string icon: string color: string } interface RecentKlausur { id: number title: string students: number completed: number statusKey: string } interface DashboardContentProps { documents: { id: string }[] setShowUploadModal: (show: boolean) => void setSelectedTab: (tab: string) => void } export function DashboardContent({ documents, setShowUploadModal, setSelectedTab }: DashboardContentProps) { const router = useRouter() const { t } = useLanguage() const { isDark } = useTheme() const { alerts, unreadCount: alertsUnreadCount, markAsRead } = useAlerts() const { conversations, unreadCount: messagesUnreadCount, contacts, markAsRead: markMessageAsRead } = useMessages() const { stats: activityStats } = useActivity() const timeSaved = formatDurationCompact(activityStats.weekSavedSeconds) const timeSavedDisplay = activityStats.weekSavedSeconds > 0 ? `${timeSaved.value}${timeSaved.unit}` : '0min' const stats: StatsItem[] = [ { labelKey: 'stat_open_corrections', value: '12', icon: 'πŸ“‹', color: 'from-blue-400 to-blue-600' }, { labelKey: 'stat_completed_week', value: String(activityStats.activityCount), icon: 'βœ…', color: 'from-green-400 to-green-600' }, { labelKey: 'stat_average', value: '2.3', icon: 'πŸ“ˆ', color: 'from-purple-400 to-purple-600' }, { labelKey: 'stat_time_saved', value: timeSavedDisplay, icon: '⏱', color: 'from-orange-400 to-orange-600' }, ] const recentKlausuren: RecentKlausur[] = [ { id: 1, title: 'Deutsch LK - Textanalyse', students: 24, completed: 18, statusKey: 'status_in_progress' }, { id: 2, title: 'Deutsch GK - ErΓΆrterung', students: 28, completed: 28, statusKey: 'status_completed' }, { id: 3, title: 'Vorabitur - Gedichtanalyse', students: 22, completed: 10, statusKey: 'status_in_progress' }, ] return ( <> {/* Stats Kacheln */}
{stats.map((stat, index) => (
{stat.icon}

{t(stat.labelKey)}

{stat.value}

))}
{/* Dashboard Grid */}
{/* Aktuelle Klausuren Kachel */}

{t('recent_klausuren')}

{recentKlausuren.map((klausur) => (
πŸ“

{klausur.title}

{klausur.students} {t('students')}

{t(klausur.statusKey)}
{klausur.completed}/{klausur.students}
))}
{/* Schnellaktionen Kachel */}

{t('quick_actions')}

{/* AI Insight mini */}
πŸ€– {t('ai_tip')}

{t('ai_tip_text')}

{/* Alerts Kachel */}

πŸ”” Aktuelle Alerts

{alertsUnreadCount > 0 && ( {alertsUnreadCount} neu )}
{alerts.slice(0, 3).map(alert => ( ))} {alerts.length === 0 && (

Keine Alerts vorhanden

)}
{/* Nachrichten Kachel */}

πŸ’¬ {t('nav_messages')}

{messagesUnreadCount > 0 && ( {messagesUnreadCount} neu )}
{conversations.slice(0, 3).map(conv => { const contact = contacts.find(c => conv.participant_ids.includes(c.id)) return ( ) })} {conversations.length === 0 && (

Keine Nachrichten vorhanden

)}
) }