81 lines
2.1 KiB
TypeScript
81 lines
2.1 KiB
TypeScript
import {
|
|
Body,
|
|
Head,
|
|
Html,
|
|
Preview,
|
|
Tailwind,
|
|
Text,
|
|
render,
|
|
} from '@react-email/components';
|
|
|
|
import { BodyStyle } from '../components/body-style';
|
|
import CommonFooter from '../components/common-footer';
|
|
import { EmailContent } from '../components/content';
|
|
import { EmailButton } from '../components/email-button';
|
|
import { EmailHeader } from '../components/header';
|
|
import { EmailHeading } from '../components/heading';
|
|
import { EmailWrapper } from '../components/wrapper';
|
|
import { initializeEmailI18n } from '../lib/i18n';
|
|
|
|
export async function renderAllResultsReceivedEmail({
|
|
language,
|
|
analysisResponseId,
|
|
}: {
|
|
language: string;
|
|
analysisResponseId: number;
|
|
}) {
|
|
const namespace = 'all-results-received-email';
|
|
|
|
const { t } = await initializeEmailI18n({
|
|
language,
|
|
namespace: [namespace, 'common'],
|
|
});
|
|
|
|
const previewText = t(`${namespace}:previewText`);
|
|
|
|
const subject = t(`${namespace}:subject`);
|
|
|
|
const html = await render(
|
|
<Html>
|
|
<Head>
|
|
<BodyStyle />
|
|
</Head>
|
|
|
|
<Preview>{previewText}</Preview>
|
|
|
|
<Tailwind>
|
|
<Body>
|
|
<EmailWrapper>
|
|
<EmailContent>
|
|
<EmailHeader>
|
|
<EmailHeading>{previewText}</EmailHeading>
|
|
</EmailHeader>
|
|
<Text className="text-[16px] leading-[24px] text-[#242424]">
|
|
{t(`${namespace}:hello`)}
|
|
</Text>
|
|
<Text className="text-[16px] leading-[24px] font-semibold text-[#242424]">
|
|
{t(`${namespace}:openOrdersHeading`)}
|
|
</Text>
|
|
<EmailButton
|
|
href={`${process.env.NEXT_PUBLIC_SITE_URL}/doctor/analysis/${analysisResponseId}`}
|
|
>
|
|
{t(`${namespace}:linkText`)}
|
|
</EmailButton>
|
|
<Text>
|
|
{t(`${namespace}:ifLinksDisabled`)}{' '}
|
|
{`${process.env.NEXT_PUBLIC_SITE_URL}/doctor/analysis/${analysisResponseId}`}
|
|
</Text>
|
|
<CommonFooter t={t} />
|
|
</EmailContent>
|
|
</EmailWrapper>
|
|
</Body>
|
|
</Tailwind>
|
|
</Html>,
|
|
);
|
|
|
|
return {
|
|
html,
|
|
subject,
|
|
};
|
|
}
|