fixes gravatar fallback for team collective events (#1759)

pull/1753/head^2
Syed Ali Shahbaz 2022-02-10 07:26:02 +05:30 committed by GitHub
parent 712dceb8cb
commit 97fdfc5d6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 8 deletions

View File

@ -0,0 +1,15 @@
declare module "@wojtekmaj/react-daterange-picker/dist/entry.nostyle" {
import { CalendarProps } from "react-calendar";
export type DateRangePickerCalendarProps = Omit<
CalendarProps,
"calendarClassName" | "onChange" | "value"
> & {
calendarClassName?: string;
onChange: (value: [Date, Date]) => void;
value: [Date, Date];
clearIcon: JSX.Element | null;
calendarIcon: JSX.Element | null;
rangeDivider: JSX.Element | null;
};
export default function DateRangePicker(props: DateRangePickerCalendarProps): JSX.Element;
}

View File

@ -126,7 +126,7 @@ const AvailabilityPage = ({ profile, eventType, workingHours }: Props) => {
.filter((user) => user.name !== profile.name)
.map((user) => ({
title: user.name,
image: user.avatar || undefined,
image: `${process.env.NEXT_PUBLIC_APP_URL}/${user.username}/avatar.png`,
alt: user.name || undefined,
})),
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
@ -175,7 +175,7 @@ const AvailabilityPage = ({ profile, eventType, workingHours }: Props) => {
.map((user) => ({
title: user.name,
alt: user.name,
image: user.avatar,
image: `${process.env.NEXT_PUBLIC_APP_URL}/${user.username}/avatar.png`,
})),
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
}

View File

@ -36,7 +36,6 @@ import getIntegrations, { hasIntegration } from "@lib/integrations/getIntegratio
import { LocationType } from "@lib/location";
import showToast from "@lib/notification";
import prisma from "@lib/prisma";
import { defaultAvatarSrc } from "@lib/profile";
import { trpc } from "@lib/trpc";
import { inferSSRProps } from "@lib/types/inferSSRProps";
@ -313,15 +312,15 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
const mapUserToValue = ({
id,
name,
avatar,
username,
}: {
id: number | null;
name: string | null;
avatar: string | null;
username: string | null;
}) => ({
value: `${id || ""}`,
label: `${name || ""}`,
avatar: `${avatar || ""}`,
avatar: `${process.env.NEXT_PUBLIC_APP_URL}/${username}/avatar.png`,
});
const formMethods = useForm<{
@ -1716,7 +1715,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const teamMembers = eventTypeObject.team
? eventTypeObject.team.members.map((member) => {
const user = member.user;
user.avatar = user.avatar || defaultAvatarSrc({ email: asStringOrUndefined(user.email) });
user.avatar = `${process.env.NEXT_PUBLIC_APP_URL}/${user.username}/avatar.png`;
return user;
})
: [];

View File

@ -153,7 +153,7 @@ const EventTypeList = ({ readOnly, types, profile }: EventTypeListProps): JSX.El
truncateAfter={4}
items={type.users.map((organizer) => ({
alt: organizer.name || "",
image: organizer.avatar || "",
image: `${process.env.NEXT_PUBLIC_APP_URL}/${organizer.username}/avatar.png`,
}))}
/>
)}

View File

@ -131,6 +131,7 @@ const loggedInViewerRouter = createProtectedRouter()
users: {
select: {
id: true,
username: true,
avatar: true,
name: true,
},