import { Badge } from '@/components/badge' import { Author, Book, Genre } from '@/payload-types' import { Avatar } from '../avatar' type Props = { books: Book[] } const makeAuthorsLabel = (book: Book) => { const authors = book.authors as Author[] // TODO: endure this type safety const translators = authors?.filter((a) => a.role === 'Translator').map((t) => t.lf) const editors = authors?.filter((a) => a.role === 'Editor').map((e) => e.lf) const actualAuthors = authors ?.filter((a) => !editors.includes(a.lf) && !translators.includes(a.lf)) .map((a) => a.lf) return (
{b.title} {b.lcc}
{makeGenreBadges(b)}
{makeAuthorsLabel(b)}
{ /*b.lastBorrowed*/ false ? (Last Borrowed{' '}
) : (Available