"use client"; import type { SoulmatePortraitScreenDefinition, DefaultTexts, } from "@/lib/funnel/types"; import { TemplateLayout } from "../layouts/TemplateLayout"; import { createTemplateLayoutProps } from "@/lib/funnel/templateHelpers"; import Typography from "@/components/ui/Typography/Typography"; import { buildTypographyProps } from "@/lib/funnel/mappers"; import SoulmatePortraitsDelivered from "@/components/widgets/SoulmatePortraitsDelivered/SoulmatePortraitsDelivered"; import { cn } from "@/lib/utils"; interface SoulmatePortraitTemplateProps { screen: SoulmatePortraitScreenDefinition; onContinue: () => void; canGoBack: boolean; onBack: () => void; screenProgress?: { current: number; total: number }; defaultTexts?: DefaultTexts; } export function SoulmatePortraitTemplate({ screen, onContinue, canGoBack, onBack, screenProgress, defaultTexts, }: SoulmatePortraitTemplateProps) { // Скрываем subtitle как ненужный для этого экрана const screenForLayout: SoulmatePortraitScreenDefinition = { ...screen, subtitle: undefined, }; const layoutProps = createTemplateLayoutProps( screenForLayout, { canGoBack, onBack }, screenProgress, { preset: "center", titleDefaults: { font: "manrope", weight: "bold", align: "center", size: "xl", className: "leading-[125%] text-primary text-xl", }, subtitleDefaults: undefined, actionButton: { defaultText: defaultTexts?.nextButton || "Continue", disabled: false, onClick: onContinue, }, } ); return (
{screen.soulmatePortraitsDelivered && ( ({ imageProps: a.src ? { src: a.src, alt: a.alt ?? "" } : undefined, fallbackProps: a.fallbackText ? { children: ( {a.fallbackText} ), className: "bg-background", } : undefined, className: a.fallbackText ? "w-fit px-1" : undefined, }) ), } : undefined } /> )}
{screen.description && (() => { const descProps = buildTypographyProps(screen.description, { as: "p", defaults: { align: "center", font: "inter", size: "md", weight: "bold", className: "text-[25px] font-bold", }, }); if (!descProps) return null; const { children, ...rest } = descProps; return ( {children} ); })()} {screen.textList && (
    {screen.textList.items.map((item, index) => { const itemProps = buildTypographyProps(item, { as: "li", defaults: { font: "inter", weight: "medium", size: "md" }, }); if (!itemProps) return null; const { children, ...rest } = itemProps; return ( {children} ); })}
)}
); }