import React, { useState } from 'react'; import { useBeamStore } from '../../store/useBeamStore'; type LoadTab = 'Final' | 'Construction'; type LoadSubTab = 'Uniform' | 'Variable' | 'Concentrated' | 'Moments'; export const LoadsInput: React.FC = () => { const { loads, setLoads } = useBeamStore(); const [activeTab, setActiveTab] = useState('Final'); const [activeSubTab, setActiveSubTab] = useState('Uniform'); const updateUniformLoad = (id: string, field: string, value: any) => { const updated = loads.uniformLoads.map(load => load.id === id ? { ...load, [field]: value } : load ); setLoads({ uniformLoads: updated }); }; return (
Loads
{/* Main Tabs */}
{/* Sub Tabs */}
{activeSubTab === 'Uniform' && ( <>
{loads.uniformLoads.map((load) => ( ))}
Full Length Trib (ft) Loads (psf)
Start End Dead Live R Live Snow Wind Seismic
{load.id} updateUniformLoad(load.id, 'full', e.target.checked)} /> updateUniformLoad(load.id, 'start', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="0.1" disabled={load.full} /> updateUniformLoad(load.id, 'end', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="0.1" disabled={load.full} /> updateUniformLoad(load.id, 'tributaryWidth', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="0.1" /> updateUniformLoad(load.id, 'dead', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="1" /> updateUniformLoad(load.id, 'live', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="1" /> updateUniformLoad(load.id, 'rLive', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="1" /> updateUniformLoad(load.id, 'snow', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="1" /> updateUniformLoad(load.id, 'wind', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="1" /> updateUniformLoad(load.id, 'seismic', parseFloat(e.target.value) || 0)} style={{ width: '60px' }} step="1" /> x
{/* Load Diagram */}
{/* End labels */} Start End {/* Load label */} w {/* Blue load area */} {/* Green beam with supports */} {/* Dimension lines */}
)} {activeSubTab === 'Variable' && (
Variable loads tab (not implemented in this demo)
)} {activeSubTab === 'Concentrated' && (
Concentrated loads tab (not implemented in this demo)
)} {activeSubTab === 'Moments' && (
Moments tab (not implemented in this demo)
)}
); };