import type { InvitationConfig } from "../types/config"; import { RsvpCta } from "./RsvpCta"; interface InvitationHeroProps { config: InvitationConfig; onCtaClick: () => void; onShowDetailsClick?: () => void; } export function InvitationHero({ config, onCtaClick, onShowDetailsClick, }: InvitationHeroProps) { // Parse date into Month, Day, and Day of Week const [year, monthNum, dayNum] = config.event_date.split("-").map(Number); const dateObj = new Date(year, (monthNum || 1) - 1, dayNum || 1); const monthsEs = [ "ENE", "FEB", "MAR", "ABR", "MAY", "JUN", "JUL", "AGO", "SEP", "OCT", "NOV", "DIC", ]; const daysEs = [ "DOMINGO", "LUNES", "MARTES", "MIÉRCOLES", "JUEVES", "VIERNES", "SÁBADO", ]; const monthStr = monthsEs[(monthNum || 1) - 1] || "OCT"; const dayNameStr = daysEs[dateObj.getDay()] || "VIERNES"; const dayStr = String(dayNum || 28); // Format 24h time to 12h AM/PM if applicable const [hStr, mStr] = config.event_time.split(":"); let formattedTime = config.event_time; if (hStr) { const h = parseInt(hStr, 10); const m = mStr || "00"; const ampm = h >= 12 ? "PM" : "AM"; const h12 = h % 12 || 12; formattedTime = `${h12}:${m} ${ampm}`; } return (
{/* 1. Header: Script Birthday Party */}

{config.title || "Birthday Party"}

{/* 2. Invitation wording & Honoree name */}

{config.invitation_text}

{config.honoree_name}

{/* 3. Event metadata date block */}
{dayNameStr} {/* Divider & Day Box */}
{monthStr} {dayStr}
{formattedTime}
{/* 4. RSVP Call to action */}
{onShowDetailsClick && ( )}
); }