added suer to p-log, HUB_URL in hub-server, dynamic badges in email

This commit is contained in:
PxlLoewe
2025-03-12 17:44:53 -07:00
parent b1992f64d3
commit b573d7cd5a
11 changed files with 79 additions and 41 deletions

View File

@@ -0,0 +1,21 @@
import { BADGES } from "@repo/db";
import React from "react";
const badgeImageMapping = {
[BADGES.P1]: "p-1.png",
[BADGES.P2]: "p-2.png",
[BADGES.P3]: "p-3.png",
[BADGES.D1]: "d-1.png",
[BADGES.D2]: "d-2.png",
[BADGES.D3]: "d-3.png",
[BADGES.DAY1]: "day-1-member.png",
};
export const Badge = ({ badge }: { badge: BADGES }) => (
<img
src={`${process.env.HUB_URL}/badges/${badgeImageMapping[badge]}`}
alt="Badge"
width="80"
style={{ display: "block", margin: "0 auto" }}
/>
);

View File

@@ -1,6 +1,7 @@
import * as React from "react";
import { Event, User } from "@repo/db";
import { Html, Button, render } from "@react-email/components";
import { Badge } from "./Badge";
const styles = `
* {
@@ -87,7 +88,7 @@ const Template = ({ event, user }: { user: User; event: Event }) => (
<tr>
<td style={{ textAlign: "center", paddingTop: "30px" }}>
<img
src="http://localhost:3000/mail/var_logo.png"
src={`${process.env.HUB_URL}/mail/var_logo.png`}
alt="Logo"
width="80"
style={{ display: "block", margin: "0 auto" }}
@@ -119,12 +120,9 @@ const Template = ({ event, user }: { user: User; event: Event }) => (
</tr>
<tr>
<td style={{ textAlign: "center", padding: "20px" }}>
<img
src="http://localhost:3000/badges/p-1.png"
alt="Badge"
width="80"
style={{ display: "block", margin: "0 auto" }}
/>
{event.finishedBadges.map((badge) => (
<Badge badge={badge} />
))}
</td>
</tr>
<tr>