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

feat(email): add all email templates #352

Merged
merged 6 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 85 additions & 11 deletions apps/email/templates/cuhacking/registered-for-hackathon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* import { execSync } from 'node:child_process' */
import { Banner, Content, Footer, Keyboard } from '@/email/components'
import { render } from "@react-email/render";
import { Container, Html, Section, Tailwind } from '@react-email/components'

function getGenericEmailConstants() {
Expand All @@ -22,21 +23,92 @@ function getGenericEmailConstants() {
* } */
/* catch (error) {
* console.error('Error fetching email content:', error) */
return {
title: 'Your account is created.',
body: {
buttonText: 'Complete Registration',
buttonLink: 'https://portal.cuhacking.ca/terms',
text: 'Looking forward to seeing you on March 14th!',
footer: 'See you soon!',
return {
title: 'Heeyy :333',
body: {
text: `Your application to the cuHacking 2025 event at Carleton University has been accepted! 🔥🔥🔥

Details ...
📍 Richcraft Hall (1125 Colonel By Dr, Carleton University)
⌛ March 14-16 (Check-in from 5pm - 9pm)

🥗 Food + Merch will be provided for the first 300 hackers on site!<br>
What to bring?
🪪 Government ID<
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fix typo in HTML tag

There's a missing closing angle bracket in the Government ID line.

-🪪 Government ID<
+🪪 Government ID
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
🪪 Government ID<
🪪 Government ID

💻 Your laptop + charger
🛏️ Sleeping bags
🪥 Personal hygiene (plz bring deodorant, plz ...)
🥤 Reusable water bottle
🤪 A positive attitude!`,

buttonText: 'JOIN DISCORD',
buttonLink: 'https://discord.gg/VnbWdAe8kA',

secondButtonText: 'ADD TO CALENDAR',
secondButtonLink: 'https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MDY1bnFyb3B2c2Z1NjM4dDRxODcybmhtYWwgZmNkYmEzZjM1NGQ0ZTAxNTUyZTI0OTVkNzQzMTA1YmQ5ZWZjZTRlMTA3NmNkYTNjMWVjMTQ1NGQwZjVmYWE3M0Bn&tmsrc=fcdba3f354d4e01552e2495d743105bd9efce4e1076cda3c1ec1454d0f5faa73%40group.calendar.google.com',

events: [
{
title: 'Upcoming events...',
},
}
{
title: 'Intro to QNX',
text: 'Learn about QNX with 3 awesome speakers + meet some interns. Make sure you bring your laptop. Happening March 11th, 6:30 to 8:00 pm. Register now!',
buttons: [
{
text: "REGISTER",
link: "https://docs.google.com/forms/d/e/1FAIpQLSfni0BpF_2vf9xM02Ux4t979C_jVVXLvxVDv0u1hrrobVan-A/viewform"
}
]
},
{
title: "Learn about Gadget",
text: "Gadget is hosting a Q&A webinar to teach students the basics of their platform. It's happening Wednesday, March 12th at 2:30pm. You must create an account using the link below. If you already have an account let Gadget know during the webinar.",
buttons: [
{
text: "CREATE ACCOUNT",
link: "https://app.gadget.dev/auth/login?returnTo=/auth/hackathon"
},
{
text: "WEBINAR",
link: "https://meet.google.com/ybk-wumk-hig"
}
]
},
{
title: "Resume Roast",
text: "Get your resume roasted at cuHacking! Sign up below to be eligible. Brought to you by uO SESA",
buttons: [
{
text: "REGISTER",
link: "https://docs.google.com/forms/d/e/1FAIpQLSdljqp8Z6F6ADINhJergvcqJZ6aTYSW2SSSVrngsY6ltx1eHQ/viewform"
}
]
},
{
title: "Sign up for our portal!",
text: "Create your account on our portal! You must do this to be eligible for our hackathon",
buttons: [
{
text: "CREATE ACCOUNT",
link: "https://portal.cuhacking.ca"
}
]
}
],
},
}



/* } */
}



const genericEmailConstants = getGenericEmailConstants()

function Generic({ title, body }) {
function Generic({ title, body } : { title: string, body: string }) {
return (
<Tailwind>
<Html>
Expand All @@ -45,7 +117,7 @@ function Generic({ title, body }) {
<Banner />
<Content title={title} body={body} />
<Keyboard />
<Footer>{body.footer}</Footer>
<Footer />
</Section>
</Container>
</Html>
Expand All @@ -54,5 +126,7 @@ function Generic({ title, body }) {
}

export default function Preview() {
return <Generic {...genericEmailConstants} />
return (
<Generic {...genericEmailConstants} />
)
}
2 changes: 1 addition & 1 deletion infra/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ in pkgs.mkShell {
pkgs.yazi
pkgs.bat
pkgs.browsh
pkgs.firefox
#pkgs.firefox
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Remove commented line if it's no longer needed.

If there's no plan to reintroduce Firefox support soon, consider removing the line altogether to keep the shell environment tidy.

# pkgs.netscanner
pkgs.zsh
];
Expand Down
217 changes: 160 additions & 57 deletions libs/db/collections/models/Emails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Emails: CollectionConfig = {
fields: [
{
name: 'text',
type: 'text',
type: 'textarea',
required: true,
},
{
Expand All @@ -51,6 +51,37 @@ export const Emails: CollectionConfig = {
type: 'text',
required: true,
},
{
name: 'secondButtonText',
type: 'text',
required: false,
},
{
name: 'secondButtonLink',
type: 'text',
required: false,
},
{
name: 'events',
type: 'array',
fields: [
{
name: 'title',
type: 'text',
required: false,
},
{
name: 'text',
type: 'textarea',
required: false,
},
{
name: 'buttonText',
type: 'text',
required: false,
},
],
},
Comment on lines +54 to +84
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Model doesn't match template implementation

The events array structure in the model only has buttonText field, but the template implementation uses an array of buttons with text/link pairs. This mismatch will cause issues when fetching and rendering events.

Update the model to match the template implementation:

        {
          name: 'events',
          type: 'array',
          fields: [
            {
              name: 'title',
              type: 'text',
              required: false,
            },
            {
              name: 'text',
              type: 'textarea',
              required: false,
            },
-            {
-              name: 'buttonText',
-              type: 'text',
-              required: false,
-            },
+            {
+              name: 'buttons',
+              type: 'array',
+              required: false,
+              fields: [
+                {
+                  name: 'text',
+                  type: 'text',
+                  required: true,
+                },
+                {
+                  name: 'link',
+                  type: 'text',
+                  required: true,
+                }
+              ]
+            },
          ],
        },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
name: 'secondButtonText',
type: 'text',
required: false,
},
{
name: 'secondButtonLink',
type: 'text',
required: false,
},
{
name: 'events',
type: 'array',
fields: [
{
name: 'title',
type: 'text',
required: false,
},
{
name: 'text',
type: 'textarea',
required: false,
},
{
name: 'buttonText',
type: 'text',
required: false,
},
],
},
{
name: 'secondButtonText',
type: 'text',
required: false,
},
{
name: 'secondButtonLink',
type: 'text',
required: false,
},
{
name: 'events',
type: 'array',
fields: [
{
name: 'title',
type: 'text',
required: false,
},
{
name: 'text',
type: 'textarea',
required: false,
},
{
name: 'buttons',
type: 'array',
required: false,
fields: [
{
name: 'text',
type: 'text',
required: true,
},
{
name: 'link',
type: 'text',
required: true,
}
]
},
],
},

{
name: 'footer',
type: 'text',
Expand All @@ -61,6 +92,7 @@ export const Emails: CollectionConfig = {
],
}


export async function seedEmails(payload: Payload) {
try {
await Promise.all(
Expand All @@ -73,6 +105,9 @@ export async function seedEmails(payload: Payload) {
text: email.body.text,
buttonText: email.body.buttonText,
buttonLink: email.body.buttonLink,
secondButtonText: email.body.secondButtonText || null,
secondButtonLink: email.body.secondButtonLink || null,
events: email.body.events || [],
footer: email.body.footer,
},
},
Expand All @@ -86,59 +121,127 @@ export async function seedEmails(payload: Payload) {
}
}

export const emailSeedData = [
{
title: 'Thank you for registering Hasith!',
body: {
text: 'Your submission has been received. Looking forward to seeing you on March 14th!',
buttonText: 'RSVP',
buttonLink: 'https://portal.cuhacking.ca/',
footer: 'See you there!',
},
},
{
title: 'Welcome to the Community!',
body: {
text: 'We’re excited to have you on board. Stay tuned for updates and events!',
buttonText: 'Join Discord',
buttonLink: 'https://discord.gg/example',
footer: 'Connect with the community!',
},
},
{
title: 'Your Weekly Update',
body: {
text: 'Here’s what’s happening this week at CUHacking.',
buttonText: 'Read More',
buttonLink: 'https://cuhacking.ca/blog',
footer: 'Check out the latest news!',
},
},
{
title: 'Reminder: Hackathon Starts Soon!',
body: {
text: 'The hackathon kicks off in just 3 days. Make sure you’re prepared!',
buttonText: 'Event Details',
buttonLink: 'https://cuhacking.ca/hackathon',
footer: 'See the schedule here.',
},
},
{
title: 'Thank You for Attending!',
body: {
text: 'We hope you had a great time at our event. Your feedback is valuable to us.',
buttonText: 'Give Feedback',
buttonLink: 'https://forms.example.com/feedback',
footer: 'Help us improve!',
},
},
{
title: 'Exclusive Offer for cuHacking Members!',
body: {
text: 'As a valued member, we’re giving you early access to our upcoming event!',
buttonText: 'Claim Your Spot',
buttonLink: 'https://cuhacking.ca/exclusive',
footer: 'Limited spots available!',
},
},
]

// WIP - NOT FINISHED YET
// export const emailSeedData = [
// {
// title: 'Thank you for registering Hasith!',
// body: {
// text: 'Your submission has been received. Looking forward to seeing you on March 14th!\n\nDetails ...\n📍 Richcraft Hall (1125 Colonel By Dr, Carleton University)\n⌛ March 14-16 (Check-in from 5pm - 9pm)',
// buttonText: 'RSVP',
// buttonLink: 'https://portal.cuhacking.ca/',
// secondButtonText: 'ADD TO CALENDAR',
// secondButtonLink: 'https://calendar.google.com/calendar/event?action=TEMPLATE',
// events: [
// {
// title: 'Upcoming events...',
// },
// {
// title: 'Intro to QNX',
// text: 'Learn about QNX with 3 awesome speakers + meet some interns. Make sure you bring your laptop.',
// buttonText: 'REGISTER',
// }
// ],
// footer: 'See you there!',
// },
// },
// {
// title: 'Welcome to the Community!',
// body: {
// text: `We're excited to have you on board. Stay tuned for updates and events!\n\n🎉 Join our Discord server to connect with other hackers\n💻 Check out our workshops\n🏆 Get ready for the upcoming hackathon`,
// buttonText: 'JOIN DISCORD',
// buttonLink: 'https://discord.gg/VnbWdAe8kA',
// secondButtonText: 'EXPLORE WORKSHOPS',
// secondButtonLink: 'https://cuhacking.ca/workshops',
// events: [
// {
// title: 'Upcoming events...',
// },
// {
// title: 'Networking Mixer',
// text: 'Meet industry professionals and fellow hackers',
// buttonText: 'RSVP',
// }
// ],
// footer: 'Connect with the community!',
// },
// },
// {
// title: 'Your Weekly Update',
// body: {
// text: `Here's what's happening this week at cuHacking.\n\n🚀 New workshops announced\n🎙️ Guest speakers from QNX and Fullscript\n🧩 Practice hackathon challenges`,
// buttonText: 'READ MORE',
// buttonLink: 'https://cuhacking.ca/blog',
// secondButtonText: 'VIEW SCHEDULE',
// secondButtonLink: 'https://cuhacking.ca/schedule',
// events: [
// {
// title: 'Upcoming events...',
// },
// {
// title: 'Workshop: Intro to React',
// text: 'Learn the basics of React with our experienced mentors',
// buttonText: 'REGISTER',
// },
// {
// title: 'Tech Talk: Cybersecurity Basics',
// text: 'Join CSE for an introduction to cybersecurity principles',
// buttonText: 'REGISTER',
// }
// ],
// footer: 'Check out the latest news!',
// },
// },
// {
// title: 'Reminder: Hackathon Starts Soon!',
// body: {
// text: `The hackathon kicks off in just 3 days. Make sure you're prepared!\n\nWhat to bring?\n🪪 Government ID\n💻 Your laptop + charger\n🛏️ Sleeping bags\n🪥 Personal hygiene (plz bring deodorant, plz ...)\n🥤 Reusable water bottle\n🤪 A positive attitude!`,
// buttonText: 'EVENT DETAILS',
// buttonLink: 'https://cuhacking.ca/hackathon',
// secondButtonText: 'JOIN DISCORD',
// secondButtonLink: 'https://discord.gg/VnbWdAe8kA',
// events: [
// {
// title: 'Pre-Hackathon Workshop',
// text: 'Get a head start with our pre-hackathon workshop',
// buttonText: 'JOIN NOW',
// }
// ],
// footer: 'See the schedule here.',
// },
// },
// {
// title: 'Thank You for Attending!',
// body: {
// text: 'We hope you had a great time at our event. Your feedback is valuable to us.\n\n🏆 Congratulations to all winners!\n📸 Check out event photos\n🗓️ Stay tuned for our next hackathon',
// buttonText: 'GIVE FEEDBACK',
// buttonLink: 'https://forms.example.com/feedback',
// secondButtonText: 'VIEW PHOTOS',
// secondButtonLink: 'https://cuhacking.ca/gallery',
// events: [
// {
// title: 'Upcoming events...',
// },
// {
// title: 'Project Showcase',
// text: 'Present your hackathon project to industry professionals',
// buttonText: 'REGISTER',
// }
// ],
// footer: 'Help us improve!',
// },
// },
// {
// title: 'Exclusive Offer for cuHacking Members!',
// body: {
// text: `As a valued member, we're giving you early access to our upcoming event!\n\n🎁 Special perks for cuHacking members\n🔥 Limited spots available\n🚀 Exclusive networking opportunities`,
// buttonText: 'CLAIM YOUR SPOT',
// buttonLink: 'https://cuhacking.ca/exclusive',
// secondButtonText: 'LEARN MORE',
// secondButtonLink: 'https://cuhacking.ca/membership-benefits',
// events: [
// ],
// footer: 'Limited spots available!',
// },
// },
// ]
Comment on lines +125 to +247
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Commented WIP code should be in a separate branch

Large blocks of commented code marked as "WIP" should ideally be in a separate development branch rather than committed to the main codebase. This makes the code cleaner and easier to maintain.

Loading
Loading