feat: display formatted email if member has not set display name

This commit is contained in:
Henry
2025-01-31 16:47:45 +00:00
parent 7db21596f1
commit e421b4326c
7 changed files with 108 additions and 43 deletions

View File

@@ -28,3 +28,17 @@ export const getInitialsFromName = (name: string) => {
.map((namePart) => namePart.charAt(0).toUpperCase())
.join("");
};
export const formatMemberDisplayName = (
name: string | null,
email: string | null,
) => {
if (name) return name;
if (!email) return "";
const localPart = email.split("@")[0];
if (!localPart) return "";
return localPart.replace(/[_-]/g, ".");
};