import * as React from "react" import { Heading, Hr, Section, Text } from "@react-email/components" import { RavenEmailLayout } from "./_components/layout" import { EMAIL_COLORS } from "./_components/tokens" export type NewLoginEmailProps = { loginAt: string ipAddress: string userAgent: string location?: string | null } function formatDate(dateStr: string): string { try { const date = new Date(dateStr) return new Intl.DateTimeFormat("pt-BR", { dateStyle: "long", timeStyle: "short", }).format(date) } catch { return dateStr } } export default function NewLoginEmail(props: NewLoginEmailProps) { const { loginAt, ipAddress, userAgent, location } = props return (
🔒
Novo acesso detectado Detectamos um novo acesso a sua conta. Se foi voce, pode ignorar este e-mail.
{location ? ( ) : null}
Data/Hora {formatDate(loginAt)}
Endereco IP {ipAddress}
Localizacao {location}
Dispositivo {userAgent}

Se voce nao reconhece este acesso, recomendamos que altere sua senha imediatamente.
) } NewLoginEmail.PreviewProps = { loginAt: new Date().toISOString(), ipAddress: "192.168.1.100", userAgent: "Chrome 120.0 / Windows 11", location: "Sao Paulo, SP, Brasil", } satisfies NewLoginEmailProps