Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emailer: Load HTML templates from S3 #334

Closed
wants to merge 21 commits into from
Closed

Conversation

CiciLing
Copy link
Contributor

Checklist

  • 1. Run yarn run check
  • 2. Run yarn run test

Why

Resolves #259

This allows the user to choose the email template and apply it to the email they're sending. The user can make edits to the template.

This PR

We passed in a form instance to sendEmailForm/index.tsx from email/index.tsx.

Screenshots

Screenshot 2024-03-17 at 1 02 15 PM (1)

Verification Steps

Choose the template from the select template dropdown and a template in html should appear in the email body.

CiciLing and others added 20 commits February 11, 2024 15:24
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.2.7 to 12.1.5.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/main/CHANGELOG.md)
- [Commits](testing-library/react-testing-library@v11.2.7...v12.1.5)

---
updated-dependencies:
- dependency-name: "@testing-library/react"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [@types/react-csv](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-csv) from 1.1.3 to 1.1.10.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-csv)

---
updated-dependencies:
- dependency-name: "@types/react-csv"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
emails,
sendEmailForm,
}) => {
const SendEmailForm: React.FC<SendEmailFormProps> = ({ emails }) => {
Copy link
Contributor

@huang0h huang0h Mar 20, 2024

Choose a reason for hiding this comment

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

⛏️ Looks like you have some errors (from merging) - make sure to get rid of this extra declaration of the SendEmailForm component!

Copy link
Contributor

@huang0h huang0h Mar 20, 2024

Choose a reason for hiding this comment

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

Also make sure to remove line 50:
const [sendEmailForm] = Form.useForm();
since we're passing the form instance as a prop now (I can't comment on it since it's an unchanged line 😞)

name="emailContent"
rows={6}
placeholder={'Email Body'}
/>
<Input.TextArea rows={8} placeholder={t('body_placeholder')} />
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ Can we also remove this extra TextArea? There's two text areas here:

image

setTemplateNames(res.templates);
})
.catch((err) => {
setTemplateNames([defaultTemplate]);
Copy link
Contributor

@huang0h huang0h Mar 20, 2024

Choose a reason for hiding this comment

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

⛏️ Can we add an error message here in the catch (same for fetchTemplateData)? Something like the message.error() call in this function would do - if something fails on our end, it's better to explicitly tell the user that an error happened than to fail silently and have them guess at why something's not working

Copy link
Contributor

@huang0h huang0h left a comment

Choose a reason for hiding this comment

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

Overall looks good! Just have a few small comments

@CerberusLatrans
Copy link
Contributor

Screenshot 2024-03-31 at 7 04 15 PM tested error message when loading empty html

@CerberusLatrans CerberusLatrans requested a review from huang0h March 31, 2024 23:04
Copy link
Contributor

@huang0h huang0h left a comment

Choose a reason for hiding this comment

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

lgtm, nice work! A couple extra notes:

  • You might need to just re-run the build checks to get them to pass
  • When you merge, I suggest choosing the "squash and merge" option (see pic) from the dropdown - if you're not familiar with this, it'll basically combine all of your commits on this branch into a single commit that gets merged into master. This way the commit history doesn't get clogged up with your commits from while you were working

image

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.

Emailer: Load HTML templates from S3
3 participants