"use client"; import { useState } from "react"; import { TemplateLayout } from "./TemplateLayout"; import CircularProgressbarsList from "@/components/widgets/CircularProgressbarsList/CircularProgressbarsList"; import type { LoadersScreenDefinition } from "@/lib/funnel/types"; interface LoadersTemplateProps { screen: LoadersScreenDefinition; onContinue: () => void; canGoBack: boolean; onBack: () => void; screenProgress?: { current: number; total: number }; defaultTexts?: { nextButton?: string; continueButton?: string }; } export function LoadersTemplate({ screen, onContinue, canGoBack, onBack, screenProgress, defaultTexts, }: LoadersTemplateProps) { const [isVisibleButton, setIsVisibleButton] = useState(false); const onAnimationEnd = () => { setIsVisibleButton(true); }; const progressbarsListProps = { progressbarItems: screen.progressbars?.items?.map((item: unknown, index: number) => { const typedItem = item as { title?: string; processingTitle?: string; processingSubtitle?: string; completedTitle?: string; completedSubtitle?: string; }; return { circularProgressbarProps: { text: { children: typedItem.title || `Step ${index + 1}` }, }, processing: typedItem.processingTitle ? { title: { children: typedItem.processingTitle }, subtitle: typedItem.processingSubtitle ? { children: typedItem.processingSubtitle } : undefined, } : undefined, completed: typedItem.completedTitle ? { title: { children: typedItem.completedTitle }, subtitle: typedItem.completedSubtitle ? { children: typedItem.completedSubtitle } : undefined, } : undefined, }; }) || [], transitionDurationItem: screen.progressbars?.transitionDuration || 3000, // Как в оригинале onAnimationEnd, }; return (
); }