UNPKG

@tmlmobilidade/emails

Version:
43 lines (42 loc) 3.57 kB
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime"; import { EmailWrapper, InfoBox, styles } from '../components/index.js'; import { Button, Hr, Section, Text } from '@react-email/components'; import { getAppConfig } from '@tmlmobilidade/lib'; import { Dates } from '@tmlmobilidade/utils'; export function PlanApprovedEmail({ first_name, plan }) { const go_link = getAppConfig('plans', 'frontend_url') + '/plans/' + plan._id; return (_jsx(EmailWrapper, { preview: "Plano aprovado com sucesso", children: _jsxs(Section, { children: [_jsxs(Text, { style: styles.text, children: ["\uD83D\uDC4B Ol\u00E1", ' ', first_name, ","] }), _jsx(Text, { style: styles.text, children: "Excelentes not\u00EDcias! O seu plano foi aprovado e est\u00E1 agora dispon\u00EDvel para publica\u00E7\u00E3o." }), _jsx(Hr, { style: { margin: '24px 0' } }), _jsxs(InfoBox, { variant: "success", children: [_jsx(Text, { style: { ...styles.text, fontWeight: '600', margin: '0 0 12px 0' }, children: "\u2705 Plano Aprovado" }), _jsxs(Text, { style: { ...styles.text, margin: '8px 0' }, children: [_jsx("strong", { children: "ID do Plano:" }), ' ', plan._id, _jsx("br", {}), _jsx("strong", { children: "Ag\u00EAncia:" }), ' ', plan.gtfs_agency?.agency_name || 'Não especificada', _jsx("br", {}), _jsx("strong", { children: "Data de Aprova\u00E7\u00E3o:" }), ' ', new Date().toLocaleDateString('pt-PT')] })] }), _jsxs(InfoBox, { variant: "info", children: [_jsx(Text, { style: { ...styles.text, fontWeight: '600', margin: '0 0 12px 0' }, children: "\uD83D\uDCC5 Data de publica\u00E7\u00E3o" }), _jsxs(Text, { style: { ...styles.text, margin: '8px 0' }, children: [_jsx("strong", { children: "Data de in\u00EDcio:" }), ' ', Dates.fromOperationalDate(plan.gtfs_feed_info?.feed_start_date, 'Europe/Lisbon').toLocaleString(Dates.FORMATS.DATE_FULL_WITH_YEAR, 'pt-PT')] }), _jsxs(Text, { style: { ...styles.text, margin: '8px 0' }, children: [_jsx("strong", { children: "Data de fim:" }), ' ', Dates.fromOperationalDate(plan.gtfs_feed_info?.feed_end_date, 'Europe/Lisbon').toLocaleString(Dates.FORMATS.DATE_FULL_WITH_YEAR, 'pt-PT')] })] }), _jsx(Hr, { style: { margin: '24px 0' } }), _jsx(Text, { style: styles.text, children: _jsx("strong", { children: "O que isto significa:" }) }), _jsxs(Text, { style: styles.text, children: ["\u2022 O plano passou por todas as valida\u00E7\u00F5es necess\u00E1rias", _jsx("br", {}), "\u2022 Os dados ser\u00E3o automaticamente publicados para os sistemas de informa\u00E7\u00E3o"] }), _jsx(Text, { style: styles.text, children: "Para ver os detalhes completos do seu plano aprovado, clique no bot\u00E3o abaixo:" }), _jsx(Button, { href: go_link, style: styles.button, children: "Ver Plano Aprovado" })] }) })); } ; const mockPlan = { _id: '64f8b2a3c1d2e3f4a5b6c7d8', controller: { last_hash: 'abcdef1234567890', status: 'complete', timestamp: 1715328000, }, created_at: 1715328000, gtfs_agency: { agency_id: 'TML001', agency_name: 'Transportes Metropolitanos de Lisboa', agency_timezone: 'Europe/Lisbon', }, gtfs_feed_info: { feed_end_date: '20241231', feed_lang: 'pt', feed_start_date: '20240101', }, hash: '1234567890', is_locked: false, operation_file_id: '64f8b2a3c1d2e3f4a5b6c7d9', pcgi_legacy: { operation_plan_id: '123', }, status_merger: 'complete', updated_at: 1715328000, }; PlanApprovedEmail.PreviewProps = { first_name: 'Josué', plan: mockPlan, }; export default PlanApprovedEmail;