'use client'
import { useState } from 'react'
import type { IngestionHistoryEntry } from '../types'
interface IngestionHistoryProps {
history: IngestionHistoryEntry[]
}
export function IngestionHistory({ history }: IngestionHistoryProps) {
const [showHistory, setShowHistory] = useState(false)
return (
Indexierungs-Historie
{history.length === 0 ? (
Noch keine Indexierungslaeufe durchgefuehrt.
) : (
{(showHistory ? history : history.slice(0, 3)).map((entry) => (
{entry.status === 'success' ? (
) : (
)}
{new Date(entry.started_at || entry.startedAt).toLocaleString('de-DE')}
{entry.collection}
{entry.stats && (
Gefunden:{' '}
{entry.stats.documents_found}
Indexiert:{' '}
{entry.stats.documents_indexed}
Uebersprungen:{' '}
{entry.stats.documents_skipped}
Chunks:{' '}
{entry.stats.chunks_created}
)}
{entry.filters && (
{entry.filters.year && (
Jahr: {entry.filters.year}
)}
{entry.filters.subject && (
Fach: {entry.filters.subject}
)}
{entry.filters.incremental && (
Inkrementell
)}
)}
{entry.error && (
{entry.error}
)}
))}
)}
)
}