File tree Expand file tree Collapse file tree 14 files changed +94
-108
lines changed
Expand file tree Collapse file tree 14 files changed +94
-108
lines changed Original file line number Diff line number Diff line change 11'use server' ;
22
33import { Resend } from 'resend' ;
4- import Pricing from '@/emails/pricing' ;
5- import type { Locale } from '@/lib/i18n/i18n' ;
4+ import WelcomeEmail from '@/emails/welcome' ;
5+ import type { Locale } from '@/i18n/i18n' ;
6+ import { getT } from '@/i18n/get-t' ;
67
78export async function sendEmail ( locale : Locale ) {
89 const resend = new Resend ( process . env . RESEND_API_KEY ) ;
910
11+ const { t } = await getT ( 'welcome' , locale ) ;
12+
1013 const response = await resend . emails . send ( {
1114 from : 'Acme <onboarding@resend.dev>' ,
1215 to : [ 'delivered@resend.dev' ] ,
13- subject : 'Pricing discount' ,
14- react : < Pricing locale = { locale } /> ,
16+ subject : t ( 'header' ) ,
17+ react : < WelcomeEmail name = "John Lennon" locale = { locale } /> ,
1518 } ) ;
1619
1720 if ( response . error ) {
Original file line number Diff line number Diff line change 11import { notFound } from 'next/navigation' ;
22import { sendEmail } from '@/actions/send-email' ;
3- import { type Locale , validLocales } from '@/lib/ i18n/i18n' ;
4- import { getT } from '@/lib/ i18n/get-t' ;
3+ import { type Locale , validLocales } from '@/i18n/i18n' ;
4+ import { getT } from '@/i18n/get-t' ;
55
66export function generateStaticParams ( ) {
77 return validLocales . map ( ( locale ) => ( { locale } ) ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import {
2+ Body ,
3+ Button ,
4+ Container ,
5+ Head ,
6+ Heading ,
7+ Hr ,
8+ Html ,
9+ Preview ,
10+ Section ,
11+ Tailwind ,
12+ Text ,
13+ } from '@react-email/components' ;
14+ import { getT } from '@/i18n/get-t' ;
15+ import type { Locale } from '@/i18n/i18n' ;
16+
17+ interface WelcomeProps {
18+ locale : Locale ;
19+ name : string ;
20+ }
21+
22+ export default async function WelcomeEmail ( { locale, name } : WelcomeProps ) {
23+ const { t } = await getT ( 'welcome-email' , locale ) ;
24+
25+ return (
26+ < Html >
27+ < Head />
28+ < Preview > { t ( 'header' ) } </ Preview >
29+ < Tailwind >
30+ < Body className = "bg-gray-100 font-sans" >
31+ < Container className = "mx-auto py-10 px-5" >
32+ < Section className = "bg-white rounded-lg p-8" >
33+ < Heading className = "text-2xl font-bold text-gray-900 m-0 mb-6" >
34+ { t ( 'header' ) }
35+ </ Heading >
36+ < Text className = "text-base leading-6 text-gray-600 m-0 mb-4" >
37+ { t ( 'hi' ) } { name }
38+ </ Text >
39+ < Text className = "text-base leading-6 text-gray-600 m-0 mb-4" >
40+ { t ( 'thanks' ) }
41+ </ Text >
42+ < Button
43+ href = "https://example.com/dashboard"
44+ className = "bg-indigo-600 rounded-md text-white text-base font-semibold no-underline text-center block py-3 px-6 my-6"
45+ >
46+ { t ( 'get-started' ) }
47+ </ Button >
48+ < Hr className = "border-gray-200 my-6" />
49+ < Text className = "text-sm text-gray-400 m-0" >
50+ { t ( 'questions' ) }
51+ </ Text >
52+ </ Section >
53+ </ Container >
54+ </ Body >
55+ </ Tailwind >
56+ </ Html >
57+ ) ;
58+ }
59+
60+ WelcomeEmail . PreviewProps = {
61+ locale : 'en' ,
62+ name : 'John Lennon' ,
63+ } ;
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ {
2+ "header" : " Welcome to Acme" ,
3+ "hi" : " Hi" ,
4+ "thanks" : " Thanks for signing up! We're excited to have you on board." ,
5+ "get-started" : " Get Started" ,
6+ "questions" : " If you have any questions, reply to this email. We're here to help!"
7+ }
Original file line number Diff line number Diff line change 1+ {
2+ "header" : " Bienvenido a Acme" ,
3+ "hi" : " Hola" ,
4+ "thanks" : " Gracias por registrarte! Estamos emocionados de tenerte en la plataforma." ,
5+ "get-started" : " Comenzar" ,
6+ "questions" : " Si tienes alguna pregunta, responde a este correo electrónico. Estamos aquí para ayudarte!"
7+ }
Original file line number Diff line number Diff line change 11{
2- "email.preview" : " Oferta Exclusiva Só Para Você: Desbloqueie Funcionalidades com $12/mês" ,
2+ " " " email.preview" : " Oferta Exclusiva Só Para Você: Desbloqueie Funcionalidades com $12/mês" ,
33 "email.exclusive-offer" : " Oferta Exclusiva" ,
44 "email.per-month" : " / mês" ,
55 "email.copy" : " Criamos o plano perfeito especialmente adaptado às suas necessidades. Desbloqueie recursos premium com um valor imbatível." ,
Original file line number Diff line number Diff line change 1+ {
2+ "header" : " Bem-vindo à Acme" ,
3+ "hi" : " Olá" ,
4+ "thanks" : " Obrigado por se inscrever! Estamos animados em tê-lo conosco." ,
5+ "get-started" : " Começar" ,
6+ "questions" : " Se você tiver alguma dúvida, responda a este e-mail. Estamos aqui para ajudar!"
7+ }
You can’t perform that action at this time.
0 commit comments