Refactor: Frontend-Fundament — Format-Utils, Dialog-Ref, Typen (Phase 3a)

- Neuer lib/format.ts: gb/fmtBytes/fmtSize/fmtEta/fmtCtx zentral; aus
  DashboardView/SystemView/ModelsView entdoppelt und importiert.
- CustomDialog: document.getElementById -> useRef (kein DOM-Query, robuster).
- api.ts: GitInfo/ComponentVersion/Versions typisiert, SystemStatus.versions
  ergänzt; App.tsx nutzt SystemStatus statt any.

tsc grün, Build grün, Dashboard verifiziert (keine Konsolenfehler, Formatierer
rendern identisch).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-26 14:36:28 +02:00
parent 341ea870bb
commit 74f64731ab
9 changed files with 146 additions and 113 deletions
+3 -3
View File
@@ -11,14 +11,14 @@ import { AgentView } from "@/views/AgentView"
import { GuideView } from "@/views/GuideView"
import { Placeholder } from "@/views/Placeholder"
import { SystemDrawer } from "@/components/SystemDrawer"
import { api, type Health } from "@/lib/api"
import { api, type Health, type SystemStatus } from "@/lib/api"
import { cn } from "@/lib/utils"
export default function App() {
const [view, setView] = useState<ViewId>("dashboard")
const [health, setHealth] = useState<Health | null>(null)
const [sidebarCollapsed, setSidebarCollapsed] = useState(() => localStorage.getItem("mc_sidebar_collapsed") === "true")
const [sysStatus, setSysStatus] = useState<any | null>(null)
const [sysStatus, setSysStatus] = useState<SystemStatus | null>(null)
const [drawerOpen, setDrawerOpen] = useState(false)
const [drawerTab, setDrawerTab] = useState<"maintenance" | "logs">("maintenance")
@@ -30,7 +30,7 @@ export default function App() {
}, [])
useEffect(() => {
const loadSys = () => api<any>("/api/system/status").then(setSysStatus).catch(() => {})
const loadSys = () => api<SystemStatus>("/api/system/status").then(setSysStatus).catch(() => {})
loadSys()
const t = setInterval(loadSys, 20000)
return () => clearInterval(t)