diff --git a/dashboard-v2/src/App.tsx b/dashboard-v2/src/App.tsx
index 2114db18e..826d38fa4 100644
--- a/dashboard-v2/src/App.tsx
+++ b/dashboard-v2/src/App.tsx
@@ -1,6 +1,14 @@
+import { useCallback, useState } from "react";
+
+import LoginPage from "./pages/LoginPage.tsx";
import StatusPage from "./pages/StatusPage.tsx";
-// One page so far, so no shell or router yet: they land with the second page.
export default function App() {
- return ;
+ const [needsAuth, setNeedsAuth] = useState(false);
+ const showLogin = useCallback(() => setNeedsAuth(true), []);
+ const showStatus = useCallback(() => setNeedsAuth(false), []);
+
+ // The status page remounts after sign-in, so it loads with the session.
+ if (needsAuth) return ;
+ return ;
}
diff --git a/dashboard-v2/src/lib/api.ts b/dashboard-v2/src/lib/api.ts
index 7dd4ac154..8fb68fc6c 100644
--- a/dashboard-v2/src/lib/api.ts
+++ b/dashboard-v2/src/lib/api.ts
@@ -92,4 +92,9 @@ export interface ComponentVersion {
export const api = {
services: () => request("/api/services"),
version: () => request<{ components: ComponentVersion[] }>("/api/version"),
+ signIn: (email: string, password: string) =>
+ request("/api/auth/login", {
+ method: "POST",
+ body: { email, password },
+ }),
};
diff --git a/dashboard-v2/src/pages/LoginPage.tsx b/dashboard-v2/src/pages/LoginPage.tsx
new file mode 100644
index 000000000..2f04cf42c
--- /dev/null
+++ b/dashboard-v2/src/pages/LoginPage.tsx
@@ -0,0 +1,110 @@
+import { useState, type CSSProperties } from "react";
+
+import { Banner } from "@astryxdesign/core/Banner";
+import { Button } from "@astryxdesign/core/Button";
+import { Card } from "@astryxdesign/core/Card";
+import { Center } from "@astryxdesign/core/Center";
+import { Icon } from "@astryxdesign/core/Icon";
+import { VStack } from "@astryxdesign/core/Layout";
+import { Heading, Text } from "@astryxdesign/core/Text";
+import { TextInput } from "@astryxdesign/core/TextInput";
+import { CubeIcon } from "@heroicons/react/24/outline";
+
+import { api } from "../lib/api.ts";
+
+// Standalone auth page paints its own body background (no host shell).
+const pageStyle: CSSProperties = {
+ minHeight: "100%",
+ backgroundColor: "var(--color-background-body)",
+};
+// Cap the column at 400px but let it shrink to fit narrow screens (Stack
+// has no maxWidth prop, so it's set here).
+const contentStyle: CSSProperties = {
+ width: "100%",
+ maxWidth: 400,
+};
+
+export default function LoginPage({
+ onSignedIn,
+}: {
+ onSignedIn: () => void;
+}) {
+ const [email, setEmail] = useState("");
+ const [password, setPassword] = useState("");
+ const [isLoading, setIsLoading] = useState(false);
+ const [error, setError] = useState("");
+
+ const handleSignIn = async () => {
+ setError("");
+ if (!email || !password) {
+ setError("Enter both email and password.");
+ return;
+ }
+ setIsLoading(true);
+ try {
+ await api.signIn(email, password);
+ onSignedIn();
+ } catch (err) {
+ setError(err instanceof Error ? err.message : "Sign-in failed");
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ return (
+
+
+ {/* Logo */}
+
+
+
+ Archie
+
+
+
+ {/* Card */}
+
+
+
+ Sign in
+
+
+ {error && }
+
+ void handleSignIn()}
+ placeholder="you@example.com"
+ type="email"
+ size="lg"
+ autoComplete="email"
+ isDisabled={isLoading}
+ />
+
+ void handleSignIn()}
+ placeholder="Enter your password"
+ type="password"
+ size="lg"
+ autoComplete="current-password"
+ isDisabled={isLoading}
+ />
+
+
+
+
+
+ );
+}
diff --git a/dashboard-v2/src/pages/StatusPage.tsx b/dashboard-v2/src/pages/StatusPage.tsx
index 9a519472c..5e4c3b473 100644
--- a/dashboard-v2/src/pages/StatusPage.tsx
+++ b/dashboard-v2/src/pages/StatusPage.tsx
@@ -22,6 +22,7 @@ import { Heading, Text } from "@astryxdesign/core/Text";
import { ArrowPathIcon } from "@heroicons/react/24/outline";
import {
+ ApiError,
api,
type ComponentVersion,
type Service,
@@ -145,7 +146,11 @@ const versionColumns: TableColumn[] = [
},
];
-export default function StatusPage() {
+export default function StatusPage({
+ onAuthRequired,
+}: {
+ onAuthRequired: () => void;
+}) {
const [services, setServices] = useState([]);
const [components, setComponents] = useState([]);
const [loading, setLoading] = useState(true);
@@ -162,11 +167,15 @@ export default function StatusPage() {
setServices(fetchedServices);
setComponents(report.components);
} catch (err) {
+ if (err instanceof ApiError && err.status === 401) {
+ onAuthRequired();
+ return;
+ }
setError(err instanceof Error ? err.message : "Could not load status");
} finally {
setLoading(false);
}
- }, []);
+ }, [onAuthRequired]);
useEffect(() => {
void load();