'use client' /** * AI Tools Sidebar * * Kompakte Sidebar-Komponente für Cross-Navigation zwischen KI-Werkzeugen. * Zeigt Shared Resources und ermöglicht schnelle Navigation. * * Features: * - Desktop: Fixierte Sidebar rechts * - Mobile: Floating Action Button mit Slide-In Drawer */ import Link from 'next/link' import { useState, useEffect } from 'react' export type AIToolId = 'test-quality' | 'gpu' | 'ocr-compare' | 'ocr-labeling' | 'rag-pipeline' | 'magic-help' export interface AIToolModule { id: AIToolId name: string href: string description: string icon: string } export const AI_TOOLS_MODULES: AIToolModule[] = [ { id: 'test-quality', name: 'Test Quality (BQAS)', href: '/ai/test-quality', description: 'Golden Suite & Tests', icon: '🧪', }, { id: 'gpu', name: 'GPU Infrastruktur', href: '/ai/gpu', description: 'vast.ai Management', icon: '🖥️', }, { id: 'ocr-compare', name: 'OCR Vergleich', href: '/ai/ocr-compare', description: 'OCR-Methoden & Vokabel-Extraktion', icon: '🔍', }, { id: 'ocr-labeling', name: 'OCR Labeling', href: '/ai/ocr-labeling', description: 'Trainingsdaten erstellen', icon: '🏷️', }, { id: 'rag-pipeline', name: 'RAG Pipeline', href: '/ai/rag-pipeline', description: 'Retrieval Augmented Generation', icon: '🔗', }, { id: 'magic-help', name: 'Magic Help', href: '/ai/magic-help', description: 'KI-Assistent', icon: '✨', }, ] export interface AIToolsSidebarProps { /** ID des aktuell aktiven Tools */ currentTool: AIToolId /** Optional: Kompakter Modus (nur Icons) */ compact?: boolean /** Optional: Zusätzliche CSS-Klassen */ className?: string } export interface AIToolsSidebarResponsiveProps extends AIToolsSidebarProps { /** Position des FAB auf Mobile */ fabPosition?: 'bottom-right' | 'bottom-left' } // Icons für die Tools const ToolIcon = ({ id }: { id: string }) => { switch (id) { case 'test-quality': return ( ) case 'gpu': return ( ) case 'ocr-compare': return ( ) case 'ocr-labeling': return ( ) case 'rag-pipeline': return ( ) case 'magic-help': return ( ) default: return null } } // Werkzeug-Icon für Header const WrenchIcon = () => ( ) export function AIToolsSidebar({ currentTool, compact = false, className = '', }: AIToolsSidebarProps) { const [isExpanded, setIsExpanded] = useState(!compact) return (
{/* Header */}
setIsExpanded(!isExpanded)} >
KI-Werkzeuge
{/* Content */} {isExpanded && (
{/* Tool Links */}
{AI_TOOLS_MODULES.map((tool) => (
{tool.name}
{tool.description}
{currentTool === tool.id && ( )} ))}
{/* Shared Resources Visualisierung */}
Shared Resources
🖥️ 🧪
GPU-Ressourcen fuer Modelle & Tests
{/* Quick Info zum aktuellen Tool */}
{currentTool === 'test-quality' && ( Ueberwachen Sie die Qualitaet der KI-Ausgaben )} {currentTool === 'gpu' && ( Verwalten Sie GPU-Instanzen fuer ML-Training )}
)}
) } /** * Responsive Tools Sidebar mit Mobile FAB + Drawer * * Desktop (xl+): Fixierte Sidebar rechts * Mobile/Tablet: Floating Action Button unten rechts, öffnet Drawer */ export function AIToolsSidebarResponsive({ currentTool, compact = false, className = '', fabPosition = 'bottom-right', }: AIToolsSidebarResponsiveProps) { const [isMobileOpen, setIsMobileOpen] = useState(false) // Close drawer on escape key useEffect(() => { const handleEscape = (e: KeyboardEvent) => { if (e.key === 'Escape') setIsMobileOpen(false) } window.addEventListener('keydown', handleEscape) return () => window.removeEventListener('keydown', handleEscape) }, []) // Prevent body scroll when drawer is open useEffect(() => { if (isMobileOpen) { document.body.style.overflow = 'hidden' } else { document.body.style.overflow = '' } return () => { document.body.style.overflow = '' } }, [isMobileOpen]) const fabPositionClasses = fabPosition === 'bottom-right' ? 'right-4 bottom-20' : 'left-4 bottom-20' return ( <> {/* Desktop: Fixed Sidebar */}
{/* Mobile/Tablet: FAB */} {/* Mobile/Tablet: Drawer Overlay */} {isMobileOpen && (
{/* Backdrop */}
setIsMobileOpen(false)} /> {/* Drawer */}
{/* Drawer Header */}
KI-Werkzeuge
{/* Drawer Content */}
{/* Tool Links */}
{AI_TOOLS_MODULES.map((tool) => ( setIsMobileOpen(false)} className={`flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${ currentTool === tool.id ? 'bg-violet-100 dark:bg-violet-900/30 text-violet-700 dark:text-violet-300 font-medium shadow-sm' : 'text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-gray-800' }`} >
{tool.name}
{tool.description}
{currentTool === tool.id && ( )} ))}
{/* Shared Resources Visualisierung */}
Shared Resources
🖥️ GPU
🧪 BQAS
GPU-Ressourcen fuer Modelle & Tests
{/* Quick Info */}
{currentTool === 'test-quality' && ( <> Aktuell: Qualitaet der KI-Ausgaben ueberwachen )} {currentTool === 'gpu' && ( <> Aktuell: GPU-Instanzen fuer ML-Training verwalten )}
{/* Link zur Pipeline */}
setIsMobileOpen(false)} className="flex items-center gap-2 px-3 py-2 text-sm text-teal-600 dark:text-teal-400 hover:bg-teal-50 dark:hover:bg-teal-900/20 rounded-lg transition-colors" > Zur KI-Daten-Pipeline
)} {/* CSS for slide-in animation */} ) } export default AIToolsSidebar