diff --git a/app/admin/page.tsx b/app/admin/page.tsx index 37cf662..d59f7b9 100644 --- a/app/admin/page.tsx +++ b/app/admin/page.tsx @@ -11,7 +11,7 @@ function StyledSelect({ }: { value: T; onChange: (v: T) => void; - options: { value: T; label: string }[]; + options: { value: T; label: string; style?: React.CSSProperties }[]; }) { const [open, setOpen] = useState(false); const ref = useRef(null); @@ -45,7 +45,7 @@ function StyledSelect({ onClick={() => setOpen(o => !o)} className={`${inputBase} text-left flex items-center justify-between cursor-pointer`} > - {displayLabel || 'Seleziona…'} + {displayLabel || 'Seleziona…'} {open && ( @@ -56,6 +56,7 @@ function StyledSelect({ type="button" onClick={() => { onChange(o.value); setOpen(false); }} className={`w-full text-left px-3 py-2.5 hover:bg-blue-50 transition-colors ${o.value === value ? 'bg-blue-100 font-semibold text-blue-700' : 'text-gray-800'}`} + style={o.style} > {o.label} @@ -79,6 +80,14 @@ const isVideoFile = (file: File) => const isPlayableVideoFile = (file: File) => new RegExp(`\\.(${PLAYBACK_SUPPORTED_VIDEO})$`, 'i').test(file.name); +const previewFontFamily = (filename: string): string => + `PortalPreview-${filename.replace(/[^A-Za-z0-9]/g, '_')}`; + +const fontFormatFromName = (filename: string): string => { + const ext = filename.match(/\.([^.]+)$/)?.[1].toLowerCase() ?? 'woff2'; + return ({ woff2: 'woff2', woff: 'woff', ttf: 'truetype', otf: 'opentype' } as Record)[ext] ?? 'woff2'; +}; + const extractFileName = (url: string): string => { const match = url.match(/[?&]name=([^&]+)/); if (match) return decodeURIComponent(match[1]); @@ -538,12 +547,22 @@ export default function AdminDashboard() {
+