"use client" import { useRouter } from "next/navigation" import { useAuth } from "@/contexts/auth-context" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Alert, AlertDescription } from "@/components/ui/alert" import { LogOut, User, Settings } from "lucide-react" import { useState } from "react" export default function ProfilePage() { const router = useRouter() const { user, logout, updatePreferences } = useAuth() const [itemsPerPage, setItemsPerPage] = useState(user?.preferences.itemsPerPage || 12) if (!user) { return (
Access Denied Please log in to view your profile
) } const handleLogout = () => { logout() router.push("/") } const handleSavePreferences = () => { updatePreferences({ itemsPerPage }) } return (

Profile

Account Preferences Stats Account Information Your account details
Preferences Customize your experience
setItemsPerPage(Number.parseInt(e.target.value))} />

Number of manga to display per page (6-48)

Reading Statistics Your manga reading activity

Favorite Manga

{user.favorites.length}

Manga Reading

{Object.keys(user.chaptersRead).length}

{user.favorites.length > 0 && (

Favorite Manga IDs

{user.favorites.map((id) => ( #{id} ))}
)} {Object.keys(user.chaptersRead).length > 0 && (

Reading Progress

{Object.entries(user.chaptersRead).map(([mangaId, chapter]) => (

Manga #{mangaId}: Chapter {chapter}

))}
)} {user.favorites.length === 0 && Object.keys(user.chaptersRead).length === 0 && ( No reading activity yet. Start adding favorites and tracking chapters! )}
) }