'use client';
import { IconFolder } from '../Icons';
import type { ImmichAlbumInfo, Subpage } from './types';
interface SubpagePreviewProps {
sp: Subpage;
immichAlbums: ImmichAlbumInfo[];
}
/** The drawer's read-only "Live Preview" tab: hero banner, sections, covers. */
export default function SubpagePreview({ sp, immichAlbums }: SubpagePreviewProps) {
return (
{sp.title || sp.name || 'Untitled Page'}
{sp.subtitle &&
{sp.subtitle}
}
{sp.sections && sp.sections.length > 0 ? (
sp.sections.map((sec, sIdx) => (
{sec.title || 'Untitled Section'}
{sec.description &&
{sec.description}
}
{sec.albums.map((alb, aIdx) => {
const immichAlb = immichAlbums.find((a) => a.id === alb.id);
const thumb = alb.heroImage || immichAlb?.thumbnailAssetId;
return (
{thumb ? (

) : (
)}
{alb.title || immichAlb?.albumName || alb.id}
);
})}
))
) : (
{sp.albums.map((alb, aIdx) => {
const immichAlb = immichAlbums.find((a) => a.id === alb.id);
const thumb = alb.heroImage || immichAlb?.thumbnailAssetId;
return (
{thumb ? (

) : (
)}
{alb.title || immichAlb?.albumName || alb.id}
);
})}
)}
);
}