'use client' import type { MailStats, SyncStatus } from '../types' import { API_BASE } from '../types' interface OverviewTabProps { stats: MailStats | null syncStatus: SyncStatus | null loading: boolean onRefresh: () => void } export function OverviewTab({ stats, syncStatus, loading, onRefresh }: OverviewTabProps) { const triggerSync = async () => { try { await fetch(`${API_BASE}/api/v1/mail/sync/all`, { method: 'POST', }) onRefresh() } catch (err) { console.error('Failed to trigger sync:', err) } } return (
{/* Header */}

System-Uebersicht

Status aller E-Mail-Konten und Aufgaben

{/* Loading State */} {loading && (
)} {/* Stats Grid */} {!loading && stats && ( <>
0 ? 'red' : 'green'} />
{/* Sync Status */}

Synchronisierung

{syncStatus?.running ? ( <>
Synchronisiere {syncStatus.accountsInProgress.length} Konto(en)... ) : ( <>
Bereit )} {stats.lastSyncTime && ( Letzte Sync: {new Date(stats.lastSyncTime).toLocaleString('de-DE')} )}
{syncStatus?.errors && syncStatus.errors.length > 0 && (

Fehler

    {syncStatus.errors.slice(0, 3).map((error, i) => (
  • {error}
  • ))}
)}
{/* AI Stats */}

KI-Analyse

Analysiert

{stats.aiAnalyzedCount}

Analyse-Rate

{stats.totalEmails > 0 ? `${Math.round((stats.aiAnalyzedCount / stats.totalEmails) * 100)}%` : '0%'}

)}
) } function StatCard({ title, value, subtitle, color = 'blue' }: { title: string value: number subtitle?: string color?: 'blue' | 'green' | 'yellow' | 'red' }) { const colorClasses = { blue: 'text-blue-600', green: 'text-green-600', yellow: 'text-yellow-600', red: 'text-red-600', } return (

{title}

{value.toLocaleString()}

{subtitle &&

{subtitle}

}
) }