"use client"; import Link from "next/link"; import Image from "next/image"; import { HiOutlineArrowDownTray } from "react-icons/hi2"; import { urlFor } from "@/lib/sanityImage"; import type { SanityImageSource } from "@sanity/image-url"; export type DownloadFormat = { variant_title: string; sku: string; download_url: string; }; export type UpcomingFormat = { variant_title: string; sku: string; }; export type DownloadCardData = { product_title: string; albumCover: SanityImageSource | null; albumArtist: string | null; slug: string | null; catalogNo: string | null; releaseDate: string | null; genre: string[]; instrumentation: string[]; formats: DownloadFormat[]; }; export type UpcomingCardData = { product_title: string; albumCover: SanityImageSource | null; albumArtist: string | null; slug: string | null; catalogNo: string | null; releaseDate: string | null; genre: string[]; instrumentation: string[]; release_date: string; formats: UpcomingFormat[]; }; function formatReleaseMonth(dateString?: string) { if (!dateString) return null; return new Intl.DateTimeFormat("en-US", { month: "short", year: "numeric", }).format(new Date(dateString)); } const downloadPillClass = [ "inline-flex items-center gap-1.5", "text-sm text-lightsec dark:text-darksec", "hover:text-trptkblue dark:hover:text-white", "transition-all duration-200 ease-in-out", ].join(" "); export function DownloadCard({ item }: { item: DownloadCardData }) { const coverSrc = item.albumCover ? urlFor(item.albumCover).url() : null; const href = item.slug ? `/release/${item.slug}` : "#"; return (