From 41535a68be91232818fcac00c0991db25d76dc05 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 11 Sep 2025 16:00:10 +0200 Subject: [PATCH] Improve email UI --- backend/email/emails/functions/helpers.tsx | 4 + backend/email/emails/functions/send-email.ts | 2 +- backend/email/emails/new-endorsement.tsx | 129 ++++--------------- backend/email/emails/new-match.tsx | 102 +++++---------- backend/email/emails/new-message.tsx | 96 ++------------ backend/email/emails/test.tsx | 2 +- backend/email/emails/utils.tsx | 118 +++++++++++++++++ backend/email/package.json | 1 + 8 files changed, 197 insertions(+), 257 deletions(-) create mode 100644 backend/email/emails/utils.tsx diff --git a/backend/email/emails/functions/helpers.tsx b/backend/email/emails/functions/helpers.tsx index 49685064..e8b2102f 100644 --- a/backend/email/emails/functions/helpers.tsx +++ b/backend/email/emails/functions/helpers.tsx @@ -29,6 +29,7 @@ export const sendNewMatchEmail = async ( react: ( ), }) @@ -82,6 +84,7 @@ export const sendNewMessageEmail = async ( toUser={toUser} channelId={channelId} unsubscribeUrl={unsubscribeUrl} + email={privateUser.email} /> ), }) @@ -109,6 +112,7 @@ export const sendNewEndorsementEmail = async ( onUser={onUser} endorsementText={text} unsubscribeUrl={unsubscribeUrl} + email={privateUser.email} /> ), }) diff --git a/backend/email/emails/functions/send-email.ts b/backend/email/emails/functions/send-email.ts index 4c617242..818bd71d 100644 --- a/backend/email/emails/functions/send-email.ts +++ b/backend/email/emails/functions/send-email.ts @@ -37,7 +37,7 @@ const getResend = () => { if (resend) return resend const apiKey = process.env.RESEND_KEY as string - console.log(`RESEND_KEY: ${apiKey}`) + // console.log(`RESEND_KEY: ${apiKey}`) resend = new Resend(apiKey) return resend } diff --git a/backend/email/emails/new-endorsement.tsx b/backend/email/emails/new-endorsement.tsx index cdecd00e..93dc9175 100644 --- a/backend/email/emails/new-endorsement.tsx +++ b/backend/email/emails/new-endorsement.tsx @@ -1,41 +1,31 @@ -import { - Body, - Button, - Container, - Column, - Head, - Html, - Img, - Link, - Preview, - Row, - Section, - Text, -} from '@react-email/components' -import { type User } from 'common/user' -import { DOMAIN } from 'common/envs/constants' -import { jamesUser, sinclairUser } from './functions/mock' +import {Body, Button, Column, Container, Head, Html, Preview, Row, Section, Text,} from '@react-email/components' +import {type User} from 'common/user' +import {DOMAIN} from 'common/envs/constants' +import {jamesUser, sinclairUser} from './functions/mock' +import {button, container, content, Footer, main, paragraph} from "email/utils"; interface NewEndorsementEmailProps { fromUser: User onUser: User endorsementText: string unsubscribeUrl: string + email?: string } export const NewEndorsementEmail = ({ - fromUser, - onUser, - endorsementText, - unsubscribeUrl, -}: NewEndorsementEmailProps) => { + fromUser, + onUser, + endorsementText, + unsubscribeUrl, + email, + }: NewEndorsementEmailProps) => { const name = onUser.name.split(' ')[0] const endorsementUrl = `https://${DOMAIN}/${onUser.username}` return ( - + New endorsement from {fromUser.name} @@ -55,15 +45,15 @@ export const NewEndorsementEmail = ({
- - - + {/**/} + {/* */} + {/**/} "{endorsementText}" @@ -75,15 +65,7 @@ export const NewEndorsementEmail = ({
-
- - This e-mail has been sent to {name},{' '} - {/* - click here to unsubscribe from this type of notification - - . */} - -
+