diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 193adc3..3537393 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -5,26 +5,42 @@ import TemperatureHistory from "@/components/temperature-history"
import TemperaturePlot from "@/components/temperature-plot"
import RegisterForm from './components/register-form'
import { AuthProvider } from './contexts/auth-context'
+import { useAuth } from './hooks/use-auth'
+import UserMenu from './components/user-menu'
+import LoginForm from './components/login-form'
+function AppContent() {
+ const { isAuthenticated, isLoading } = useAuth()
+ if (isLoading) return
Loading...
+
+ return (
+
+ {isAuthenticated ? :
+
+
+
+
+ }
+
+
+
+
+ {isAuthenticated && }
+
+
+
+ )
+
+}
function App() {
+
return (
-
-
-
-
-
-
+
)
diff --git a/frontend/src/components/login-form.tsx b/frontend/src/components/login-form.tsx
new file mode 100644
index 0000000..0a0d2cd
--- /dev/null
+++ b/frontend/src/components/login-form.tsx
@@ -0,0 +1,52 @@
+import { useState } from "react"
+import { useAuth } from "@/hooks/use-auth"
+import { Button } from "./ui/button"
+
+export default function LoginForm() {
+ const { login, isLoading } = useAuth()
+ const [email, setEmail] = useState("")
+ const [password, setPassword] = useState("")
+ const [formError, setFormError] = useState("")
+
+ async function handleSubmit(e: React.SubmitEvent) {
+ e.preventDefault()
+ setFormError(null)
+ try {
+ await login(email, password)
+ }
+ catch (err) {
+ setFormError(err instanceof Error ? err.message : "Login failed")
+ }
+ }
+
+ return (
+
+ )
+
+}
+
+
diff --git a/frontend/src/components/register-form.tsx b/frontend/src/components/register-form.tsx
index 657c7b5..fb55c2b 100644
--- a/frontend/src/components/register-form.tsx
+++ b/frontend/src/components/register-form.tsx
@@ -9,7 +9,7 @@ export default function RegisterForm() {
const [success, setSuccess] = useState(false)
const [loading, setLoading] = useState(false)
- async function handleSubmit(e: React.FormEvent) {
+ async function handleSubmit(e: React.SubmitEvent) {
e.preventDefault()
setError(null)
setSuccess(false)
@@ -52,7 +52,7 @@ export default function RegisterForm() {
}
return (
-