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 ( ) } const makeGenreBadges = (book: Book) => { return (book.genre as Genre[])?.map((g) => ( {g.name} )) } export default function BookList(props: Props) { const { books } = props return (
) }