import React from 'react'; import { useCalculatorStore } from '../../store/calculatorStore'; import { EscarpmentDiagram } from './diagrams/EscarpmentDiagram'; import { RidgeDiagram } from './diagrams/RidgeDiagram'; export const TopographyInput: React.FC = () => { const { wind, setWind } = useCalculatorStore(); const { topography } = wind; // Helper to update nested topography state const updateTopo = (updates: Partial) => { // Use functional update if possible to avoid stale state, but store only supports direct set. // We rely on 'topography' being fresh from the hook. setWind({ topography: { ...topography, ...updates } }); }; const handleShapeChange = (e: React.ChangeEvent) => { const newShape = e.target.value; updateTopo({ shape: newShape as any }); }; const handleChange = (e: React.ChangeEvent) => { const val = e.target.type === 'number' ? parseFloat(e.target.value) : e.target.value; updateTopo({ [e.target.name]: val }); }; return (
Topographic Factor (Kzt)
{/* Placeholder for graphic if needed */}
{topography.shape !== 'Flat' && (
ft
ft
ft
)}
{topography.shape === 'Escarpment' && ( )} {(topography.shape === 'Ridge' || topography.shape === 'Hill') && ( )}
Kzt (Calculated): {topography.factor.toFixed(2)}
); };