"use client"; import { useState, useEffect } from "react"; import { useRouter } from "next/navigation"; import { Mail, Calendar, User, Shield, ArrowLeft, Lock, Smartphone } from "lucide-react"; import { toast } from "sonner"; import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Separator } from "@/components/ui/separator"; import { useSession } from "@/lib/auth-client"; export default function ProfilePage() { const { data: session, isPending } = useSession(); const router = useRouter(); const [editProfileOpen, setEditProfileOpen] = useState(false); const [securityOpen, setSecurityOpen] = useState(false); const [emailPrefsOpen, setEmailPrefsOpen] = useState(false); useEffect(() => { if (!isPending && !session) { router.push("/"); } }, [isPending, session, router]); if (isPending || !session) { return (
Loading...
); } const user = session.user; const createdDate = user.createdAt ? new Date(user.createdAt).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", }) : null; const handleEditProfileSubmit = (e: React.FormEvent) => { e.preventDefault(); // In a real app, this would call an API to update the user profile toast.info("Profile updates require backend implementation"); setEditProfileOpen(false); }; return (

Your Profile

{/* Profile Overview Card */}
{(user.name?.[0] || user.email?.[0] || "U").toUpperCase()}

{user.name}

{user.email} {user.emailVerified && ( Verified )}
{createdDate && (
Member since {createdDate}
)}
{/* Account Information */} Account Information Your account details and settings
{user.name || "Not provided"}
{user.email} {user.emailVerified && ( Verified )}

Account Status

Email Verification

Email address verification status

{user.emailVerified ? "Verified" : "Unverified"}

Account Type

Your account access level

Standard
{/* Account Activity */} Recent Activity Your recent account activity and sessions

Current Session

Active now

Active
{/* Quick Actions */} Quick Actions Manage your account settings and preferences
{/* Edit Profile Dialog */} Edit Profile Update your profile information. Changes will be saved to your account.

Email cannot be changed for OAuth accounts

{/* Security Settings Dialog */} Security Settings Manage your account security and authentication options.

Password

{user.email?.includes("@gmail") ? "Managed by Google" : "Set a password for your account"}

{user.email?.includes("@gmail") ? "OAuth" : "Not Set"}

Two-Factor Authentication

Add an extra layer of security

Active Sessions

Manage devices logged into your account

1 Active
{/* Email Preferences Dialog */} Email Preferences Configure your email notification settings.

Marketing Emails

Product updates and announcements

Coming Soon

Security Alerts

Important security notifications

Always On
); }