This commit is contained in:
Халимов Рустам
2025-12-27 23:10:24 +03:00
parent 6c6c859a3b
commit 19754baaae
3 changed files with 37 additions and 52 deletions

View File

@@ -16,12 +16,14 @@ const App = () => {
drawer: { width: 300, depth: 400, height: 80 },
wallThickness: 1.2,
printerTolerance: 0.5,
cornerRadius: 4, // <--- Дефолтное скругление (4мм)
cornerRadius: 4,
});
// ИСПРАВЛЕНИЕ: Добавлено поле subdivisions
const [splits, setSplits] = useState<LayoutSplits>({
x: [],
y: []
y: [],
subdivisions: {}
});
// --- ЛОГИКА ВОССТАНОВЛЕНИЯ ИЗ ССЫЛКИ ---
@@ -29,7 +31,11 @@ const App = () => {
const sharedData = parseShareUrl();
if (sharedData) {
setConfig(sharedData.config);
setSplits(sharedData.splits);
// Если в старой ссылке нет subdivisions, добавляем пустое
setSplits({
...sharedData.splits,
subdivisions: sharedData.splits.subdivisions || {}
});
setStep(3);
setIsLoadedFromUrl(true);
window.history.replaceState({}, '', window.location.pathname);
@@ -122,7 +128,7 @@ const App = () => {
<button
onClick={() => {
setStep(1);
setSplits({x: [], y: []});
setSplits({x: [], y: [], subdivisions: {}});
window.history.replaceState({}, '', window.location.pathname);
}}
className="flex items-center gap-2 px-6 py-3 rounded-lg font-semibold text-gray-400 hover:text-white transition-colors border border-transparent hover:border-slate-700"