"use client"; type AgendaItem = { order: string; time: string; title: string; description: string; avatar?: string; }; type Props = { data: { id: string; eyebrow: string; title: string; description: string; items: AgendaItem[]; }; }; const renderFormattedText = (text: string) => { if (!text) return ""; const lines = text.split("\n"); return lines.map((line, lineIndex) => { // Split the line by markdown bold (**bold**) and italic (*italic*) const parts = line.split(/(\*\*.*?\*\*|\*.*?\*)/g); const renderedLine = parts.map((part, partIndex) => { if (part.startsWith("**") && part.endsWith("**")) { return ( {part.slice(2, -2)} ); } if (part.startsWith("*") && part.endsWith("*")) { return ( {part.slice(1, -1)} ); } return part; }); return ( {renderedLine} ); }); }; export default function AgendaSection({ data }: Props) { const base = process.env.NEXT_PUBLIC_BASE_PATH || ""; const renderAvatar = (avatarUrl: string, sizeClass: string) => (
{avatarUrl.includes("placeholder") ? ( ) : ( // eslint-disable-next-line @next/next/no-img-element Speaker )}
); return (
{/* Section Header */}
{data.eyebrow}

{data.title}

{data.description}

{/* Timeline Container */}
{/* Central vertical line */}
{/* Timeline Items */}
{data.items.map((item, index) => { const isEven = index % 2 === 0; return (
{/* Timeline Dot (glowing on hover) */}
{/* Left/Right alternating grid layout */}
{isEven ? ( <> {/* Left: Card (Desktop) / Full content (Mobile) */}
{item.order} {/* Mobile-only time badge */}
{item.time}

{renderFormattedText(item.title)}

{!item.description && item.avatar && (
{renderAvatar(item.avatar, "w-10 h-10 lg:w-12 lg:h-12")}
)} {item.description && (
{item.avatar && (
{renderAvatar(item.avatar, "w-10 h-10 lg:w-12 lg:h-12")}
)}
{renderFormattedText(item.description)}
)}
{/* Right: Time badge (Desktop-only) */}
{item.time}
) : ( <> {/* Left: Time badge (Desktop-only) */}
{item.time}
{/* Right: Card (Desktop) / Full content (Mobile) */}
{item.order} {/* Mobile-only time badge */}
{item.time}

{renderFormattedText(item.title)}

{!item.description && item.avatar && (
{renderAvatar(item.avatar, "w-10 h-10 lg:w-12 lg:h-12")}
)} {item.description && (
{item.avatar && (
{renderAvatar(item.avatar, "w-10 h-10 lg:w-12 lg:h-12")}
)}
{renderFormattedText(item.description)}
)}
)}
); })}
); }