This commit is contained in:
 Илья Шалонин 2025-10-29 13:43:43 +05:00
commit 8538ab969a
434 changed files with 44051 additions and 0 deletions

View file

@ -0,0 +1,48 @@
import { Link, Text } from "@react-email/components";
import React from "react";
import { createTranslator } from "use-intl/core";
import PrimaryButton from "../src/components/PrimaryButton";
import Wrapper from "../src/components/Wrapper";
import { defaultLocale, defaultTranslations } from "../src/util/translations";
import type { BaseMailProps } from "../types";
export function EmailVerification({
url,
name,
locale,
translations,
}: {
url: string;
name: string;
} & BaseMailProps) {
const t = createTranslator({
locale,
messages: translations,
});
return (
<Wrapper>
<Text>{t("mail.emailVerification.body", { name })}</Text>
<PrimaryButton href={url}>
{t("mail.emailVerification.confirmEmail")} &rarr;
</PrimaryButton>
<Text className="text-muted-foreground text-sm">
{t("mail.common.openLinkInBrowser")}
<Link href={url} className="break-all">
{url}
</Link>
</Text>
</Wrapper>
);
}
EmailVerification.PreviewProps = {
locale: defaultLocale,
translations: defaultTranslations,
url: "#",
name: "John Doe",
};
export default EmailVerification;

View file

@ -0,0 +1,46 @@
import { Link, Text } from "@react-email/components";
import React from "react";
import { createTranslator } from "use-intl/core";
import PrimaryButton from "../src/components/PrimaryButton";
import Wrapper from "../src/components/Wrapper";
import { defaultLocale } from "../src/util/translations";
import { defaultTranslations } from "../src/util/translations";
import type { BaseMailProps } from "../types";
export function ForgotPassword({
url,
locale,
translations,
}: {
url: string;
name: string;
} & BaseMailProps) {
const t = createTranslator({
locale,
messages: translations,
});
return (
<Wrapper>
<Text>{t("mail.forgotPassword.body")}</Text>
<PrimaryButton href={url}>
{t("mail.forgotPassword.resetPassword")} &rarr;
</PrimaryButton>
<Text className="text-muted-foreground text-sm">
{t("mail.common.openLinkInBrowser")}
<Link href={url}>{url}</Link>
</Text>
</Wrapper>
);
}
ForgotPassword.PreviewProps = {
locale: defaultLocale,
translations: defaultTranslations,
url: "#",
name: "John Doe",
};
export default ForgotPassword;

View file

@ -0,0 +1,46 @@
import { Link, Text } from "@react-email/components";
import React from "react";
import { createTranslator } from "use-intl/core";
import PrimaryButton from "../src/components/PrimaryButton";
import Wrapper from "../src/components/Wrapper";
import { defaultTranslations } from "../src/util/translations";
import { defaultLocale } from "../src/util/translations";
import type { BaseMailProps } from "../types";
export function MagicLink({
url,
locale,
translations,
}: {
url: string;
} & BaseMailProps) {
const t = createTranslator({
locale,
messages: translations,
});
return (
<Wrapper>
<Text>{t("mail.magicLink.body")}</Text>
<Text>{t("mail.common.useLink")}</Text>
<PrimaryButton href={url}>
{t("mail.magicLink.login")} &rarr;
</PrimaryButton>
<Text className="text-muted-foreground text-sm">
{t("mail.common.openLinkInBrowser")}
<Link href={url}>{url}</Link>
</Text>
</Wrapper>
);
}
MagicLink.PreviewProps = {
locale: defaultLocale,
translations: defaultTranslations,
url: "#",
};
export default MagicLink;

View file

