import { useState } from 'react' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { LayoutDashboard, Ticket, Bell, Package, Network, Menu, X, Settings } from 'lucide-react' import { DashboardPage } from './pages/DashboardPage' import { AgentDetailPage } from './pages/AgentDetailPage' import TicketsPage from './pages/TicketsPage' import AlertsPage from './pages/AlertsPage' import SoftwarePage from './pages/SoftwarePage' import NetworkPage from './pages/NetworkPage' import { cn } from './lib/utils' const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: 30_000, retry: 2, }, }, }) type Page = 'dashboard' | 'agent-detail' | 'tickets' | 'alerts' | 'network' | 'software' interface NavItem { id: Page label: string icon: React.ReactNode } const navItems: NavItem[] = [ { id: 'dashboard', label: 'Dashboard', icon: }, { id: 'tickets', label: 'Tickets', icon: }, { id: 'alerts', label: 'Alerts', icon: }, { id: 'network', label: 'Netzwerk', icon: }, { id: 'software', label: 'Software', icon: }, ] function AppContent() { const [page, setPage] = useState('dashboard') const [selectedAgentId, setSelectedAgentId] = useState(null) const [sidebarOpen, setSidebarOpen] = useState(true) const [settingsOpen, setSettingsOpen] = useState(false) const [apiKeyInput, setApiKeyInput] = useState('') const storedKey = localStorage.getItem('nexusrmm_api_key') ?? '' const maskedKey = storedKey.length > 0 ? storedKey.substring(0, Math.min(8, storedKey.length)) + '...' : '(nicht gesetzt)' function handleSaveApiKey() { localStorage.setItem('nexusrmm_api_key', apiKeyInput) setSettingsOpen(false) setApiKeyInput('') } function handleSelectAgent(agentId: string) { setSelectedAgentId(agentId) setPage('agent-detail') } function handleBack() { setPage('dashboard') setSelectedAgentId(null) } return (
{/* Sidebar */} {/* Settings Modal */} {settingsOpen && (

Einstellungen

Aktuell: {maskedKey}

setApiKeyInput(e.target.value)} placeholder="API-Key eingeben..." className="w-full px-3 py-2 rounded-md border border-border bg-background text-foreground text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary" />

Leer lassen um Authentifizierung zu deaktivieren.

)} {/* Main content */}
{page === 'dashboard' && ( )} {page === 'agent-detail' && selectedAgentId && ( )} {page === 'tickets' && } {page === 'alerts' && } {page === 'network' && } {page === 'software' && }
) } function App() { return ( ) } export default App