Skip to content

Comments

DEV-332 Email Templates#71

Open
12chenec wants to merge 5 commits intomainfrom
emailtemplates
Open

DEV-332 Email Templates#71
12chenec wants to merge 5 commits intomainfrom
emailtemplates

Conversation

@12chenec
Copy link

References

Proposed Changes

  • added email templates functionality
  • frontend: email template cards
  • backend: template selector
  • clicking on a template card will paste the template (saved in emailTemplates.ts) into the editor
  • if the editor isn't empty, a prompt will ask to confirm to replace text

@linear
Copy link

linear bot commented Feb 11, 2026

DEV-332 Email Templates

@vercel
Copy link

vercel bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mail Ready Ready Preview, Comment Feb 24, 2026 6:49pm

Request Review

Copy link
Contributor

@jfmath04 jfmath04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yayy good work!! It looks great and the templates work nicely :) A couple things to review:

  • Run Prettier and ESLint!!!!!
  • Address the ESLint errors and warnings
  • The page seems to jump down to the templates when loaded instead of being at the top of the page. It'd be good to investigate that and fix it.
  • Create a folder under components/MailForm to put the template files you made
  • Rather than comparing the whole editor text, keep a state to detect whether it has been edited after a template is loaded.
  • Remove the types and create a map to store the email templates

Comment on lines 76 to 88
const normalize = (s: string | undefined | null) =>
(s || '')
.replace(/ /g, ' ')
.replace(/<[^>]*>/g, '')
.trim();
const hasEditorContent = normalize(body) !== '';
const wouldChangeBody = normalize(template.bodyTemplate) !== normalize(body);

if (hasEditorContent && wouldChangeBody) {
setPendingTemplate(type);
setShowReplaceConfirm(true);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, I think we should change this to have a state detecting whether the user has typed after selecting a template. This makes it so that if they are just browsing the templates without changing them, the confirmation doesn't pop up.

Copy link
Contributor

@jfmath04 jfmath04 Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than creating a type, it might be easier to use a map so that in SendForm.tsx on line 74 we don't need to search the whole list for the correct template. We can just look up the template name and get the corresponding template.

Also, let's move this to a new folder under components/MailForm/Templates or whatever you'd like to call the folder

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this file to a new folder under components/MailForm/Templates or whatever you'd like to call the folder. Same with emailTemplates.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants