Преглед изворни кода

autoredirect function

Sviluppo_Carrello_Immagini
Lorenzo Pollutri пре 1 месец
родитељ
комит
ea993168a1
3 измењених фајлова са 23 додато и 0 уклоњено
  1. +14
    -0
      app/admin/page.tsx
  2. +8
    -0
      components/PublicGrid.tsx
  3. +1
    -0
      types/index.ts

+ 14
- 0
app/admin/page.tsx Прегледај датотеку

@@ -615,6 +615,20 @@ export default function AdminDashboard() {
/> />
<p className="text-xs text-gray-500 mt-1">Testo visualizzato come link cliccabile nel modale. Se vuoto, viene mostrata l&rsquo;URL stessa.</p> <p className="text-xs text-gray-500 mt-1">Testo visualizzato come link cliccabile nel modale. Se vuoto, viene mostrata l&rsquo;URL stessa.</p>
</div> </div>
<div className="bg-gray-50 p-3 rounded-lg border border-gray-200">
<label className="flex items-start gap-3 cursor-pointer">
<input
type="checkbox"
checked={!!isEditing.redirectOnClick}
onChange={e => setIsEditing({ ...isEditing, redirectOnClick: e.target.checked })}
className="w-5 h-5 text-blue-600 rounded mt-0.5"
/>
<div>
<span className="block text-sm font-semibold text-gray-900">Redirect on click</span>
<span className="block text-xs text-gray-600">Cliccando la card sul portale pubblico, il browser apre direttamente l&rsquo;URL senza mostrare il modale.</span>
</div>
</label>
</div>
</> </>
) : ( ) : (
<div> <div>


+ 8
- 0
components/PublicGrid.tsx Прегледај датотеку

@@ -460,6 +460,14 @@ export default function PublicGrid({ cards, maxCols = 5 }: { cards: Card[], maxC
<div <div
key={card.id} key={card.id}
onClick={() => { onClick={() => {
// 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); setActiveCard(card);
if (card.autoFullscreen) setFullscreenIndex(0); if (card.autoFullscreen) setFullscreenIndex(0);
}} }}


+ 1
- 0
types/index.ts Прегледај датотеку

@@ -19,6 +19,7 @@ export interface Card {
displayOrder: number; displayOrder: number;
autoFullscreen?: boolean; // open the fullscreen viewer immediately when this card is clicked 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 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 { export interface Portal {


Loading…
Откажи
Сачувај