|
|
|
@@ -453,6 +453,9 @@ export default function PublicGrid({ cards, maxCols = 5 }: { cards: Card[], maxC |
|
|
|
<div className={`grid gap-4 ${activeGridClass}`}> |
|
|
|
{cards.map((card) => { |
|
|
|
const galleryCount = (card.extraMedia?.length || 0) + (card.imageUrl ? 1 : 0); |
|
|
|
// Fall back to the first gallery item when no explicit cover is set. |
|
|
|
const previewUrl = card.imageUrl || card.extraMedia?.[0]?.url || ''; |
|
|
|
const previewIsVideo = !!previewUrl && isVideoUrl(previewUrl); |
|
|
|
return ( |
|
|
|
<div |
|
|
|
key={card.id} |
|
|
|
@@ -462,8 +465,18 @@ export default function PublicGrid({ cards, maxCols = 5 }: { cards: Card[], maxC |
|
|
|
}} |
|
|
|
className="group relative cursor-pointer overflow-hidden rounded-xl shadow-md aspect-square bg-gray-200 transition-all duration-300 hover:shadow-xl hover:-translate-y-1" |
|
|
|
> |
|
|
|
{card.imageUrl ? ( |
|
|
|
<img src={card.imageUrl} alt={card.title} className="absolute inset-0 w-full h-full object-cover" /> |
|
|
|
{previewUrl ? ( |
|
|
|
previewIsVideo ? ( |
|
|
|
<video |
|
|
|
src={previewUrl} |
|
|
|
className="absolute inset-0 w-full h-full object-cover pointer-events-none" |
|
|
|
muted |
|
|
|
playsInline |
|
|
|
preload="metadata" |
|
|
|
/> |
|
|
|
) : ( |
|
|
|
<img src={previewUrl} alt={card.title} className="absolute inset-0 w-full h-full object-cover" /> |
|
|
|
) |
|
|
|
) : ( |
|
|
|
<div className="absolute inset-0 flex items-center justify-center bg-gradient-to-br from-blue-100 to-gray-200 text-gray-400">No Image</div> |
|
|
|
)} |
|
|
|
|