"use client" import { type Color, type Image, type ImageColor } from "@/generated/prisma" import { useGlobalSettings } from "@/hooks/useGlobalSettings" import clsx from "clsx" import { BookOpenIcon, EyeOffIcon, ImagePlusIcon } from "lucide-react" import NextImage from "next/image" import Link from "next/link" import { GlowingBorderWrapper } from "./GlowingBorderWrapper" import { TagBadge } from "./TagBadge" type CoverCardProps = { item: { id: string name: string slug: string coverImage?: (Image & { colors?: (ImageColor & { color: Color })[] }) | null type: "album" | "gallery" gallerySlug?: string } } export default function CoverCard({ item }: CoverCardProps) { const { showNSFW, animateGlow } = useGlobalSettings() const { coverImage } = item const href = item.type === "album" ? `/galleries/${item.gallerySlug}/${item.slug}` : `/galleries/${item.slug}` const badgeText = item.type === "album" ? "Album" : "Gallery" const badgeIcon = item.type === "album" ? : const borderColors = coverImage?.colors?.map((c) => c.color?.hex).filter((hex): hex is string => Boolean(hex)) ?? [] const shouldBlur = coverImage?.nsfw && !showNSFW const content = (
{coverImage?.fileKey ? ( ) : (
No cover image
)}
{coverImage?.nsfw && ( } className="text-xs px-2 py-0.5 inline-flex items-center" /> )}

{item.name}

) return ( {coverImage && animateGlow && borderColors.length > 0 ? ( {content} ) : ( content )} ) }