Phase 1 — Python (klausur-service): 5 monoliths → 36 files - dsfa_corpus_ingestion.py (1,828 LOC → 5 files) - cv_ocr_engines.py (2,102 LOC → 7 files) - cv_layout.py (3,653 LOC → 10 files) - vocab_worksheet_api.py (2,783 LOC → 8 files) - grid_build_core.py (1,958 LOC → 6 files) Phase 2 — Go (edu-search-service, school-service): 8 monoliths → 19 files - staff_crawler.go (1,402 → 4), policy/store.go (1,168 → 3) - policy_handlers.go (700 → 2), repository.go (684 → 2) - search.go (592 → 2), ai_extraction_handlers.go (554 → 2) - seed_data.go (591 → 2), grade_service.go (646 → 2) Phase 3 — TypeScript (admin-lehrer): 45 monoliths → 220+ files - sdk/types.ts (2,108 → 16 domain files) - ai/rag/page.tsx (2,686 → 14 files) - 22 page.tsx files split into _components/ + _hooks/ - 11 component files split into sub-components - 10 SDK data catalogs added to loc-exceptions - Deleted dead backup index_original.ts (4,899 LOC) All original public APIs preserved via re-export facades. Zero new errors: Python imports verified, Go builds clean, TypeScript tsc --noEmit shows only pre-existing errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
129 lines
4.0 KiB
TypeScript
129 lines
4.0 KiB
TypeScript
'use client'
|
|
|
|
import { useState, useEffect } from 'react'
|
|
import { useParams } from 'next/navigation'
|
|
import Link from 'next/link'
|
|
import { AlertTriangle, FileText, Activity, History } from 'lucide-react'
|
|
import { mockAgentDetails, mockChangeLogs } from './_components/mock-data'
|
|
import {
|
|
AgentHeader,
|
|
AgentStatsBar,
|
|
SoulTabContent,
|
|
StatsTabContent,
|
|
HistoryTabContent,
|
|
} from './_components'
|
|
import type { AgentDetail } from './_components'
|
|
|
|
type TabId = 'soul' | 'stats' | 'history'
|
|
|
|
const TABS: { id: TabId; label: string; icon: typeof FileText }[] = [
|
|
{ id: 'soul', label: 'SOUL-File', icon: FileText },
|
|
{ id: 'stats', label: 'Live-Statistiken', icon: Activity },
|
|
{ id: 'history', label: 'Aenderungshistorie', icon: History },
|
|
]
|
|
|
|
export default function AgentDetailPage() {
|
|
const params = useParams()
|
|
const agentId = params.agentId as string
|
|
|
|
const [agent, setAgent] = useState<AgentDetail | null>(null)
|
|
const [editedContent, setEditedContent] = useState('')
|
|
const [isEditing, setIsEditing] = useState(false)
|
|
const [hasChanges, setHasChanges] = useState(false)
|
|
const [saving, setSaving] = useState(false)
|
|
const [activeTab, setActiveTab] = useState<TabId>('soul')
|
|
|
|
useEffect(() => {
|
|
const agentData = mockAgentDetails[agentId]
|
|
if (agentData) {
|
|
setAgent(agentData)
|
|
setEditedContent(agentData.soulContent)
|
|
}
|
|
}, [agentId])
|
|
|
|
const handleSave = async () => {
|
|
setSaving(true)
|
|
await new Promise(resolve => setTimeout(resolve, 1000))
|
|
if (agent) {
|
|
setAgent({ ...agent, soulContent: editedContent, updatedAt: new Date().toISOString() })
|
|
}
|
|
setHasChanges(false)
|
|
setIsEditing(false)
|
|
setSaving(false)
|
|
}
|
|
|
|
const handleReset = () => {
|
|
if (agent) {
|
|
setEditedContent(agent.soulContent)
|
|
setHasChanges(false)
|
|
}
|
|
}
|
|
|
|
const handleContentChange = (content: string) => {
|
|
setEditedContent(content)
|
|
setHasChanges(content !== agent?.soulContent)
|
|
}
|
|
|
|
if (!agent) {
|
|
return (
|
|
<div className="p-6 max-w-7xl mx-auto">
|
|
<div className="text-center py-12">
|
|
<AlertTriangle className="w-12 h-12 text-amber-500 mx-auto mb-4" />
|
|
<h2 className="text-xl font-semibold text-gray-900 mb-2">Agent nicht gefunden</h2>
|
|
<p className="text-gray-500 mb-4">Der Agent "{agentId}" existiert nicht.</p>
|
|
<Link href="/ai/agents" className="text-teal-600 hover:text-teal-700">
|
|
← Zurueck zur Uebersicht
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div className="p-6 max-w-7xl mx-auto">
|
|
<AgentHeader agent={agent} />
|
|
<AgentStatsBar agent={agent} />
|
|
|
|
{/* Tabs */}
|
|
<div className="bg-white border border-gray-200 rounded-xl overflow-hidden">
|
|
<div className="border-b border-gray-200">
|
|
<div className="flex">
|
|
{TABS.map(({ id, label, icon: Icon }) => (
|
|
<button
|
|
key={id}
|
|
onClick={() => setActiveTab(id)}
|
|
className={`flex items-center gap-2 px-6 py-4 text-sm font-medium border-b-2 transition-colors ${
|
|
activeTab === id
|
|
? 'border-teal-500 text-teal-600'
|
|
: 'border-transparent text-gray-500 hover:text-gray-700'
|
|
}`}
|
|
>
|
|
<Icon className="w-4 h-4" />
|
|
{label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
</div>
|
|
|
|
<div className="p-6">
|
|
{activeTab === 'soul' && (
|
|
<SoulTabContent
|
|
agent={agent}
|
|
editedContent={editedContent}
|
|
isEditing={isEditing}
|
|
hasChanges={hasChanges}
|
|
saving={saving}
|
|
onContentChange={handleContentChange}
|
|
onSave={handleSave}
|
|
onReset={handleReset}
|
|
onStartEditing={() => setIsEditing(true)}
|
|
/>
|
|
)}
|
|
{activeTab === 'stats' && <StatsTabContent />}
|
|
{activeTab === 'history' && <HistoryTabContent changeLogs={mockChangeLogs} />}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|