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

Alex/implement email notification functionality #464

Open
wants to merge 69 commits into
base: develop
Choose a base branch
from

Conversation

alexappleget
Copy link
Contributor

@alexappleget alexappleget commented Aug 15, 2024

Closes #463

Create functionality for email notifications into the project for the admin notifications page.

ONCE this ticket gets merged in, I will create more tickets to implement more customization for sending emails. Ex: survivors only email, eliminated. For now, only participants is created to test that the email function does take in id's and sends an email.

  1. Used Appwrite's Messaging in order to be able to send email notifications.
  2. In order to use Appwrite Messaging we need an email provider that's compatible with Appwrite.
  3. I went with Mailgun as the email provider because they have a free version for us for testing.
  4. I connected Mailgun to Appwrite Messaging in order to use createEmail() for our code.
  5. createEmail() from Appwrite is a backend only function, so I had to create a 'use server' action file to build out the client and create a function to use the createEmail() function inside of it.
  6. Since createEmail() is a server function, I used form submission in order to get it to work on the frontend the way we want.
  7. Did seperate testing for the client side and then for the server side because the server and client can't crossover.
  8. Had to mock the server function inside the client testing because jest isn't configured to parse it.
  9. All tests pass and the inputs send an email.
Recording.2024-08-19.143407.mp4

Copy link

appwrite bot commented Aug 15, 2024

Gridiron Survivor Application 6616ea581ef9f5521c7d

Function ID Status Action
Your function has been successfully deployed.

Project name: Gridiron Survivor Application
Project ID: 6616ea581ef9f5521c7d

Function ID Status Action
userAuth 6626fef885a9f630442b ready Ready View Logs

Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to your deployments. Learn more about Appwrite Function deployments.

💡 Did you know?
Appwrite has a Discord community with over 16 000 members. Come join us!

Copy link

vercel bot commented Aug 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gridiron-survivor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 20, 2024 3:15pm
gridiron-survivor-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 20, 2024 3:15pm

…nality" and "origin/alex/implement-email-notification-functionality"

Fix: Deleted userIDs from function to avoid getting spammed
…he league info and then grab the targetIDs of the users.
textAreaRef.style.height = `${scrollHeight + offsetBorder}px`;
}
}
}, [textAreaRef, triggerAutoSize]);
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens when we remove textAreaRef and/or triggerAutoSize from useEffect dependencies here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we don't need to re-render the component, this will cause unnecessary re-renders.

Comment on lines +29 to +34
if (textAreaRef) {
if (init) {
textAreaRef.style.minHeight = `${minHeight + offsetBorder}px`;
if (maxHeight > minHeight) {
textAreaRef.style.maxHeight = `${maxHeight}px`;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these if statement nestings necessary, or are there ways we can combine some of them into one if conditional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be a question for Ryan. These were his changes made that got merged into my branch after approval.

textAreaRef.style.height = `${scrollHeight + offsetBorder}px`;
}
}
}, [textAreaRef, triggerAutoSize]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we don't need to re-render the component, this will cause unnecessary re-renders.

*/
const getLeagueData = async (): Promise<void> => {
try {
const leagueId = '66f1a8e300102bff03ff'; // EMAIL TEST LEAGUE (DO NOT CHANGE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we not have this dynamically working?

* Fetches the league data.
* @returns The league data.
*/
const fetchData = async (): Promise<void> => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to be in a useEfect or can it just be called when the component mounts?

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.

FEE: Add in functionality for email notifications
5 participants