Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70831e189d | |||
| eeded95940 |
+9
-5
@@ -72,7 +72,7 @@ const initialsOf = (name: string) =>
|
|||||||
/* ---- be-crm DTO types (subset used here) -------------------------------- */
|
/* ---- be-crm DTO types (subset used here) -------------------------------- */
|
||||||
|
|
||||||
interface RoleRef { id: string; slug: string; name: string; color: string | null; isSystem: boolean; isOwnerRole: boolean }
|
interface RoleRef { id: string; slug: string; name: string; color: string | null; isSystem: boolean; isOwnerRole: boolean }
|
||||||
interface MemberDTO { id: string; principalId: string; jobTitle: string | null; joinedAt: string; status: "active" | "deactivated"; roles: RoleRef[]; openDeals: number }
|
interface MemberDTO { id: string; principalId: string; jobTitle: string | null; joinedAt: string; status: "active" | "deactivated"; roles: RoleRef[]; openDeals: number; email?: string | null; firstName?: string | null; lastName?: string | null; displayName?: string | null }
|
||||||
interface RoleDTO { id: string; slug: string; name: string; description: string | null; color: string | null; isSystem: boolean; isOwnerRole: boolean; permissions: string[]; memberCount: number }
|
interface RoleDTO { id: string; slug: string; name: string; description: string | null; color: string | null; isSystem: boolean; isOwnerRole: boolean; permissions: string[]; memberCount: number }
|
||||||
interface InvitationDTO { id: string; email: string; roles: RoleRef[]; invitedBy: string; createdAt: string; token?: string }
|
interface InvitationDTO { id: string; email: string; roles: RoleRef[]; invitedBy: string; createdAt: string; token?: string }
|
||||||
|
|
||||||
@@ -158,12 +158,16 @@ function useLiveTeam(): TeamData {
|
|||||||
|
|
||||||
const members: UiMember[] = useMemo(() => (membersQ.data?.items ?? []).map((m) => {
|
const members: UiMember[] = useMemo(() => (membersQ.data?.items ?? []).map((m) => {
|
||||||
const isYou = !!meId && m.principalId === meId;
|
const isYou = !!meId && m.principalId === meId;
|
||||||
const name = isYou && user?.displayName
|
// Prefer the member's real name/email from their CRM registration; fall back to the
|
||||||
? user.displayName
|
// ACE (for the current user), then job title, then a short principal id.
|
||||||
: (m.jobTitle?.trim() || `Member ${m.principalId.replace(/^pp_/, "").slice(0, 6)}`);
|
const name = m.displayName?.trim()
|
||||||
|
|| (isYou && user?.displayName)
|
||||||
|
|| m.jobTitle?.trim()
|
||||||
|
|| `Member ${m.principalId.replace(/^pp_/, "").slice(0, 6)}`;
|
||||||
|
const email = m.email || (isYou ? user?.email : undefined) || "";
|
||||||
return {
|
return {
|
||||||
id: m.id, principalId: m.principalId, name, initials: initialsOf(name),
|
id: m.id, principalId: m.principalId, name, initials: initialsOf(name),
|
||||||
email: isYou && user?.email ? user.email : m.principalId,
|
email,
|
||||||
title: m.jobTitle ?? "", roleIds: m.roles.map((r) => r.id), gradient: gradientFor(m.id),
|
title: m.jobTitle ?? "", roleIds: m.roles.map((r) => r.id), gradient: gradientFor(m.id),
|
||||||
status: (m.status === "active" ? "active" : "offline") as UiStatus,
|
status: (m.status === "active" ? "active" : "offline") as UiStatus,
|
||||||
lastActive: m.status === "active" ? "Active" : "—",
|
lastActive: m.status === "active" ? "Active" : "—",
|
||||||
|
|||||||
Reference in New Issue
Block a user