// frontend/components/mail/MailRow.tsx — 메일 목록 행 (아바타 + AI pill) "use client"; import { Icon } from "@/components/Icon"; import type { EmailRow, MailAccount, Person } from "@/lib/types"; export function aiCount(m: EmailRow): number { return m.ai ? m.ai.tasks.length + m.ai.events.length + (m.ai.replies.length ? 1 : 0) : 0; } export function MailRow({ m, person, account, accColor, on, onClick, onStar, }: { m: EmailRow; person?: Person; account?: MailAccount; accColor?: string; // 계정별 구분 색(계정 tone 이 겹치므로 팔레트에서 배정) on: boolean; onClick: () => void; onStar: (id: string) => void; }) { // 표시 이름: 연락처(person) > 백엔드 표시이름(from_name) > 원문(from). 메일주소 대신 이름. const name = person?.name ?? (m.from_name || m.from); // 아바타는 '어느 계정' 표시 — 계정 색 + 계정 이니셜(색 dot 대신 명확하게). const accName = account?.name ?? m.account; const accInitial = accName.slice(0, 1).toUpperCase(); const color = accColor ?? (account?.tone ? `var(--${account.tone})` : "var(--muted)"); const showPills = m.ai && (m.ai.priority === "높음" || aiCount(m) > 0); return (
{accInitial}
{name} {m.time}
{m.subject}
{m.preview}
{showPills && m.ai && (
{m.ai.priority === "높음" && ( 중요 )} {m.ai.tasks.length > 0 && ( 할 일 {m.ai.tasks.length} )} {m.ai.events.length > 0 && ( 일정 {m.ai.events.length} )} {m.ai.replies.length > 0 && ( 답장 추천 )}
)}
{m.has_attach && ( )}
); }