import React, { useMemo } from 'react'; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card'; import { Slider } from '@/components/ui/slider'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Badge } from '@/components/ui/badge'; import { useWindStore } from '@/store/appStore'; import { calculateTower, type TowerSection, type TowerBarType } from '@/lib/modules/tower'; import Tower3DViewer from '@/components/three/Tower3D'; import SceneCapturePanel from '../components/SceneCapturePanel'; import ExportMenu from '../components/ExportMenu'; import { EducationalManual } from '@/components/EducationalManual'; import { exportGenericToPDF, type GenericPDFSection } from '../lib/export-generic-pdf'; const TowerModule: React.FC = () => { const { q } = useWindStore(); const [section, setSection] = React.useState('square'); const [barType, setBarType] = React.useState('flat'); const [baseWidth, setBaseWidth] = React.useState(3); const [height, setHeight] = React.useState(30); const [panels, setPanels] = React.useState(6); const [phi, setPhi] = React.useState(0.3); const [alphaWind, setAlphaWind] = React.useState<0 | 45 | 90>(0); const result = useMemo(() => { const aFace = baseWidth * height; return calculateTower({ section, barType, phi, aFace, alphaWind, q, }); }, [section, barType, phi, baseWidth, height, alphaWind, q]); const handleExportPDF = () => { const sections: GenericPDFSection[] = [ { title: 'Geometria da Torre', type: 'grid', gridItems: [ { label: 'Seção', value: section === 'square' ? 'Quadrada' : 'Triangular' }, { label: 'Tipo de barra', value: barType === 'flat' ? 'Faces planas' : 'Circular' }, { label: 'Largura da base', value: `${baseWidth} m` }, { label: 'Altura', value: `${height} m` }, { label: 'Tramos', value: String(panels) }, { label: 'φ (área exposta)', value: phi.toFixed(2) }, { label: 'Ângulo do vento', value: `${alphaWind}°` }, ], }, { title: 'Coeficientes', type: 'grid', gridItems: [ { label: 'Ca', value: result.ca.toFixed(2) }, { label: 'Ca efetivo', value: result.caEff.toFixed(2) }, { label: 'Kα', value: result.kAlpha.toFixed(2) }, ], }, { title: 'Forças', type: 'grid', gridItems: [ { label: 'Força Total', value: `${result.forceKN.toFixed(2)} kN` }, { label: 'Face I', value: `${result.faceComponents.faceI.toFixed(2)} kN` }, { label: 'Face II', value: `${result.faceComponents.faceII.toFixed(2)} kN` }, { label: 'Face III', value: `${result.faceComponents.faceIII.toFixed(2)} kN` }, { label: 'Face IV', value: `${result.faceComponents.faceIV.toFixed(2)} kN` }, ], }, ]; exportGenericToPDF('Torre Reticulada', sections); }; return (
{/* Coluna Esquerda: Controles */}
Torre Reticulada Sec. 8.5 — faces planas ou circulares.
{baseWidth} m
setBaseWidth(v[0])} />
{height} m
setHeight(v[0])} />
{panels}
setPanels(v[0])} />
{phi.toFixed(2)}
setPhi(v[0])} />
q:{q.toFixed(4)} kN/m²
{/* Coluna Central: 3D */}
{section === 'square' ? 'Quadrada' : 'Triangular'} α = {alphaWind}°
{/* Coluna Direita: Resultados */}
Resultados Coeficientes e forças na torre
Ca
{result.ca.toFixed(2)}
Ca efetivo
{result.caEff.toFixed(2)}
{result.kAlpha.toFixed(2)}
Força total
{result.forceKN.toFixed(2)} kN

Componentes por face

Face I
{result.faceComponents.faceI.toFixed(2)} kN
Face II
{result.faceComponents.faceII.toFixed(2)} kN
Face III
{result.faceComponents.faceIII.toFixed(2)} kN
Face IV
{result.faceComponents.faceIV.toFixed(2)} kN
); }; export default TowerModule;