@ -0,0 +1,58 @@
import { Link, Text } from "@react-email/components";
import React from "react";
import { createTranslator } from "use-intl/core";
import PrimaryButton from "../src/components/PrimaryButton";
import Wrapper from "../src/components/Wrapper";
import { defaultTranslations } from "../src/util/translations";
import { defaultLocale } from "../src/util/translations";
import type { BaseMailProps } from "../types";
export function NewUser({
url,
name,
otp,
locale,
translations,
}: {
url: string;
name: string;
otp: string;
} & BaseMailProps) {
const t = createTranslator({
locale,
messages: translations,
});
return (
<Wrapper>
<Text>{t("mail.newUser.body", { name })}</Text>
<Text>
{t("mail.common.otp")}
<br />
<strong className="font-bold text-2xl">{otp}</strong>
</Text>
<Text>{t("mail.common.useLink")}</Text>
<PrimaryButton href={url}>
{t("mail.newUser.confirmEmail")} &rarr;
</PrimaryButton>
<Text className="text-muted-foreground text-sm">
{t("mail.common.openLinkInBrowser")}
<Link href={url}>{url}</Link>
</Text>
</Wrapper>
);
}
NewUser.PreviewProps = {
locale: defaultLocale,
translations: defaultTranslations,
url: "#",
name: "John Doe",
otp: "123456",
};
export default NewUser;

View file

@ -0,0 +1,30 @@
import { Heading, Text } from "@react-email/components";
import React from "react";
import { createTranslator } from "use-intl/core";
import Wrapper from "../src/components/Wrapper";
import { defaultTranslations } from "../src/util/translations";
import { defaultLocale } from "../src/util/translations";
import type { BaseMailProps } from "../types";
export function NewsletterSignup({ locale, translations }: BaseMailProps) {
const t = createTranslator({
locale,
messages: translations,
});
return (
<Wrapper>
<Heading className="text-xl">
{t("mail.newsletterSignup.subject")}
</Heading>
<Text>{t("mail.newsletterSignup.body")}</Text>
</Wrapper>
);
}
NewsletterSignup.PreviewProps = {
locale: defaultLocale,
translations: defaultTranslations,
};
export default NewsletterSignup;

View file

@ -0,0 +1,55 @@
import { Heading, Link, Text } from "@react-email/components";
import React from "react";
import { createTranslator } from "use-intl/core";
import PrimaryButton from "../src/components/PrimaryButton";
import Wrapper from "../src/components/Wrapper";
import { defaultLocale } from "../src/util/translations";
import { defaultTranslations } from "../src/util/translations";
import type { BaseMailProps } from "../types";
export function OrganizationInvitation({
url,
organizationName,
locale,
translations,
}: {
url: string;
organizationName: string;
} & BaseMailProps) {
const t = createTranslator({
locale,
messages: translations,
});
return (
<Wrapper>
<Heading className="text-xl">
{t.markup("mail.organizationInvitation.headline", {
organizationName,
strong: (chunks) => `<strong>${chunks}</strong>`,
})}
</Heading>
<Text>
{t("mail.organizationInvitation.body", { organizationName })}
</Text>
<PrimaryButton href={url}>
{t("mail.organizationInvitation.join")}
</PrimaryButton>
<Text className="mt-4 text-muted-foreground text-sm">
{t("mail.common.openLinkInBrowser")}
<Link href={url}>{url}</Link>
</Text>
</Wrapper>
);
}
OrganizationInvitation.PreviewProps = {
locale: defaultLocale,
translations: defaultTranslations,
url: "#",
organizationName: "Acme",
};
export default OrganizationInvitation;

View file

@ -0,0 +1,15 @@
import { EmailVerification } from "../emails/EmailVerification";
import { ForgotPassword } from "../emails/ForgotPassword";
import { MagicLink } from "../emails/MagicLink";
import { NewUser } from "../emails/NewUser";
import { NewsletterSignup } from "../emails/NewsletterSignup";
import { OrganizationInvitation } from "../emails/OrganizationInvitation";
export const mailTemplates = {
magicLink: MagicLink,
forgotPassword: ForgotPassword,
newUser: NewUser,
newsletterSignup: NewsletterSignup,
organizationInvitation: OrganizationInvitation,
emailVerification: EmailVerification,
} as const;