profile picture
This commit is contained in:
@@ -91,19 +91,28 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange, taskDetail, task
|
||||
page.data?.users?.map((user: UserItemType) => ({
|
||||
id: user.id,
|
||||
name: `${user.firstName} ${user.lastName}`.trim(),
|
||||
avatar: user.profilePic,
|
||||
})) ?? [],
|
||||
) ?? [];
|
||||
const taskUsers: TaskUser[] =
|
||||
taskDetail?.users?.map((user) => ({
|
||||
id: user.id,
|
||||
name: `${user.firstName} ${user.lastName}`.trim(),
|
||||
avatar: user.profilePic,
|
||||
})) ?? [];
|
||||
const userMap = new Map<string, TaskUser>(apiUsers.map((user) => [user.id, user]));
|
||||
|
||||
taskUsers.forEach((user) => {
|
||||
if (!userMap.has(user.id)) {
|
||||
userMap.set(user.id, user);
|
||||
const existing = userMap.get(user.id);
|
||||
|
||||
if (existing) {
|
||||
if (!existing.avatar && user.avatar) {
|
||||
userMap.set(user.id, { ...existing, avatar: user.avatar });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
userMap.set(user.id, user);
|
||||
});
|
||||
|
||||
return Array.from(userMap.values());
|
||||
@@ -115,6 +124,7 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange, taskDetail, task
|
||||
page.data?.users?.map((user: UserItemType) => ({
|
||||
id: user.id,
|
||||
name: `${user.firstName} ${user.lastName}`.trim(),
|
||||
avatar: user.profilePic,
|
||||
})) ?? [],
|
||||
) ?? []
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user