fixes gravatar fallback for team collective events (#1759)
This commit is contained in:
parent
712dceb8cb
commit
97fdfc5d6b
5 changed files with 23 additions and 8 deletions
15
@types/@wojtekmaj__react-daterange-picker.d.ts
vendored
Normal file
15
@types/@wojtekmaj__react-daterange-picker.d.ts
vendored
Normal 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;
|
||||||
|
}
|
|
@ -126,7 +126,7 @@ const AvailabilityPage = ({ profile, eventType, workingHours }: Props) => {
|
||||||
.filter((user) => user.name !== profile.name)
|
.filter((user) => user.name !== profile.name)
|
||||||
.map((user) => ({
|
.map((user) => ({
|
||||||
title: user.name,
|
title: user.name,
|
||||||
image: user.avatar || undefined,
|
image: `${process.env.NEXT_PUBLIC_APP_URL}/${user.username}/avatar.png`,
|
||||||
alt: user.name || undefined,
|
alt: user.name || undefined,
|
||||||
})),
|
})),
|
||||||
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
|
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
|
||||||
|
@ -175,7 +175,7 @@ const AvailabilityPage = ({ profile, eventType, workingHours }: Props) => {
|
||||||
.map((user) => ({
|
.map((user) => ({
|
||||||
title: user.name,
|
title: user.name,
|
||||||
alt: 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 }[]
|
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import getIntegrations, { hasIntegration } from "@lib/integrations/getIntegratio
|
||||||
import { LocationType } from "@lib/location";
|
import { LocationType } from "@lib/location";
|
||||||
import showToast from "@lib/notification";
|
import showToast from "@lib/notification";
|
||||||
import prisma from "@lib/prisma";
|
import prisma from "@lib/prisma";
|
||||||
import { defaultAvatarSrc } from "@lib/profile";
|
|
||||||
import { trpc } from "@lib/trpc";
|
import { trpc } from "@lib/trpc";
|
||||||
import { inferSSRProps } from "@lib/types/inferSSRProps";
|
import { inferSSRProps } from "@lib/types/inferSSRProps";
|
||||||
|
|
||||||
|
@ -313,15 +312,15 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
||||||
const mapUserToValue = ({
|
const mapUserToValue = ({
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
avatar,
|
username,
|
||||||
}: {
|
}: {
|
||||||
id: number | null;
|
id: number | null;
|
||||||
name: string | null;
|
name: string | null;
|
||||||
avatar: string | null;
|
username: string | null;
|
||||||
}) => ({
|
}) => ({
|
||||||
value: `${id || ""}`,
|
value: `${id || ""}`,
|
||||||
label: `${name || ""}`,
|
label: `${name || ""}`,
|
||||||
avatar: `${avatar || ""}`,
|
avatar: `${process.env.NEXT_PUBLIC_APP_URL}/${username}/avatar.png`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const formMethods = useForm<{
|
const formMethods = useForm<{
|
||||||
|
@ -1716,7 +1715,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||||
const teamMembers = eventTypeObject.team
|
const teamMembers = eventTypeObject.team
|
||||||
? eventTypeObject.team.members.map((member) => {
|
? eventTypeObject.team.members.map((member) => {
|
||||||
const user = member.user;
|
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;
|
return user;
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
|
|
|
@ -153,7 +153,7 @@ const EventTypeList = ({ readOnly, types, profile }: EventTypeListProps): JSX.El
|
||||||
truncateAfter={4}
|
truncateAfter={4}
|
||||||
items={type.users.map((organizer) => ({
|
items={type.users.map((organizer) => ({
|
||||||
alt: organizer.name || "",
|
alt: organizer.name || "",
|
||||||
image: organizer.avatar || "",
|
image: `${process.env.NEXT_PUBLIC_APP_URL}/${organizer.username}/avatar.png`,
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -131,6 +131,7 @@ const loggedInViewerRouter = createProtectedRouter()
|
||||||
users: {
|
users: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
username: true,
|
||||||
avatar: true,
|
avatar: true,
|
||||||
name: true,
|
name: true,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue