Gishen-Email-Template/emails/prescription-decision.tsx
Kirubel-Kibru-Yaltopia f9fa3bc83b feat: add Gishen React Email demo with en/am templates
Ship 23 transactional templates, shared brand tokens/logo, preview UI,
render API, CHANGELOG, and docs for Ecom/Admin/B2B consumers.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 22:12:21 +03:00

51 lines
2.1 KiB
TypeScript

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 (
<EmailLayout preview={interpolate(t.preview, { rxId, decision: decisionLabel })} locale={l}>
<StatusBanner tone={decision === 'approved' ? 'success' : 'danger'}>{banner}</StatusBanner>
<Heading style={styles.heading}>{interpolate(t.heading, { decision: decisionLabel })}</Heading>
<Text style={styles.text}>{interpolate(t.body1, { userName, rxId, decision: decisionLabel, note })}</Text>
<Section style={styles.buttonSection}>
<Button href={ctaUrl}>{t.cta}</Button>
</Section>
<Text style={styles.muted}>{common.regards}<br />{common.team}</Text>
</EmailLayout>
);
};
PrescriptionDecisionEmail.PreviewProps = { locale: 'en', decision: 'approved' } as PrescriptionDecisionEmailProps;
export default PrescriptionDecisionEmail;