Skip to content

Scheduling infrastructure for absolutely everyone.

Implement the new Avatar interface to the teams page (#512)

Alex van Andelce64080160bf
diff --git a/components/team/screens/Team.tsx b/components/team/screens/Team.tsx
index b108d5cf1a0..04ecc75ff0d 100644
--- a/components/team/screens/Team.tsx
+++ b/components/team/screens/Team.tsx
@@ -37,7 +37,11 @@ const Team = ({ team }) => {
)}
/>
- <Avatar user={member.user} className="w-12 h-12 rounded-full" />
+ <Avatar
+ displayName={member.user.name}
+ imageSrc={member.user.avatar}
+ className="w-12 h-12 rounded-full"
+ />
<section className="space-y-2">
<Text variant="title">{member.user.name}</Text>
@@ -68,9 +72,8 @@ const Team = ({ team }) => {
<article className="flex flex-col space-y-8 lg:space-y-12">
<div className="mb-8 text-center">
<Avatar
- user={{
- email: team.name,
- }}
+ displayName={team.name}
+ imageSrc={team.logo}
className="mx-auto w-20 h-20 rounded-full mb-4"
/>
<Text variant="headline">{team.name}</Text>
diff --git a/lib/teams/getTeam.ts b/lib/teams/getTeam.ts
index 60939d0708c..7e631f4cedf 100644
--- a/lib/teams/getTeam.ts
+++ b/lib/teams/getTeam.ts
@@ -1,15 +1,9 @@
import { Team } from "@prisma/client";
import prisma from "@lib/prisma";
-import logger from "@lib/logger";
+import { defaultAvatarSrc } from "@lib/profile";
-const log = logger.getChildLogger({ prefix: ["[lib] getTeam"] });
export const getTeam = async (idOrSlug: string): Promise<Team | null> => {
const teamIdOrSlug = idOrSlug;
-
- let team = null;
-
- log.debug(`{teamIdOrSlug} ${teamIdOrSlug}`);
-
const teamSelectInput = {
id: true,
name: true,
@@ -34,7 +28,7 @@ export const getTeam = async (idOrSlug: string): Promise<Team | null> => {
},
};
- team = await prisma.team.findFirst({
+ const team = await prisma.team.findFirst({
where: {
OR: [
{
@@ -48,7 +42,10 @@ export const getTeam = async (idOrSlug: string): Promise<Team | null> => {
select: teamSelectInput,
});
- log.debug(`{team}`, { team });
+ team.members = team.members.map((member) => {
+ member.user.avatar = member.user.avatar || defaultAvatarSrc({ email: member.user.email });
+ return member;
+ });
return team;
};