Openstatus www.openstatus.dev
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: add zod schema

authored by

Maximilian Kaske and committed by
Maximilian Kaske
06ee3d9c ac735048

+47 -33
+14 -11
packages/emails/emails/monitor-alert.tsx
··· 14 14 Row, 15 15 Text, 16 16 } from "@react-email/components"; 17 + import { z } from "zod"; 17 18 import { Layout } from "./_components/layout"; 18 19 import { colors, styles } from "./_components/styles"; 19 20 20 - export interface MonitorAlertProps { 21 - type: "degraded" | "up" | "down"; 22 - name?: string; 23 - url?: string; 24 - method?: string; 25 - status?: string; 26 - latency?: string; 27 - location?: string; 28 - timestamp?: string; 29 - } 21 + const MonitorAlertSchema = z.object({ 22 + type: z.enum(["degraded", "up", "down"]), 23 + name: z.string().optional(), 24 + url: z.string().optional(), 25 + method: z.string().optional(), 26 + status: z.string().optional(), 27 + latency: z.string().optional(), 28 + location: z.string().optional(), 29 + timestamp: z.string().optional(), 30 + }); 31 + 32 + export type MonitorAlertProps = z.infer<typeof MonitorAlertSchema>; 30 33 31 34 function getIcon(type: MonitorAlertProps["type"]): { 32 35 src: string; ··· 149 152 ); 150 153 151 154 MonitorAlertEmail.PreviewProps = { 152 - type: "down", 155 + type: "up", 153 156 name: "Ping Pong", 154 157 url: "https://openstatus.dev/ping", 155 158 method: "GET",
+14 -9
packages/emails/emails/page-subscription.tsx
··· 9 9 Preview, 10 10 Text, 11 11 } from "@react-email/components"; 12 + import { z } from "zod"; 12 13 import { Layout } from "./_components/layout"; 13 14 import { styles } from "./_components/styles"; 14 15 15 - export interface PageSubscriptionProps { 16 - token: string; 17 - page: string; 18 - domain: string; 19 - img?: { 20 - src: string; 21 - alt: string; 22 - }; 23 - } 16 + export const PageSubscriptionSchema = z.object({ 17 + token: z.string(), 18 + page: z.string(), 19 + domain: z.string(), 20 + img: z 21 + .object({ 22 + src: z.string(), 23 + alt: z.string(), 24 + }) 25 + .optional(), 26 + }); 27 + 28 + export type PageSubscriptionProps = z.infer<typeof PageSubscriptionSchema>; 24 29 25 30 const PageSubscriptionEmail = ({ 26 31 token,
+11 -8
packages/emails/emails/status-report.tsx
··· 10 10 Row, 11 11 Text, 12 12 } from "@react-email/components"; 13 + import { z } from "zod"; 13 14 import { Layout } from "./_components/layout"; 14 15 import { colors, styles } from "./_components/styles"; 15 16 16 - export interface StatusReportProps { 17 - pageTitle: string; 18 - status: "investigating" | "identified" | "monitoring" | "resolved"; 19 - date: string; 20 - message: string; 21 - reportTitle: string; 22 - monitors: string[]; // array of monitor names 23 - } 17 + export const StatusReportSchema = z.object({ 18 + pageTitle: z.string(), 19 + status: z.enum(["investigating", "identified", "monitoring", "resolved"]), 20 + date: z.string(), 21 + message: z.string(), 22 + reportTitle: z.string(), 23 + monitors: z.array(z.string()), 24 + }); 25 + 26 + export type StatusReportProps = z.infer<typeof StatusReportSchema>; 24 27 25 28 function getStatusColor(status: string) { 26 29 switch (status) {
+8 -5
packages/emails/emails/team-invitation.tsx
··· 9 9 Preview, 10 10 Text, 11 11 } from "@react-email/components"; 12 + import { z } from "zod"; 12 13 import { Layout } from "./_components/layout"; 13 14 import { styles } from "./_components/styles"; 14 15 15 - export interface TeamInvitationProps { 16 - invitedBy: string; // email address 17 - workspaceName?: string; 18 - token: string; 19 - } 16 + export const TeamInvitationSchema = z.object({ 17 + invitedBy: z.string(), 18 + workspaceName: z.string().optional().nullable(), 19 + token: z.string(), 20 + }); 21 + 22 + export type TeamInvitationProps = z.infer<typeof TeamInvitationSchema>; 20 23 21 24 const TeamInvitationEmail = ({ 22 25 token,