From ea993168a176f9214d83e0dc18465e5e45d96c4e Mon Sep 17 00:00:00 2001 From: pollutri Date: Thu, 14 May 2026 17:27:26 +0200 Subject: [PATCH] autoredirect function --- app/admin/page.tsx | 14 ++++++++++++++ components/PublicGrid.tsx | 8 ++++++++ types/index.ts | 1 + 3 files changed, 23 insertions(+) diff --git a/app/admin/page.tsx b/app/admin/page.tsx index 2d5b16f..2fcdd61 100644 --- a/app/admin/page.tsx +++ b/app/admin/page.tsx @@ -615,6 +615,20 @@ export default function AdminDashboard() { />

Testo visualizzato come link cliccabile nel modale. Se vuoto, viene mostrata l’URL stessa.

+
+ +
) : (
diff --git a/components/PublicGrid.tsx b/components/PublicGrid.tsx index 58b3399..f0b4ccd 100644 --- a/components/PublicGrid.tsx +++ b/components/PublicGrid.tsx @@ -460,6 +460,14 @@ export default function PublicGrid({ cards, maxCols = 5 }: { cards: Card[], maxC
{ + // EXTERNAL_LINK + redirectOnClick: salta il modale e apri direttamente l'URL + if (card.cardType === 'EXTERNAL_LINK' && card.redirectOnClick) { + const url = card.actionUrl || card.shortDescription; + if (url) { + window.open(url, '_blank', 'noopener,noreferrer'); + return; + } + } setActiveCard(card); if (card.autoFullscreen) setFullscreenIndex(0); }} diff --git a/types/index.ts b/types/index.ts index acb37e5..b3adf27 100644 --- a/types/index.ts +++ b/types/index.ts @@ -19,6 +19,7 @@ export interface Card { displayOrder: number; autoFullscreen?: boolean; // open the fullscreen viewer immediately when this card is clicked skipPreview?: boolean; // skip the modal preview AND exclude the cover image from the swipe sequence + redirectOnClick?: boolean; // EXTERNAL_LINK only — click card to open the URL directly without showing the modal } export interface Portal {