"use client";
import { useState } from "react";
import Image from "next/image";
import Link from "next/link";
import { BookDto } from "../../lib/api";
interface BookCardProps {
book: BookDto & { coverUrl?: string };
}
function BookImage({ src, alt }: { src: string; alt: string }) {
const [isLoaded, setIsLoaded] = useState(false);
return (
{/* Skeleton */}
{/* Image */}
setIsLoaded(true)}
unoptimized
/>
);
}
export function BookCard({ book }: BookCardProps) {
const coverUrl = book.coverUrl || `/api/books/${book.id}/pages/1?format=webp&width=200`;
return (
{/* Book Info */}
{book.title}
{book.author && (
{book.author}
)}
{book.series && (
{book.series}
{book.volume && #{book.volume}}
)}
{/* Meta Tags */}
{book.kind}
{book.language && (
{book.language}
)}
);
}
interface BooksGridProps {
books: (BookDto & { coverUrl?: string })[];
}
export function BooksGrid({ books }: BooksGridProps) {
return (
{books.map((book) => (
))}
);
}
interface EmptyStateProps {
message: string;
}
export function EmptyState({ message }: EmptyStateProps) {
return (
);
}