Skip to content

Commit

Permalink
Merge pull request #1 from verdigado/patch-templates
Browse files Browse the repository at this point in the history
Patch for German Email Templates and Subjects
  • Loading branch information
NikoHadouken authored Aug 28, 2024
2 parents ae6da78 + e7cca3c commit f404cc1
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 66 deletions.
2 changes: 2 additions & 0 deletions apps/web/src/app/[locale]/(admin)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import {
PageTitle,
} from "@/app/components/page-layout";
import { getTranslation } from "@/app/i18n";
import { TermiteAlert } from "@/app/[locale]/(admin)/termite-alert";

export default async function Page({ params }: { params: Params }) {
const { t } = await getTranslation(params.locale);
return (
<div>
<PageContainer>
<TermiteAlert />
<PageHeader>
<div className="flex items-center gap-x-3">
<PageIcon>
Expand Down
55 changes: 55 additions & 0 deletions apps/web/src/app/[locale]/(admin)/termite-alert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"use client";

import { Alert, AlertDescription, AlertTitle } from "@rallly/ui/alert";
import { Button } from "@rallly/ui/button";
import { InfoIcon } from "lucide-react";
import { useState } from "react";

export function TermiteAlert() {
const [showTermiteAlert, setShowTermiteAlert] = useState(true);

if (!showTermiteAlert) {
return null;
}

return (
<Alert className="mt-4" icon={InfoIcon}>
<AlertTitle>Herzlich Willkommen bei der neuen Termite! 🎉</AlertTitle>
<AlertDescription>
<p className="mt-4">
Zum 02.09.2024 wurde die Termite aktualisiert. Eine Anleitung zur
Nutzung der Termite 2.0 findet ihr{" "}
<a
className="text-link"
href="https://netz.gruene.de/de/wissenswerk/2024-08/die-neue-termite"
target="_blank"
>
hier
</a>
.
</p>
<p>
Eure bisherigen Umfragen wurden archiviert. Ihr könnt sie noch bis zum
15.09.2024{" "}
<a href="https://framadate.gruene.verdigado.net/" target="_blank">
hier
</a>{" "}
einsehen und herunterladen.
</p>
<p className="mt-2">
Wir bitten euch, die Daten bei Bedarf zu sichern. Bei Fragen oder
Feedback wendet euch gerne an <strong>[email protected]</strong>.
</p>
<div>
<Button
className="mt-4"
variant="primary"
onClick={() => setShowTermiteAlert(false)}
>
Ausblenden
</Button>
</div>
</AlertDescription>
</Alert>
);
}
2 changes: 1 addition & 1 deletion apps/web/src/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const providers: Provider[] = [
if (user) {
await emailClient.sendTemplate("LoginEmail", {
to: email,
subject: `${token} is your 6-digit code`,
subject: `${token} ist Dein sechsstelliger Eingabecode`,
props: {
name: user.name,
magicLink: absoluteUrl("/auth/login", {
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/trpc/routers/polls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export const polls = router({
waitUntil(
ctx.emailClient.sendTemplate("NewPollEmail", {
to: user.email,
subject: `Let's find a date for ${poll.title}`,
subject: `Lasst uns einen Termin finden für ${poll.title}`,
props: {
title: poll.title,
name: user.name,
Expand Down Expand Up @@ -914,7 +914,7 @@ export const polls = router({

const emailToHost = waitUntil(
ctx.emailClient.sendTemplate("FinalizeHostEmail", {
subject: `Date booked for ${poll.title}`,
subject: `Termin gefunden für ${poll.title}`,
to: poll.user.email,
props: {
name: poll.user.name,
Expand All @@ -939,7 +939,7 @@ export const polls = router({

const emailsToParticipants = participantsToEmail.map((p) => {
return ctx.emailClient.sendTemplate("FinalizeParticipantEmail", {
subject: `Date booked for ${poll.title}`,
subject: `Termin gefunden für ${poll.title}`,
to: p.email,
props: {
name: p.name,
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/trpc/routers/polls/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const comments = router({
emailsToSend.push(
ctx.emailClient.sendTemplate("NewCommentEmail", {
to: email,
subject: `${authorName} has commented on ${poll.title}`,
subject: `${authorName} hat ${poll.title} kommentiert`,
props: {
name: watcher.user.name,
authorName,
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/trpc/routers/polls/participants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const participants = router({
emailsToSend.push(
ctx.emailClient.sendTemplate("NewParticipantConfirmationEmail", {
to: email,
subject: `Thanks for responding to ${poll.title}`,
subject: `Danke für Deine Beteiligung an ${poll.title}`,
props: {
name,
title: poll.title,
Expand Down Expand Up @@ -162,7 +162,7 @@ export const participants = router({
emailsToSend.push(
ctx.emailClient.sendTemplate("NewParticipantEmail", {
to: email,
subject: `${participant.name} has responded to ${poll.title}`,
subject: `${participant.name} hat in ${poll.title} geantwortet`,
props: {
name: watcher.user.name,
participantName: participant.name,
Expand Down
24 changes: 17 additions & 7 deletions packages/emails/src/templates/_components/email-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const EmailLayout = ({
<Container style={containerStyles}>
<Img src={logoUrl} alt="Rallly" width={128} />
<Section style={sectionStyles}>
{recipientName ? <Text>Hi {recipientName},</Text> : null}
{recipientName ? <Text>Hallo {recipientName},</Text> : null}
{children}
{footNote ? (
<Text
Expand All @@ -81,19 +81,29 @@ export const EmailLayout = ({
Home
</Link>
<span>&nbsp;&bull;&nbsp;</span>
<Link style={linkStyles} href="https://twitter.com/ralllyco">
Twitter
<Link
style={linkStyles}
href="https://www.gruene.de/service/impressum"
>
Impressum
</Link>
<span>&nbsp;&bull;&nbsp;</span>
<Link style={linkStyles} href="https://github.com/lukevella/rallly">
Github
<Link
style={linkStyles}
href="https://www.gruene.de/service/datenschutz"
>
Datenschutz
</Link>
<span>&nbsp;&bull;&nbsp;</span>
<Link
style={linkStyles}
href={`mailto:${process.env["SUPPORT_EMAIL"]}`}
href="https://netz.gruene.de/de/wissenswerk/2024-08/die-neue-termite"
>
Contact
Hilfe
</Link>
<span>&nbsp;&bull;&nbsp;</span>
<Link style={linkStyles} href="https://rallly.co">
Diese Anwendung basiert auf Rallly
</Link>
</Section>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ export const NotificationEmail = ({
recipientName={name}
footNote={
<>
If you would like to stop receiving updates you can{" "}
Wenn Du nicht mehr über Neuigkeiten informiert werden möchtest, kannst
Du die Benachrichtigungen in den Einstellungen{" "}
<Link className="whitespace-nowrap" href={disableNotificationsUrl}>
turn notifications off
deaktivieren
</Link>
.
</>
Expand All @@ -40,7 +41,7 @@ export const NotificationEmail = ({
>
{children}
<Text>
<Button href={pollUrl}>View on {domain}</Button>
<Button href={pollUrl}>Du findest die Umfrage unter {domain}</Button>
</Text>
</EmailLayout>
);
Expand Down
7 changes: 4 additions & 3 deletions packages/emails/src/templates/finalized-host.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const FinalizeHostEmail = ({
return (
<EmailLayout ctx={ctx} recipientName={name} preview="Final date booked!">
<Text>
<strong>{title}</strong> has been booked for:
Es wurde ein Termin vereinbart für <strong>{title}</strong>:
</Text>
<Section>
<Row>
Expand Down Expand Up @@ -71,10 +71,11 @@ export const FinalizeHostEmail = ({
</Row>
</Section>
<Text>
We&apos;ve notified participants and sent them calendar invites.
Wir haben die Teilnehmer*innen benachrichtigt und ihnen
Kalendereinladungen zugeschickt.
</Text>
<Text>
<Button href={pollUrl}>View Event</Button>
<Button href={pollUrl}>Termin anzeigen</Button>
</Text>
</EmailLayout>
);
Expand Down
8 changes: 4 additions & 4 deletions packages/emails/src/templates/finalized-participant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export const FinalizeParticipantEmail = ({
return (
<EmailLayout ctx={ctx} recipientName={name} preview="Final date booked!">
<Text>
<strong>{hostName}</strong> has booked <strong>{title}</strong> for the
following date:
<strong>{hostName}</strong> hat für <strong>{title}</strong> folgendes
Datum festgelegt:
</Text>
<Section>
<Row>
Expand Down Expand Up @@ -73,9 +73,9 @@ export const FinalizeParticipantEmail = ({
</Column>
</Row>
</Section>
<Text>Please find attached a calendar invite for this event.</Text>
<Text>Anbei findest Du die Kalendereinladung für diesen Termin.</Text>
<Text>
<Button href={pollUrl}>View Event</Button>
<Button href={pollUrl}>Termin anzeigen</Button>
</Text>
</EmailLayout>
);
Expand Down
27 changes: 16 additions & 11 deletions packages/emails/src/templates/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,37 @@ export const LoginEmail = ({
ctx={ctx}
footNote={
<>
You&apos;re receiving this email because a request was made to login
to <Domain ctx={ctx} />. If this wasn&apos;t you, let us know by
replying to this email.
Du hast diese E-Mail erhalten, da ein Login-Versuch bei{" "}
<Domain ctx={ctx} /> stattgefunden hat. Wenn Du das nicht warst, lass
es uns bitte wissen und antworte auf diese E-Mail.
</>
}
recipientName={name}
preview="Use this link to log in on this device."
>
<Text>
To log in to your account, please choose one of the following options:
um Dich in Deinen Account einzuloggen, wähle bitte eine der folgenden
Optionen:
</Text>
<Card>
<Heading>Option 1: Magic Link</Heading>
<Text>Click this magic link to log in on this device.</Text>
<Heading>Option 1: Magischer Link</Heading>
<Text>
Klicke auf den magischen Link um Dich auf diesem Gerät anzumelden.
</Text>
<Button href={magicLink} id="magicLink">
Log in to {ctx.domain}
Logge Dich ein auf {ctx.domain}
</Button>
<Text light={true}>This link will expire in 15 minutes.</Text>
<Text light={true}>Dieser Link ist nur für 15 Minuten gültig. </Text>
</Card>
<Card>
<Heading>Option 2: Verification Code</Heading>
<Text>Enter this one-time 6-digit verification code.</Text>
<Heading>Option 2: Verifizierungscode</Heading>
<Text>
Gib diesen sechsstelligen Einmal-Code für die Verifizierung ein.
</Text>
<Heading as="h1" style={trackingWide} id="code">
{code}
</Heading>
<Text light={true}>This code will expire in 15 minutes.</Text>
<Text light={true}>Dieser Code ist nur für 15 Minuten gültig.</Text>
</Card>
</EmailLayout>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/emails/src/templates/new-comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const NewCommentEmail = ({
preview="Go to your poll to see what they said."
>
<Text>
<strong>{authorName}</strong> has commented on <strong>{title}</strong>.
<strong>{authorName}</strong> hat <strong>{title}</strong> kommentiert.
</Text>
</NotificationEmail>
);
Expand Down
15 changes: 8 additions & 7 deletions packages/emails/src/templates/new-participant-confirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,25 @@ export const NewParticipantConfirmationEmail = ({
ctx={ctx}
footNote={
<>
You are receiving this email because a response was submitted on{" "}
<Domain ctx={ctx} />. If this wasn&apos;t you, please ignore this
email.
Du erhältst diese E-Mail, da eine Antwort auf <Domain ctx={ctx} />{" "}
eingegangen ist. Wenn Du das nicht warst, ignoriere bitte diese
E-Mail.
</>
}
recipientName={name}
preview="To edit your response use the link below"
>
<Text>
Your response to <strong>{title}</strong> has been submitted.
Deine Antwort auf <strong>{title}</strong> wurde erfolgreich
übermittelt.
</Text>
<Text>
While the poll is still open you can change your response using the link
below.
Solange die Umfrage noch läuft, kannst Du Deine Antwort über den
folgenden Link ändern oder anschauen:
</Text>
<Section>
<Button id="editSubmissionUrl" href={editSubmissionUrl}>
Review response on {domain}
Ansehen auf {domain}
</Button>
</Section>
</EmailLayout>
Expand Down
4 changes: 2 additions & 2 deletions packages/emails/src/templates/new-participant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const NewParticipantEmail = ({
preview="Go to your poll to see the new response."
>
<Text>
<strong>{participantName}</strong> has responded to{" "}
<strong>{title}</strong>.
<strong>{participantName}</strong> hat an Deiner Umfrage{" "}
<strong>{title}</strong> teilgenommen.
</Text>
</NotificationEmail>
);
Expand Down
Loading

0 comments on commit f404cc1

Please sign in to comment.