Files
homelab-monitor/apps/web/src/App.tsx
T
jhodgkin a075488f4b
CI / web (push) Failing after 1m11s
CI / api (push) Successful in 1m19s
Scaffold homelab-monitor: Fastify API + React dashboard + CI
Vertical slice for Phase 1 (v1-dashboard milestone): Proxmox collector,
SQLite storage, local auth, and a dashboard UI showing host/container
status cards. Config-driven collector registry so future data sources
(SSH-based hosts, Zabbix, network discovery) plug in without rewiring.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-12 20:18:44 -06:00

25 lines
690 B
TypeScript

import { useEffect, useState } from "react";
import { me } from "./api";
import { Login } from "./pages/Login";
import { Dashboard } from "./pages/Dashboard";
export default function App() {
const [username, setUsername] = useState<string | null>(null);
const [checked, setChecked] = useState(false);
useEffect(() => {
me()
.then((r) => setUsername(r.username))
.catch(() => setUsername(null))
.finally(() => setChecked(true));
}, []);
if (!checked) return null;
if (!username) {
return <Login onLoggedIn={() => me().then((r) => setUsername(r.username))} />;
}
return <Dashboard username={username} onLoggedOut={() => setUsername(null)} />;
}