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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user