import React, { useState, useMemo, useEffect } from 'react'; import { AppConfig, LayoutSplits, GeneratedPart } from './types'; import { calculateParts } from './services/geometryGenerator'; import { ConfigStep } from './components/ConfigStep'; import { LayoutStep } from './components/LayoutStep'; import { PreviewStep } from './components/PreviewStep'; import { parseShareUrl } from './utils/share'; import { ChevronRight, ChevronLeft, Box } from 'lucide-react'; const App = () => { const [step, setStep] = useState(1); const [config, setConfig] = useState({ drawer: { width: 300, depth: 400, height: 80 }, wallThickness: 1.2, printerTolerance: 0.5, cornerRadius: 4, }); // ВАЖНО: Инициализируем partitions const [splits, setSplits] = useState({ x: [], y: [], partitions: {} }); useEffect(() => { const sharedData = parseShareUrl(); if (sharedData) { setConfig(sharedData.config); setSplits({ x: sharedData.splits.x || [], y: sharedData.splits.y || [], partitions: sharedData.splits.partitions || {} }); setStep(3); window.history.replaceState({}, '', window.location.pathname); } }, []); const parts: GeneratedPart[] = useMemo(() => { return calculateParts(config, splits); }, [config, splits]); return (

PrintFit

Генератор органайзеров

{[1, 2, 3].map((num) => (
{num} {num === 1 ? 'Настройки' : num === 2 ? 'Макет' : 'Экспорт'}
))}
{step === 1 &&
} {step === 2 &&
} {step === 3 &&
}
); }; export default App;