Skip to content

Commit

Permalink
File Deletion Email Format (#22)
Browse files Browse the repository at this point in the history
Format for file deletion as per file expiry project


![image](https://github.com/user-attachments/assets/58b5c66b-6c42-4348-ac50-3b4df5a26339)
  • Loading branch information
cehune authored Nov 19, 2024
1 parent 677276a commit 1818351
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions emails/file-deletion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {
Hr,
Link,
Section,
Text
} from "@react-email/components";
import { z } from "zod";
import { WATcloudEmail } from "./_common/watcloud-email";

const EmailProps = z.object({
name: z.string(),
paths: z.array(z.string()),
daysForExpiry: z.string()
});

type EmailProps = z.infer<typeof EmailProps>;

const Email = (props: EmailProps) => {
const { name, paths, daysForExpiry } = EmailProps.parse(props);

const previewText = `Some of your files in the WATcloud compute cluster have been deleted.`;

const deletedPaths = (
<div>
<ul style={{ fontSize: "14px", lineHeight: "24px" }}>
{paths.map(path => (
<li key={path}>{path}</li>
))}
</ul>
</div>
);

return (
<WATcloudEmail previewText={previewText}>
<Text>Hi {name},</Text>
<Text>
In an ongoing effort to keep WATcloud's file storage efficient and maintain optimal performance, we routinely clean up specific directories that haven't been accessed in the past {daysForExpiry} days. We previously sent an email that you had files which met this criteria. Since they were not accessed by the given deadline, those files have been deleted.
</Text>
<Hr />
<Section>
<Text>The following paths were deleted:</Text>
{deletedPaths}
</Section>
<Hr />
<Text>
If you have any questions, please reach out to your <Link href="https://cloud.watonomous.ca/docs/services#watcloud-contact" style={{ color: "#1e90ff", textDecoration: "none" }}>WATcloud contact</Link> or the WATcloud team at <Link href={`mailto:infra-outreach@watonomous.ca`} style={{ color: "#1e90ff", textDecoration: "none" }}>infra-outreach@watonomous.ca</Link>.
</Text>
</WATcloudEmail>
);
};

Email.PreviewProps = {
name: "John Doe",
paths: ["delta-ubuntu2:/var/lib/cluster/users/1234/docker", "delta-ubuntu2:/var/lib/cluster/users/1234/containers", "tr-ubuntu3:/var/lib/cluster/users/1234/containers", "/mnt/wato-drive2/someuser"],
daysForExpiry: "70"
} as EmailProps;

export default Email;

0 comments on commit 1818351

Please sign in to comment.