import type { Novel } from '../__generated__/graphql' import { Card, CardContent, CardHeader, CardTitle } from './ui/card' type NovelCardProps = { novel: Novel } function pickText(novelText?: Novel['name'] | Novel['description']) { const texts = novelText?.texts ?? [] const english = texts.find((t) => t.language === 'EN') return (english ?? texts[0])?.text ?? 'No description available.' } export function NovelCard({ novel }: NovelCardProps) { const title = pickText(novel.name) const description = pickText(novel.description) const cover = novel.coverImage const coverSrc = cover?.newPath ?? cover?.originalPath return ( {coverSrc ? (
{title}
) : (
)} {title}

{description}

) }