"use client"; import { useState, useEffect } from "react"; import { useRouter } from "next/navigation"; export default function ProfilePage() { const router = useRouter(); const [name, setName] = useState("Loading..."); const [email, setEmail] = useState("Loading..."); const [loading, setLoading] = useState(true); useEffect(() => { // Fetch user profile from API fetch("/api/auth/profile") .then((r) => r.json()) .then((data) => { if (data.user) { setName(data.user.name || "Parent"); setEmail(data.user.email || "parent@example.com"); } setLoading(false); }) .catch(() => { setName("Parent"); setEmail("parent@example.com"); setLoading(false); }); }, []); const saveProfile = async () => { // TODO: Call API to save profile alert("Profile saved!"); }; return (

Profile

{/* Avatar */}
👤
{/* Form */} {loading ? (
Loading...
) : (
setName(e.target.value)} className="w-full p-3 bg-white dark:bg-gray-800 rounded-xl border" />
setEmail(e.target.value)} className="w-full p-3 bg-white dark:bg-gray-800 rounded-xl border" disabled />
Email cannot be changed
)} {/* Account Info */}
Account
Member since: January 2024
); }