import { Heading, Section, Text } from '@react-email/components'; import { EmailLayout } from './components/EmailLayout'; import { Button } from './components/Button'; import { StatusBanner } from './components/StatusBanner'; import { styles } from './components/styles'; import { tCommon } from './i18n/common'; import { tTemplate } from './i18n/templates'; import { resolveLocale, type Locale } from './i18n/types'; import { interpolate } from './utils/interpolate'; import { theme } from './theme'; export interface PrescriptionDecisionEmailProps { locale?: Locale; userName?: string; rxId?: string; decision?: 'approved' | 'rejected'; note?: string; ctaUrl?: string; } export const PrescriptionDecisionEmail = ({ locale, userName = 'Abebe Kebede', rxId = 'RX-5521', decision = 'approved', note = 'All items are available at Bole Branch.', ctaUrl = `${theme.brand.website}/prescriptions/${rxId}`, }: PrescriptionDecisionEmailProps) => { const l = resolveLocale(locale); const t = tTemplate('prescription-decision', l); const common = tCommon(l); const decisionLabel = decision === 'approved' ? (l === 'am' ? 'ጸድቋል' : 'approved') : (l === 'am' ? 'ተቀባይነት አላገኘም' : 'rejected'); const banner = decision === 'approved' ? t.approvedBanner : t.rejectedBanner; return ( {banner} {interpolate(t.heading, { decision: decisionLabel })} {interpolate(t.body1, { userName, rxId, decision: decisionLabel, note })}
{common.regards}
{common.team}
); }; PrescriptionDecisionEmail.PreviewProps = { locale: 'en', decision: 'approved' } as PrescriptionDecisionEmailProps; export default PrescriptionDecisionEmail;