Scheduling infrastructure for absolutely everyone.
Replaces member avatars with links to avatar.png endpoint (#2708)
Alex van Andeledd99cdeb262
diff --git a/apps/web/components/team/MemberListItem.tsx b/apps/web/components/team/MemberListItem.tsxindex 1716a3bf0a5..333319268b0 100644--- a/apps/web/components/team/MemberListItem.tsx+++ b/apps/web/components/team/MemberListItem.tsx@@ -4,6 +4,7 @@ import { MembershipRole } from "@prisma/client";import Link from "next/link";import { useState } from "react";+import { WEBSITE_URL } from "@calcom/lib/constants";import { useLocale } from "@calcom/lib/hooks/useLocale";import showToast from "@calcom/lib/notification";import Button from "@calcom/ui/Button";@@ -17,7 +18,6 @@ import Dropdown, {import { Tooltip } from "@calcom/ui/Tooltip";import TeamAvailabilityModal from "@ee/components/team/availability/TeamAvailabilityModal";-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";import useCurrentUserId from "@lib/hooks/useCurrentUserId";import { inferQueryOutput, trpc } from "@lib/trpc";@@ -74,7 +74,7 @@ export default function MemberListItem(props: Props) {<div className="flex w-full flex-col justify-between sm:flex-row"><div className="flex"><Avatar- imageSrc={getPlaceholderAvatar(props.member?.avatar, name)}+ imageSrc={WEBSITE_URL + "/" + props.member.username + "/avatar.png"}alt={name || ""}className="h-9 w-9 rounded-full"/>diff --git a/apps/web/components/team/screens/Team.tsx b/apps/web/components/team/screens/Team.tsxindex f04707bf2d1..a7a26338c34 100644--- a/apps/web/components/team/screens/Team.tsx+++ b/apps/web/components/team/screens/Team.tsx@@ -5,9 +5,9 @@ import Link from "next/link";import { TeamPageProps } from "pages/team/[slug]";import React from "react";+import { WEBSITE_URL } from "@calcom/lib/constants";import Button from "@calcom/ui/Button";-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";import { useLocale } from "@lib/hooks/useLocale";import Avatar from "@components/ui/Avatar";@@ -52,7 +52,7 @@ const Team = ({ team }: TeamPageProps) => {<div><Avataralt={member.name || ""}- imageSrc={getPlaceholderAvatar(member.avatar, member.username)}+ imageSrc={WEBSITE_URL + "/" + member.username + "/avatar.png"}className="-mt-4 h-12 w-12"/><section className="mt-2 w-full space-y-1">diff --git a/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx b/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsxindex bb7c3ae9242..0b8ece47cee 100644--- a/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx+++ b/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx@@ -3,7 +3,8 @@ import utc from "dayjs/plugin/utc";import React, { useState, useEffect } from "react";import TimezoneSelect, { ITimezone } from "react-timezone-select";-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";+import { WEBSITE_URL } from "@calcom/lib/constants";+import { trpc, inferQueryOutput } from "@lib/trpc";import Avatar from "@components/ui/Avatar";@@ -36,7 +37,7 @@ export default function TeamAvailabilityModal(props: Props) {<div className="min-w-64 w-64 space-y-5 p-5 pr-0"><div className="flex"><Avatar- imageSrc={getPlaceholderAvatar(props.member?.avatar, props.member?.name as string)}+ imageSrc={WEBSITE_URL + "/" + props.member?.username + "/avatar.png"}alt={props.member?.name || ""}className="h-14 w-14 rounded-full"/>diff --git a/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx b/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsxindex a5b5697754c..83b81e9d4ea 100644--- a/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx+++ b/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx@@ -4,7 +4,8 @@ import TimezoneSelect, { ITimezone } from "react-timezone-select";import AutoSizer from "react-virtualized-auto-sizer";import { FixedSizeList as List } from "react-window";-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";+import { WEBSITE_URL } from "@calcom/lib/constants";+import { trpc, inferQueryOutput } from "@lib/trpc";import Avatar from "@components/ui/Avatar";@@ -45,7 +46,7 @@ export default function TeamAvailabilityScreen(props: Props) {HeaderComponent={<div className="mb-6 flex items-center"><Avatar- imageSrc={getPlaceholderAvatar(member?.avatar, member?.name as string)}+ imageSrc={WEBSITE_URL + "/" + member.username + "/avatar.png"}alt={member?.name || ""}className="min-w-10 min-h-10 mt-1 h-10 w-10 rounded-full"/>diff --git a/apps/web/lib/queries/teams/index.ts b/apps/web/lib/queries/teams/index.tsindex 879bfa49f5c..b25869d5507 100644--- a/apps/web/lib/queries/teams/index.ts+++ b/apps/web/lib/queries/teams/index.ts@@ -11,7 +11,6 @@ export type TeamWithMembers = AsyncReturnType<typeof getTeamWithMembers>;export async function getTeamWithMembers(id?: number, slug?: string) {const userSelect = Prisma.validator<Prisma.UserSelect>()({username: true,- avatar: true,email: true,name: true,id: true,diff --git a/apps/web/pages/team/[slug].tsx b/apps/web/pages/team/[slug].tsxindex c6c9f5d6114..90a3ba4d6f3 100644--- a/apps/web/pages/team/[slug].tsx+++ b/apps/web/pages/team/[slug].tsx@@ -6,6 +6,7 @@ import Link from "next/link";import React, { useEffect } from "react";import { useIsEmbed } from "@calcom/embed-core";+import { WEBSITE_URL } from "@calcom/lib/constants";import Button from "@calcom/ui/Button";import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";@@ -13,7 +14,6 @@ import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally";import { useLocale } from "@lib/hooks/useLocale";import useTheme from "@lib/hooks/useTheme";import { useToggleQuery } from "@lib/hooks/useToggleQuery";-import { defaultAvatarSrc } from "@lib/profile";import { getTeamWithMembers } from "@lib/queries/teams";import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";import { inferSSRProps } from "@lib/types/inferSSRProps";@@ -68,7 +68,7 @@ function TeamPage({ team }: TeamPageProps) {size={10}items={type.users.map((user) => ({alt: user.name || "",- image: user.avatar || "",+ image: WEBSITE_URL + "/" + user.username + "/avatar.png" || "",}))}/></div>@@ -147,7 +147,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>...type,users: type.users.map((user) => ({...user,- avatar: user.avatar || defaultAvatarSrc({ email: user.email || "" }),+ avatar: WEBSITE_URL + "/" + user.username + "/avatar.png",})),}));