"use client" import Link from "next/link" import { BookOpen, BookMarked, Trash2 } from "lucide-react" import { Button } from "@/components/ui/button" import { useAuth } from "@/lib/auth-context" import { useBookmarks } from "@/lib/bookmark-context" export default function BookshelfPage() { const { user } = useAuth() const { bookmarks, toggleBookmark } = useBookmarks() if (!user) { return (

Tủ Sách

Đăng nhập để xem danh sách truyện đã lưu

) } const bookmarkedNovels = bookmarks.filter(b => b.novel).map(b => ({ novel: b.novel as any, bookmark: b })) return (

Tủ Sách

{bookmarkedNovels.length === 0 ? (

Chưa có truyện nào

Hãy thêm truyện yêu thích vào tủ sách của bạn.

) : (
{bookmarkedNovels.map(({ novel, bookmark }) => { const readLink = bookmark.lastChapterNumber ? `/truyen/${novel.slug}/${bookmark.lastChapterNumber}` : `/truyen/${novel.slug}/1` return (
{novel.title}

{novel.authorName}

{bookmark.lastChapterNumber && (

Đang đọc: Chương {bookmark.lastChapterNumber} / {novel.totalChapters}

)}
) })}
)}
) }