🚀 Auto-deploy: BrainWind atualizado em 13/07/2026 18:05:59

This commit is contained in:
2026-07-13 18:05:59 +00:00
parent a4ad48b6b5
commit af49dc395d
5 changed files with 116 additions and 29 deletions
+22 -4
View File
@@ -23,6 +23,24 @@ const styles = StyleSheet.create({
sceneCaption: { fontSize: 8, color: '#666', fontStyle: 'italic', textAlign: 'center', marginBottom: 8 },
});
export function appendKgf(val: string | number): string {
if (typeof val === 'number') return String(val);
return val.replace(/(-?\d+(?:[.,]\d+)?)\s*(kN(?:\/m²|\/m2|\/m|·m|\.m|m)?)/g, (match, numStr, unit) => {
const num = parseFloat(numStr.replace(',', '.'));
if (isNaN(num)) return match;
const kgf = num * 101.9716;
let kgfUnit = 'kgf';
if (unit.includes('/m²') || unit.includes('/m2')) kgfUnit = 'kgf/m²';
else if (unit.includes('/m')) kgfUnit = 'kgf/m';
else if (unit.includes('·m') || unit.includes('.m') || unit === 'kNm') kgfUnit = 'kgf·m';
const kgfStr = kgf.toFixed(1);
const kgfFormatted = numStr.includes(',') ? kgfStr.replace('.', ',') : kgfStr;
return `${match} (${kgfFormatted} ${kgfUnit})`;
});
}
export interface GenericPDFSection {
title: string;
type: 'table' | 'text' | 'grid';
@@ -80,7 +98,7 @@ const GenericReportDocument = ({ moduleName, sections, wind, sceneImage }: Gener
q = 0,613 × (Vₖ)²
</Text>
<Text style={{ fontSize: 10, fontFamily: 'Courier', color: '#4b5563' }}>
q = 0,613 × ({wind.vk.toFixed(2)})² = {(0.613 * Math.pow(wind.vk, 2) / 1000).toFixed(4)} kN/m²
{appendKgf(`q = 0,613 × (${wind.vk.toFixed(2)})² = ${(0.613 * Math.pow(wind.vk, 2) / 1000).toFixed(4)} kN/m²`)}
</Text>
</View>
</View>
@@ -102,14 +120,14 @@ const GenericReportDocument = ({ moduleName, sections, wind, sceneImage }: Gener
</Text>
{sec.type === 'text' && sec.content && (
<Text style={styles.text}>{sec.content}</Text>
<Text style={styles.text}>{appendKgf(sec.content)}</Text>
)}
{sec.type === 'grid' && sec.gridItems && (
sec.gridItems.map((item, i) => (
<View style={styles.row} key={i}>
<Text style={styles.label}>{item.label}:</Text>
<Text style={styles.value}>{item.value}</Text>
<Text style={styles.value}>{appendKgf(item.value)}</Text>
</View>
))
)}
@@ -127,7 +145,7 @@ const GenericReportDocument = ({ moduleName, sections, wind, sceneImage }: Gener
<View style={styles.tableRow} key={rIdx}>
{tr.map((tc, cIdx) => (
<Text key={cIdx} style={cIdx === 0 ? styles.tableCellFirst : styles.tableCell}>
{tc}
{appendKgf(tc)}
</Text>
))}
</View>