|
|
@@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
import { useState, useEffect } from 'react';
|
|
|
import { useState, useEffect } from 'react';
|
|
|
import { Card, Portal, MediaItem } from '@/types';
|
|
|
import { Card, Portal, MediaItem } from '@/types';
|
|
|
|
|
|
import { EXTERNAL_LINK_ENABLED } from '@/lib/config';
|
|
|
|
|
|
|
|
|
const isVideoUrl = (url: string) => /\.(mp4|webm|mov|m4v|ogv)(\?|$)/i.test(url);
|
|
|
const isVideoUrl = (url: string) => /\.(mp4|webm|mov|m4v|ogv)(\?|$)/i.test(url);
|
|
|
const isPdfFile = (file: File) =>
|
|
|
const isPdfFile = (file: File) =>
|
|
|
@@ -498,12 +499,28 @@ export default function AdminDashboard() { |
|
|
<select value={isEditing.cardType || 'INFO_PAGE'} onChange={e => setIsEditing({...isEditing, cardType: e.target.value as any})} className={inputClasses}>
|
|
|
<select value={isEditing.cardType || 'INFO_PAGE'} onChange={e => setIsEditing({...isEditing, cardType: e.target.value as any})} className={inputClasses}>
|
|
|
<option value="INFO_PAGE">Info Page</option>
|
|
|
<option value="INFO_PAGE">Info Page</option>
|
|
|
<option value="IMAGE_GALLERY">Image Gallery</option>
|
|
|
<option value="IMAGE_GALLERY">Image Gallery</option>
|
|
|
<option value="EXTERNAL_LINK">External Link</option>
|
|
|
|
|
|
|
|
|
{EXTERNAL_LINK_ENABLED && <option value="EXTERNAL_LINK">External Link</option>}
|
|
|
</select>
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div>
|
|
|
<label className="block text-sm font-semibold text-gray-800 mb-1">Short Description</label>
|
|
|
|
|
|
<textarea value={isEditing.shortDescription || ''} onChange={e => setIsEditing({...isEditing, shortDescription: e.target.value})} className={`${inputClasses} h-24 resize-none`} placeholder="Brief summary..." />
|
|
|
|
|
|
|
|
|
{isEditing.cardType === 'EXTERNAL_LINK' ? (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<label className="block text-sm font-semibold text-gray-800 mb-1">URL</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="url"
|
|
|
|
|
|
value={isEditing.shortDescription || ''}
|
|
|
|
|
|
onChange={e => setIsEditing({ ...isEditing, shortDescription: e.target.value })}
|
|
|
|
|
|
className={inputClasses}
|
|
|
|
|
|
placeholder="https://esempio.it/pagina"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<p className="text-xs text-gray-500 mt-1">Aprendo la card, il testo sarà cliccabile e porterà a questo indirizzo.</p>
|
|
|
|
|
|
</>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<label className="block text-sm font-semibold text-gray-800 mb-1">Short Description</label>
|
|
|
|
|
|
<textarea value={isEditing.shortDescription || ''} onChange={e => setIsEditing({ ...isEditing, shortDescription: e.target.value })} className={`${inputClasses} h-24 resize-none`} placeholder="Brief summary..." />
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className="bg-gray-50 p-3 rounded-lg border border-gray-200 space-y-3">
|
|
|
<div className="bg-gray-50 p-3 rounded-lg border border-gray-200 space-y-3">
|
|
|
<label className="flex items-start gap-3 cursor-pointer">
|
|
|
<label className="flex items-start gap-3 cursor-pointer">
|
|
|
|