import { Heading, Section, Text, Img, } from '@react-email/components'; import { EmailLayout } from './components/EmailLayout'; import { Card } from './components/Card'; import { Button } from './components/Button'; import { theme } from './theme'; interface EventTicketEmailProps { userName?: string; eventName?: string; eventDate?: string; eventTime?: string; venue?: string; ticketType?: string; amount?: string; qrCodeUrl?: string; ticketNumber?: string; orderId?: string; purchaseDate?: string; seatNumber?: string; section?: string; baseUrl?: string; } export const EventTicketEmail = ({ userName = 'Kirubel', eventName = 'Summer Music Festival 2024', eventDate = 'July 15, 2024', eventTime = '7:00 PM', venue = 'City Park Amphitheater', ticketType = 'General Admission', amount = '$75.00', qrCodeUrl = 'https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=EVENT-TICKET-12345', ticketNumber = 'EVT-12345', orderId = 'ORD-12345', purchaseDate = new Date().toLocaleDateString(), seatNumber, section, baseUrl = 'http://localhost:3000', }: EventTicketEmailProps) => { // Generate PDF download URL const pdfUrl = new URL(`${baseUrl}/api/ticket-pdf`); pdfUrl.searchParams.set('userName', userName); pdfUrl.searchParams.set('eventName', eventName); pdfUrl.searchParams.set('eventDate', eventDate); pdfUrl.searchParams.set('eventTime', eventTime); pdfUrl.searchParams.set('venue', venue); pdfUrl.searchParams.set('ticketType', ticketType); pdfUrl.searchParams.set('amount', amount); pdfUrl.searchParams.set('ticketNumber', ticketNumber); if (orderId) pdfUrl.searchParams.set('orderId', orderId); if (purchaseDate) pdfUrl.searchParams.set('purchaseDate', purchaseDate); if (seatNumber) pdfUrl.searchParams.set('seatNumber', seatNumber); if (section) pdfUrl.searchParams.set('section', section); return (
Your Event Ticket is Ready! 🎫 Hi {userName}, Thank you for your purchase! Your ticket for {eventName} has been confirmed. Please find your ticket details below.
{eventName}
Date: {eventDate}
Time: {eventTime}
Venue: {venue}
Ticket Type: {ticketType}
Ticket Number: {ticketNumber}
Amount Paid: {amount}
Your QR Code Ticket Present this QR code at the venue entrance for quick access:
QR Code
Save this email or take a screenshot for easy access at the event.
📄 Download Your Ticket PDF Get a detailed PDF version of your ticket with all information and QR code for easy access and printing.
We're excited to see you at the event! Best regards,
The Amba Team
); }; const heading = { color: theme.colors.primary, fontSize: '28px', fontWeight: '700', margin: '0 0 24px', }; const text = { color: theme.colors.textDark, fontSize: '16px', lineHeight: '24px', margin: '0 0 16px', }; const ticketInfo = { padding: '0', }; const eventTitle = { color: theme.colors.primary, fontSize: '20px', fontWeight: '700', margin: '0 0 20px', textAlign: 'center' as const, }; const detailRow = { display: 'flex', justifyContent: 'space-between', marginBottom: '12px', paddingBottom: '12px', borderBottom: `1px solid ${theme.colors.border}`, }; const detailLabel = { color: theme.colors.text, fontSize: '14px', fontWeight: '600', margin: '0', flex: '1', }; const detailValue = { color: theme.colors.textDark, fontSize: '14px', margin: '0', textAlign: 'right' as const, flex: '1', }; const qrSection = { textAlign: 'center' as const, margin: '32px 0', padding: '24px', backgroundColor: theme.colors.background, borderRadius: '8px', border: `2px solid ${theme.colors.accent}`, }; const qrTitle = { color: theme.colors.primary, fontSize: '18px', fontWeight: '600', margin: '0 0 8px', }; const qrInstructions = { color: theme.colors.textDark, fontSize: '14px', margin: '0 0 16px', }; const qrCodeContainer = { textAlign: 'center' as const, margin: '16px 0', }; const qrCode = { margin: '0 auto', border: `2px solid ${theme.colors.border}`, borderRadius: '8px', padding: '8px', backgroundColor: theme.colors.background, }; const qrNote = { color: theme.colors.text, fontSize: '12px', margin: '16px 0 0', fontStyle: 'italic', }; const buttonSection = { textAlign: 'center' as const, margin: '32px 0', }; const pdfSection = { textAlign: 'center' as const, margin: '32px 0', padding: '24px', backgroundColor: theme.colors.primaryLightest, borderRadius: '8px', border: `2px solid ${theme.colors.primary}`, }; const pdfTitle = { color: theme.colors.primary, fontSize: '20px', fontWeight: '700', margin: '0 0 12px', }; const pdfDescription = { color: theme.colors.textDark, fontSize: '14px', lineHeight: '20px', margin: '0 0 20px', }; EventTicketEmail.PreviewProps = { userName: 'Kirubel', eventName: 'Summer Music Festival 2024', eventDate: 'July 15, 2024', eventTime: '7:00 PM', venue: 'City Park Amphitheater', ticketType: 'General Admission', amount: '$75.00', qrCodeUrl: 'https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=EVENT-TICKET-12345', ticketNumber: 'EVT-12345', orderId: 'ORD-12345', purchaseDate: new Date().toLocaleDateString(), baseUrl: 'http://localhost:3000', } as EventTicketEmailProps; export default EventTicketEmail;