Browse Source

Fix Fullscreen bug

Sviluppo_Carrello_Immagini
parent
commit
d781432910
1 changed files with 3 additions and 5 deletions
  1. +3
    -5
      components/PublicGrid.tsx

+ 3
- 5
components/PublicGrid.tsx View File

@@ -342,11 +342,9 @@ export default function PublicGrid({ cards, maxCols = 5 }: { cards: Card[], maxC
key={card.id} key={card.id}
onClick={() => { onClick={() => {
setActiveCard(card); setActiveCard(card);
// If any extraMedia item is flagged auto-fullscreen, open it immediately.
// The carousel's index 0 is the cover image; extraMedia starts at offset 1 (or 0 if no cover).
const offset = card.imageUrl ? 1 : 0;
const idx = (card.extraMedia || []).findIndex(m => m.autoFullscreen);
if (idx >= 0) setFullscreenIndex(offset + idx);
// If any media item is flagged auto-fullscreen, open the viewer from the start.
const triggers = (card.extraMedia || []).some(m => m.autoFullscreen);
if (triggers) setFullscreenIndex(0);
}} }}
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" 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"
> >


Loading…
Cancel
Save