@tmlmobilidade/emails
Version:
14 lines (13 loc) • 2.51 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Text } from '@react-email/components';
import { HighlightText } from './highlight-text.js';
import { InfoBox } from './info-box.js';
import styles from './styles.js';
export function ValidationSummary({ hasData = false, isSuccessful, totalErrors = 0, totalWarnings = 0, }) {
const variant = isSuccessful ? 'success' : 'error';
const title = isSuccessful ? '✅ Resumo da Validação' : '📋 Resumo da Validação';
if (!hasData) {
return (_jsxs(InfoBox, { variant: variant, children: [_jsx(Text, { style: { ...styles.text, fontWeight: '600', margin: '0 0 12px 0' }, children: isSuccessful ? '✅ Validação Concluída' : '📋 Validação Concluída' }), _jsxs(Text, { style: { ...styles.text, margin: '8px 0' }, children: ["\uD83C\uDF89", ' ', _jsxs(HighlightText, { variant: isSuccessful ? 'success' : 'error', children: ["Valida\u00E7\u00E3o conclu\u00EDda", ' ', isSuccessful ? 'com sucesso' : 'com problemas', "!"] })] })] }));
}
return (_jsxs(InfoBox, { variant: variant, children: [_jsx(Text, { style: { ...styles.text, fontWeight: '600', margin: '0 0 12px 0' }, children: title }), isSuccessful ? (_jsxs(Text, { style: { ...styles.text, margin: '8px 0' }, children: ["\uD83C\uDF89", ' ', _jsx(HighlightText, { variant: "success", children: "Valida\u00E7\u00E3o conclu\u00EDda com sucesso!" })] })) : null, totalErrors > 0 && (_jsxs(Text, { style: { ...styles.text, margin: '8px 0' }, children: ["\u274C", ' ', _jsxs(HighlightText, { variant: "error", children: [totalErrors, ' ', "erro", totalErrors !== 1 ? 's' : ''] }), ' ', "cr\u00EDtico", totalErrors !== 1 ? 's' : '', ' ', "encontrado", totalErrors !== 1 ? 's' : ''] })), totalWarnings > 0 && (_jsxs(Text, { style: { ...styles.text, margin: '8px 0' }, children: ["\u26A0\uFE0F", ' ', _jsxs(HighlightText, { variant: "warning", children: [totalWarnings, ' ', "aviso", totalWarnings !== 1 ? 's' : ''] }), ' ', "encontrado", totalWarnings !== 1 ? 's' : '', !isSuccessful ? '' : ' (não crítico' + (totalWarnings !== 1 ? 's' : '') + ')'] })), isSuccessful && totalWarnings === 0 && (_jsx(Text, { style: { ...styles.text, color: '#16A34A', margin: '8px 0' }, children: "\u2728 Nenhum erro ou aviso encontrado - arquivo perfeito!" })), !isSuccessful && totalErrors === 0 && totalWarnings === 0 && (_jsx(Text, { style: { ...styles.text, fontStyle: 'italic', margin: '8px 0' }, children: "Nenhum erro ou aviso espec\u00EDfico foi reportado." }))] }));
}