Files
task-manager/server/email-template.ts
T
paul 9819d8db0b
continuous-integration/drone/push Build is failing
feat: Notifications page, Sidebar layout fixes, and Achievements enhancements
- implemented /notifications page with overdue/upcoming alerts
- Fixed sidebar scrolling in collapsed mode
- Moved notification button to sidebar footer
- Enhanced Achievements page with streak stats and tooltips
- Improved XP history to show task titles
- Added missing translations (en/de)
- Removed top bar header
- Fixed Docker environment routing
2025-12-17 10:06:36 +01:00

139 lines
3.8 KiB
TypeScript

export function generateEmailHtml(language: string, content: {
title: string;
body: string;
code?: string;
actionUrl?: string;
actionText?: string;
}) {
const isDe = language === 'de';
const footerText = isDe
? "Diese E-Mail wurde automatisch gesendet. Bitte antworten Sie nicht darauf."
: "This email was sent automatically. Please do not reply.";
const siteUrl = process.env.VITE_PUBLIC_APP_URL || "http://localhost:5001";
const logoUrl = `${siteUrl}/favicon.png`;
return `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #09090b; /* zinc-950 */
color: #fafafa; /* zinc-50 */
margin: 0;
padding: 0;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 40px 20px;
}
.logo {
text-align: center;
margin-bottom: 32px;
}
.logo img {
width: 48px;
height: 48px;
}
.card {
background-color: #18181b; /* zinc-900 */
border: 1px solid #27272a; /* zinc-800 */
border-radius: 12px;
padding: 32px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
h1 {
margin: 0 0 16px;
font-size: 24px;
font-weight: 600;
color: #ffffff;
text-align: center;
}
p {
margin: 0 0 16px;
line-height: 1.6;
color: #a1a1aa; /* zinc-400 */
}
.code-container {
text-align: center;
margin: 32px 0;
}
.code {
font-family: monospace;
font-size: 32px;
font-weight: 700;
letter-spacing: 4px;
color: #ffffff;
background: #27272a; /* zinc-800 */
padding: 16px 24px;
border-radius: 8px;
display: inline-block;
}
.btn-container {
text-align: center;
margin: 32px 0;
}
.btn {
display: inline-block;
background-color: #ffffff;
color: #09090b;
font-weight: 600;
padding: 12px 24px;
border-radius: 6px;
text-decoration: none;
transition: background-color 0.2s;
}
.btn:hover {
background-color: #e4e4e7;
}
.footer {
text-align: center;
margin-top: 32px;
font-size: 12px;
color: #52525b; /* zinc-600 */
}
</style>
</head>
<body>
<div class="container">
<div class="logo">
<!-- Trying to link to external URL for logo if accessible, otherwise alt text plays role -->
<img src="https://raw.githubusercontent.com/shadcn-ui/ui/main/apps/www/public/favicon.ico" alt="TaskFlow" style="border-radius: 8px;" width="48" height="48">
<!-- Ideally we host the logo. For localhost, external clients won't see localhost images. I'll use a placeholder or assume the user will configure a real URL in prod.
For now, I'll use a generic pleasing icon or text if image breaks, but let's try to pass the favicon. -->
</div>
<div class="card">
<h1>${content.title}</h1>
<p>${content.body}</p>
${content.code ? `
<div class="code-container">
<div class="code">${content.code}</div>
</div>
` : ''}
${content.actionUrl ? `
<div class="btn-container">
<a href="${content.actionUrl}" class="btn">${content.actionText || 'Click here'}</a>
</div>
` : ''}
<p style="margin-top: 24px; font-size: 14px;">
${isDe ? 'Dieser Code läuft in 10 Minuten ab.' : 'This code expires in 10 minutes.'}
</p>
</div>
<div class="footer">
<p>&copy; ${new Date().getFullYear()} TaskFlow. ${footerText}</p>
</div>
</div>
</body>
</html>
`;
}