diff --git a/app/src/pages/ShelterModule.tsx b/app/src/pages/ShelterModule.tsx index 9effeaa..f47cc8a 100644 --- a/app/src/pages/ShelterModule.tsx +++ b/app/src/pages/ShelterModule.tsx @@ -4,6 +4,7 @@ import { Slider } from '@/components/ui/slider'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { useWindStore } from '@/store/appStore'; +import { useHydrationStore } from '@/store/hydrationStore'; import { calculateShelterWind, calculateShelterWindAllAngles, @@ -45,6 +46,27 @@ const ShelterModule: React.FC = () => { const [surfaceMass, setSurfaceMass] = useState(15); // kg/m² para lona/telha leve const [viewMode, setViewMode] = useState<'3d' | 'elevation' | 'airflow'>('3d'); + const pendingLoad = useHydrationStore((s) => s.pendingLoad); + const clearPendingLoad = useHydrationStore((s) => s.clearPendingLoad); + + React.useEffect(() => { + if (pendingLoad && pendingLoad.module === 'shelter') { + const p = pendingLoad.inputs as any; + if (p.condition !== undefined) setCondition(p.condition); + if (p.windAngle !== undefined) setWindAngle(p.windAngle); + if (p.depth !== undefined) setDepth(p.depth); + if (p.width !== undefined) setWidth(p.width); + if (p.height !== undefined) setHeight(p.height); + if (p.theta !== undefined) setTheta(p.theta); + if (p.numColumns !== undefined) setNumColumns(p.numColumns); + if (p.backClosure !== undefined) setBackClosure(p.backClosure); + if (p.leftClosure !== undefined) setLeftClosure(p.leftClosure); + if (p.rightClosure !== undefined) setRightClosure(p.rightClosure); + if (p.surfaceMass !== undefined) setSurfaceMass(p.surfaceMass); + clearPendingLoad(); + } + }, [pendingLoad, clearPendingLoad, setCondition, setWindAngle, setDepth, setWidth, setHeight, setTheta, setNumColumns, setBackClosure, setLeftClosure, setRightClosure, setSurfaceMass]); + // Determinação automática da posição da fresta/vão a partir dos cursores (base e topo) const bottomGap = backRange[0]; const topGap = 100 - backRange[1];