backend-lehrer (5 files): - alerts_agent/db/repository.py (992 → 5), abitur_docs_api.py (956 → 3) - teacher_dashboard_api.py (951 → 3), services/pdf_service.py (916 → 3) - mail/mail_db.py (987 → 6) klausur-service (5 files): - legal_templates_ingestion.py (942 → 3), ocr_pipeline_postprocess.py (929 → 4) - ocr_pipeline_words.py (876 → 3), ocr_pipeline_ocr_merge.py (616 → 2) - KorrekturPage.tsx (956 → 6) website (5 pages): - mail (985 → 9), edu-search (958 → 8), mac-mini (950 → 7) - ocr-labeling (946 → 7), audit-workspace (871 → 4) studio-v2 (5 files + 1 deleted): - page.tsx (946 → 5), MessagesContext.tsx (925 → 4) - korrektur (914 → 6), worksheet-cleanup (899 → 6) - useVocabWorksheet.ts (888 → 3) - Deleted dead page-original.tsx (934 LOC) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
89 lines
3.7 KiB
TypeScript
89 lines
3.7 KiB
TypeScript
'use client'
|
|
|
|
import type { CrawlStats, Category } from '../types'
|
|
|
|
export default function StatsTab({
|
|
stats,
|
|
categories,
|
|
}: {
|
|
stats: CrawlStats
|
|
categories: Category[]
|
|
}) {
|
|
return (
|
|
<div className="space-y-6">
|
|
{/* Overview Stats */}
|
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
|
<div className="bg-gradient-to-br from-blue-500 to-blue-600 rounded-xl p-5 text-white">
|
|
<div className="text-3xl font-bold">{stats.totalDocuments.toLocaleString()}</div>
|
|
<div className="text-blue-100">Dokumente indexiert</div>
|
|
</div>
|
|
<div className="bg-gradient-to-br from-green-500 to-green-600 rounded-xl p-5 text-white">
|
|
<div className="text-3xl font-bold">{stats.totalSeeds}</div>
|
|
<div className="text-green-100">Seed-URLs aktiv</div>
|
|
</div>
|
|
<div className="bg-gradient-to-br from-purple-500 to-purple-600 rounded-xl p-5 text-white">
|
|
<div className="text-3xl font-bold">{(stats.avgTrustScore * 100).toFixed(0)}%</div>
|
|
<div className="text-purple-100">Ø Trust-Score</div>
|
|
</div>
|
|
<div className="bg-gradient-to-br from-orange-500 to-orange-600 rounded-xl p-5 text-white">
|
|
<div className="text-3xl font-bold">{Object.keys(stats.documentsPerDocType).length}</div>
|
|
<div className="text-orange-100">Dokumenttypen</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Charts */}
|
|
<div className="grid md:grid-cols-2 gap-6">
|
|
<div className="bg-white border border-slate-200 rounded-lg p-6">
|
|
<h4 className="font-semibold text-slate-900 mb-4">Dokumente nach Kategorie</h4>
|
|
<div className="space-y-3">
|
|
{Object.entries(stats.documentsPerCategory).map(([cat, count]) => {
|
|
const category = categories.find(c => c.name === cat)
|
|
const percentage = stats.totalDocuments > 0 ? (count / stats.totalDocuments) * 100 : 0
|
|
return (
|
|
<div key={cat}>
|
|
<div className="flex justify-between text-sm mb-1">
|
|
<span>{category?.icon || '📁'} {category?.display_name || cat}</span>
|
|
<span className="text-slate-500">{count.toLocaleString()} ({percentage.toFixed(1)}%)</span>
|
|
</div>
|
|
<div className="h-2 bg-slate-100 rounded-full overflow-hidden">
|
|
<div
|
|
className="h-full bg-primary-500 rounded-full"
|
|
style={{ width: `${percentage}%` }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
})}
|
|
</div>
|
|
</div>
|
|
|
|
<div className="bg-white border border-slate-200 rounded-lg p-6">
|
|
<h4 className="font-semibold text-slate-900 mb-4">Dokumente nach Typ</h4>
|
|
<div className="space-y-3">
|
|
{Object.entries(stats.documentsPerDocType)
|
|
.sort(([,a], [,b]) => b - a)
|
|
.slice(0, 6)
|
|
.map(([docType, count]) => {
|
|
const percentage = (count / stats.totalDocuments) * 100
|
|
return (
|
|
<div key={docType}>
|
|
<div className="flex justify-between text-sm mb-1">
|
|
<span>{docType.replace(/_/g, ' ')}</span>
|
|
<span className="text-slate-500">{count.toLocaleString()} ({percentage.toFixed(1)}%)</span>
|
|
</div>
|
|
<div className="h-2 bg-slate-100 rounded-full overflow-hidden">
|
|
<div
|
|
className="h-full bg-green-500 rounded-full"
|
|
style={{ width: `${percentage}%` }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
})}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|