| 1 | import { Text } from '@react-email/components' |
| 2 | import { env } from '@/env' |
| 3 | import { |
| 4 | ActionButton, |
| 5 | EmailLayout, |
| 6 | InfoCard, |
| 7 | InfoRow, |
| 8 | text, |
| 9 | } from '../components/layout' |
| 10 | |
| 11 | const baseUrl = env.NEXT_PUBLIC_BASE_URL ?? 'http://localhost:3000' |
| 12 | |
| 13 | interface InvoiceDisputedEmailProps { |
| 14 | currency: string |
| 15 | disputedByName: string |
| 16 | invoiceId: string |
| 17 | invoiceNumber: string |
| 18 | orgSlug: string |
| 19 | projectName: string |
| 20 | projectSlug: string |
| 21 | recipientName: string |
| 22 | totalAmount: string |
| 23 | } |
| 24 | |
| 25 | export default function InvoiceDisputedEmail({ |
| 26 | invoiceNumber = 'INV-2026-001', |
| 27 | projectName = 'Website Redesign', |
| 28 | disputedByName = 'Jane Smith', |
| 29 | totalAmount = '2,500.00', |
| 30 | currency = 'USD', |
| 31 | orgSlug = 'acme', |
| 32 | projectSlug = 'website-redesign', |
| 33 | invoiceId = 'inv_abc123', |
| 34 | }: InvoiceDisputedEmailProps) { |
| 35 | return ( |
| 36 | <EmailLayout |
| 37 | accentColor='#ef4444' |
| 38 | heading='Invoice needs attention' |
| 39 | preview={`${disputedByName} raised a question about invoice ${invoiceNumber}`} |
| 40 | > |
| 41 | <Text style={text.paragraph}> |
| 42 | <span style={text.strong}>{disputedByName}</span> started a discussion |
| 43 | on invoice <span style={text.strong}>{invoiceNumber}</span> for{' '} |
| 44 | {projectName}. |
| 45 | </Text> |
| 46 | <InfoCard> |
| 47 | <InfoRow label='Invoice' value={invoiceNumber} /> |
| 48 | <InfoRow label='Amount' value={`${currency} ${totalAmount}`} /> |
| 49 | </InfoCard> |
| 50 | <Text style={text.muted}> |
| 51 | Check the invoice thread to address any questions and resolve the |
| 52 | dispute. |
| 53 | </Text> |
| 54 | <ActionButton |
| 55 | color='#ef4444' |
| 56 | href={`${baseUrl}/${orgSlug}/${projectSlug}/invoices/${invoiceId}`} |
| 57 | > |
| 58 | View Discussion |
| 59 | </ActionButton> |
| 60 | </EmailLayout> |
| 61 | ) |
| 62 | } |