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 { Separator } from '@/components/ui/separator'; import { useWindStore } from '@/store/appStore'; import { CpiSettingsCard } from '@/components/CpiSettingsCard'; import { calculateDome, type DomeType } from '@/lib/modules/dome'; import Dome3DViewer from '@/components/three/Dome3D'; 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 DomeModule: React.FC = () => { const { vk, cpi } = useWindStore(); const [diameter, setDiameter] = React.useState(20); const [rise, setRise] = React.useState(5); const [wallHeight, setWallHeight] = React.useState(8); const [type, setType] = React.useState('on-ground'); const result = useMemo(() => calculateDome({ d: diameter, f: rise, h: wallHeight, vk, type, cpi }), [diameter, rise, wallHeight, vk, type, cpi]); const handleExportPDF = () => { const sections: GenericPDFSection[] = [ { title: 'Geometria da Cúpula', type: 'grid', gridItems: [ { label: 'Tipo', value: type === 'on-ground' ? 'Sobre terreno' : 'Sobre parede cilíndrica' }, { label: 'Diâmetro (d)', value: `${diameter} m` }, { label: 'Flecha (f)', value: `${rise} m` }, ...(type === 'on-cylinder' ? [{ label: 'Altura da parede', value: `${wallHeight} m` }] : []), { label: 'f/d', value: result.fOverD.toFixed(3) }, ], }, { title: 'Coeficientes de Pressão (Cpe)', type: 'grid', gridItems: [ { label: 'Barlavento', value: result.cpeBarlavento.toFixed(2) }, { label: 'Topo', value: result.cpeTopo.toFixed(2) }, { label: 'Lateral', value: result.cpeLateral.toFixed(2) }, ], }, { title: 'Pressões p (kN/m²)', type: 'grid', gridItems: [ { label: 'Barlavento', value: (result.q * (result.cpeBarlavento - cpi)).toFixed(3) }, { label: 'Topo', value: (result.q * (result.cpeTopo - cpi)).toFixed(3) }, { label: 'Lateral', value: (result.q * (result.cpeLateral - cpi)).toFixed(3) }, ], }, ...(result.liftCoefficient > 0 ? [{ title: 'Força de Sustentação', type: 'grid' as const, gridItems: [ { label: 'Coeficiente', value: result.liftCoefficient.toFixed(2) }, { label: 'Força', value: `${result.liftForceKN.toFixed(2)} kN` }, ], }] : []), ]; exportGenericToPDF('Cúpula', sections); }; return (
{/* Coluna Esquerda: Controles */}
Cúpula Sec. 6.2.4 — silos, reservatórios, ginásios.
{diameter} m
setDiameter(v[0])} />
{rise} m
setRise(v[0])} />
{type === 'on-cylinder' && (
{wallHeight} m
setWallHeight(v[0])} />
)}
f/d:{result.fOverD.toFixed(3)}
Vₖ:{vk.toFixed(2)} m/s
q:{result.q.toFixed(4)} kN/m²
{result.liftCoefficient > 0 && (
F sustentação:{result.liftForceKN.toFixed(2)} kN
)}
{/* Coluna Central: 3D */}
f/d = {result.fOverD.toFixed(2)} Cpi = {cpi.toFixed(2)}
{/* Coluna Direita: Resultados */}
Coeficientes (Cpe) Por zona da cúpula
Barlavento
{result.cpeBarlavento.toFixed(2)}
Topo
{result.cpeTopo.toFixed(2)}
Lateral
{result.cpeLateral.toFixed(2)}

Pressões p (kN/m²)

Barlavento
{(result.q * (result.cpeBarlavento - cpi)).toFixed(3)}
Topo
{(result.q * (result.cpeTopo - cpi)).toFixed(3)}
Lateral
{(result.q * (result.cpeLateral - cpi)).toFixed(3)}
); }; export default DomeModule;