'use client'
import type { AlertItem, Topic } from '../types'
import { formatTimeAgo, getScoreBadgeClass } from '../useAlertsData'
interface DashboardTabProps {
topics: Topic[]
alerts: AlertItem[]
error: string | null
}
export function DashboardTab({ topics, alerts, error }: DashboardTabProps) {
return (
{/* Quick Actions */}
Aktive Topics
{topics.slice(0, 5).map((topic) => (
{topic.name}
{topic.alert_count} Alerts
{topic.is_active ? 'Aktiv' : 'Pausiert'}
))}
{topics.length === 0 && (
Keine Topics konfiguriert
)}
Letzte Alerts
{alerts.slice(0, 5).map((alert) => {
const badge = getScoreBadgeClass(alert.relevance_score)
return (
{alert.title}
{alert.topic_name}
{badge && {badge.pct}%}
)
})}
{alerts.length === 0 && (
Keine Alerts vorhanden
)}
{error && (
Hinweis: API nicht erreichbar. Demo-Daten werden angezeigt.
)}
)
}