import { Mail } from "@/types/mail"; import { Star, StarOff, Paperclip } from "lucide-react"; import { format } from "date-fns"; interface MailListProps { mails: Mail[]; onMailClick: (mail: Mail) => void; } export function MailList({ mails, onMailClick }: MailListProps) { if (!mails || mails.length === 0) { return (

No emails found

); } return (
{mails.map((mail) => (
onMailClick(mail)} >
{mail.starred ? ( ) : ( )} {mail.from}
{format(new Date(mail.date), "MMM d, yyyy")}

{mail.subject}

{mail.body}

{mail.attachments && mail.attachments.length > 0 && (
{mail.attachments.length} attachment {mail.attachments.length > 1 ? "s" : ""}
)}
))}
); }