"use client"; import React from "react"; import { Button } from "@/components/ui/button"; import { TextInput } from "@/components/ui/TextInput/TextInput"; import { Trash2, Plus } from "lucide-react"; import type { BuilderScreen } from "@/lib/admin/builder/types"; import type { LoadersScreenDefinition } from "@/lib/funnel/types"; interface LoadersScreenConfigProps { screen: BuilderScreen & { template: "loaders" }; onUpdate: (updates: Partial) => void; } export function LoadersScreenConfig({ screen, onUpdate }: LoadersScreenConfigProps) { const updateProgressbars = (updates: Partial) => { onUpdate({ progressbars: { items: screen.progressbars?.items || [], transitionDuration: screen.progressbars?.transitionDuration || 5000, ...updates, }, }); }; const addProgressbarItem = () => { const currentItems = screen.progressbars?.items || []; updateProgressbars({ items: [ ...currentItems, { title: `Step ${currentItems.length + 1}`, subtitle: "", processingTitle: `Processing step ${currentItems.length + 1}...`, processingSubtitle: "", completedTitle: `Step ${currentItems.length + 1} completed`, completedSubtitle: "", }, ], }); }; const removeProgressbarItem = (index: number) => { const currentItems = screen.progressbars?.items || []; updateProgressbars({ items: currentItems.filter((_, i) => i !== index), }); }; const updateProgressbarItem = ( index: number, updates: Partial ) => { const currentItems = screen.progressbars?.items || []; const updatedItems = currentItems.map((item, i) => i === index ? { ...item, ...updates } : item ); updateProgressbars({ items: updatedItems }); }; return (

Настройки анимации

updateProgressbars({ transitionDuration: parseInt(e.target.value) || 5000 })} />

Шаги загрузки

{(screen.progressbars?.items || []).map((item, index) => (
Шаг {index + 1}
updateProgressbarItem(index, { title: e.target.value })} /> updateProgressbarItem(index, { subtitle: e.target.value })} />
updateProgressbarItem(index, { processingTitle: e.target.value })} /> updateProgressbarItem(index, { processingSubtitle: e.target.value })} />
updateProgressbarItem(index, { completedTitle: e.target.value })} /> updateProgressbarItem(index, { completedSubtitle: e.target.value })} />
))}
{(screen.progressbars?.items || []).length === 0 && (

Нет шагов загрузки

)}
); }