feat: add meta and seo tags for new booker component (#8697)

* feat: add hidden to select

* feat: add hide branding to store

* fix: remove branding from store

* feat: prefetch data

* feat: use meta tags

* fix: remove branding from store

* fix: prefetching

* refactor: useEvent hook

* fix: type

* fix :booker seo

* fix: type error

---------

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Jeroen Reumkens <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-05-11 16:02:13 +00:00
1 parent bdf3e34ea1
commit 74414db760
4 files changed
+64 -10

No files matched your search

@@ -0,0 +1,44 @@
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { HeadSeo } from "@calcom/ui";
interface BookerSeoProps {
username: string;
eventSlug: string;
rescheduleUid: string | undefined;
hideBranding?: boolean;
}
export const BookerSeo = (props: BookerSeoProps) => {
const { eventSlug, username, rescheduleUid, hideBranding } = props;
const { t } = useLocale();
const { data: event } = trpc.viewer.public.event.useQuery(
{ username, eventSlug },
{ refetchOnWindowFocus: false }
);
const profileName = event?.profile?.name ?? "";
const profileImage = event?.profile?.image;
const title = event?.title ?? "";
return (
<HeadSeo
title={`${rescheduleUid ? t("reschedule") : ""} ${title} | ${profileName}`}
description={`${rescheduleUid ? t("reschedule") : ""} ${title}`}
meeting={{
title: title,
profile: { name: profileName, image: profileImage },
users: [
...(event?.users || []).map((user) => ({
name: `${user.name}`,
username: `${user.username}`,
})),
],
}}
nextSeoProps={{
nofollow: event?.hidden,
noindex: event?.hidden,
}}
isBrandingHidden={hideBranding}
/>
);
};
@@ -59,6 +59,7 @@ const publicEventSelect = Prisma.validator<Prisma.EventTypeSelect>()({
},
},
owner: true,
hidden: true,
});
export const getPublicEvent = async (username: string, eventSlug: string, prisma: PrismaClient) => {