Skip to content

Alex/implement email notification functionality#464

Draft
alexappleget wants to merge 69 commits into
developfrom
alex/implement-email-notification-functionality
Draft

Alex/implement email notification functionality#464
alexappleget wants to merge 69 commits into
developfrom
alex/implement-email-notification-functionality

Conversation

@alexappleget

@alexappleget alexappleget commented Aug 15, 2024

Copy link
Copy Markdown
Contributor

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

@appwrite

appwrite Bot commented Aug 15, 2024

Copy link
Copy Markdown

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!

@vercel

vercel Bot commented Aug 15, 2024

Copy link
Copy Markdown

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
alexappleget and others added 12 commits September 26, 2024 10:56
…n-functionality' into alex/implement-email-notification-functionality
Closes #474 

Enhance the user experience of the existing admin notification page to
improve its formatting and usability.

**Acceptance Criteria:**
- [X] Review and redesign the layout of the admin notification page for
better organization and clarity.
- [X] Improve the visual hierarchy of notification elements for easier
scanning and management.
- [X] Ensure the design is consistent with the overall admin panel
aesthetics.
---
## Video Demo

https://github.com/user-attachments/assets/cc1e8a0e-45b0-4fbe-9972-2deb085525dc

---------

Co-authored-by: Alex Appleget <alexappleget2014@gmail.com>
Co-authored-by: Shashi Lo <362527+shashilo@users.noreply.github.com>

@ryanfurrer ryanfurrer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I pulled and ran this locally, and while I'm getting a POST 200, I do not see any on-screen confirmation that the email was sent

@ryanfurrer ryanfurrer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am unable to test this; every time I navigate to /admin it redirects me to my leagues.

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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