@tmlmobilidade/emails
Version:
41 lines (40 loc) • 2.69 kB
JavaScript
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
/* * */
import { EmailWrapper, styles, ValidationSummary } from '../components/index.js';
import { Button, Hr, Section, Text } from '@react-email/components';
import { getAppConfig } from '@tmlmobilidade/lib';
export function UnsuccessfulGtfsValidationEmail({ first_name, validation }) {
const go_link = getAppConfig('plans', 'frontend_url') + '/validations/' + validation._id;
// Safe access to validation summary with fallbacks
const totalErrors = validation.summary?.total_errors ?? 0;
const totalWarnings = validation.summary?.total_warnings ?? 0;
const hasData = validation.summary !== null && validation.summary !== undefined;
return (_jsx(EmailWrapper, { preview: "Valida\u00E7\u00E3o GTFS com erros", children: _jsxs(Section, { children: [_jsxs(Text, { style: styles.text, children: ["\uD83D\uDC4B Ol\u00E1", ' ', first_name, ","] }), _jsx(Text, { style: styles.text, children: "A valida\u00E7\u00E3o GTFS do seu arquivo foi conclu\u00EDda, mas foram encontrados problemas." }), _jsx(Hr, { style: { margin: '24px 0' } }), _jsx(ValidationSummary, { hasData: hasData, isSuccessful: false, totalErrors: totalErrors, totalWarnings: totalWarnings }), _jsx(Hr, { style: { margin: '24px 0' } }), _jsx(Text, { style: styles.text, children: _jsx("strong", { children: "O que fazer agora:" }) }), _jsxs(Text, { style: styles.text, children: ["\u2022 Reveja e corrija os problemas identificados", _jsx("br", {}), "\u2022 Fa\u00E7a o upload do arquivo corrigido para nova valida\u00E7\u00E3o"] }), totalErrors > 0 && (_jsxs(Text, { style: styles.text, children: [_jsx("strong", { children: "\u26A0\uFE0F Importante" }), ": Erros formais impedem o carregamento do ficheiro GTFS e devem ser corrigidos antes da publica\u00E7\u00E3o."] })), _jsx(Text, { style: styles.text, children: "Para ver os detalhes completos da valida\u00E7\u00E3o e corrigir os problemas, clique no bot\u00E3o abaixo:" }), _jsx(Button, { href: go_link, style: styles.button, children: "Ver Detalhes da Valida\u00E7\u00E3o" })] }) }));
}
;
const validation = {
_id: '123',
created_at: 1715328000,
feeder_status: 'success',
file_id: '123',
gtfs_agency: {
agency_id: '123',
agency_name: 'Test Agency',
agency_timezone: 'Europe/Lisbon',
},
gtfs_feed_info: {
feed_lang: 'en',
},
notification_sent: false,
summary: {
messages: [],
total_errors: 4,
total_warnings: 3,
},
updated_at: 1715328000,
};
UnsuccessfulGtfsValidationEmail.PreviewProps = {
first_name: 'Josué',
validation,
};
export default UnsuccessfulGtfsValidationEmail;