diff --git a/src/pages/ProjectDetail.tsx b/src/pages/ProjectDetail.tsx index 6e33db8..22a9233 100644 --- a/src/pages/ProjectDetail.tsx +++ b/src/pages/ProjectDetail.tsx @@ -540,6 +540,23 @@ function MailTab({ projectId }: { projectId: string }) { ); } +// "Name " 또는 "a@b" → 표시용 짧은 이름(이름 또는 @앞) +function addrName(a: string): string { + a = a.trim(); + const m = a.match(/^"?([^"<]+?)"?\s*<[^>]*>$/); + if (m) return m[1].trim(); + const at = a.indexOf("@"); + return at > 0 ? a.slice(0, at) : a; +} +// 수신자(받는사람+참조)가 많으면 "둘 + 외 N명"으로 줄이고, 전체는 title(hover)로. +function recipientSummary(to: string, cc: string) { + const parts = `${to},${cc}`.split(",").map((s) => s.trim()).filter(Boolean); + const names = parts.map(addrName); + const full = parts.join(", "); + const short = names.length <= 2 ? names.join(", ") : `${names.slice(0, 2).join(", ")} 외 ${names.length - 2}명`; + return { short: short || "—", full: full || "—" }; +} + function MailRow({ projectId, mail, nameOf }: { projectId: string; mail: ProjectMail; nameOf: (e?: string | null) => string }) { const qc = useQueryClient(); const [open, setOpen] = useState(false); @@ -549,52 +566,56 @@ function MailRow({ projectId, mail, nameOf }: { projectId: string; mail: Project const save = useMutation({ mutationFn: () => putMailNote(projectId, mail.messageId, memo), onSuccess: invalidate }); const hide = useMutation({ mutationFn: () => hideMail(projectId, mail.messageId, !mail.hidden), onSuccess: invalidate }); const when = mail.ts ? formatDateTime(new Date(mail.ts).toISOString()) : mail.date; + const rcpt = recipientSummary(mail.to, mail.cc); return ( -
- - -
- {when} - + +
+ {when} + +
+
+ {/* 메모 열 — 클릭 전에도 항상 보이고 바로 요약을 적을 수 있다 */} +
+