refactor: v2 event-types (#15457)
* refactor: UserAvatarGroupWithOrg.tsx remove unecessary profile prop * chore: define event-type types in platform/types * feat: event-type transformes in lib and re-exported through platform-libraries * chore: define user types in platform/types * chore: add users endpoint to platform-constants * refactor: app-store use narrowed down booker event type * chore: version old event-types module * fix: old event-types e2e test * fix: libraries add missing export * fix: reset libraries version to 0 * feat: new event-types module and users endpoints * feat: make booker atom work with v2 event-types * updating event type * refactor: remove guard for get event-types * refactor: move private hook to public * Revert "refactor: remove guard for get event-types" This reverts commit d41204069f1d5bb1305b388ce53399f9175f4249. * Revert "refactor: move private hook to public" This reverts commit 09322e8fba102e57104959f79ed6bfa9a677dc9d. * refactor: get by username and slug in /event-types * remove console log * feat: locations handle displayEventPublicly * test e2e event-types * revert: user output from types * refactor: event-types hooks have private and public folders * refactor: require event-type.slug in input * refactor: demand that all labels of booking fields are unique * refactor: remove unused import * refactor: only have email and name by default in booker * refactor: add booking field slug * fix: display event-type location publicly / hide it in booker * fix: display event-type location publicly / hide it in booker * fix: packages/lib tests * fix: typescript in e2e test * fix: dynamic event types input * refactor: use IsIn instead of IsEnum * refactor: simplify getEventTypes * fix: use ApiAuthGuard instead of AccessTokenGuard * chore: export more stuff from libraries * refactor: SchedulingTypeEnum and Type --------- Co-authored-by: Morgan <[email protected]>
This commit is contained in:
1 parent
c7a96e1b43
commit
0072aba55d
122 files changed
+4738
-523
No files matched your search
@@ -4,7 +4,7 @@ import { Inter } from "next/font/google";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
|
||||
import { Booker, useEventTypesPublic } from "@calcom/atoms";
|
||||
import { Booker, useEventTypes } from "@calcom/atoms";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function Bookings(props: { calUsername: string; calEmail: string
|
||||
const [eventTypeSlug, setEventTypeSlug] = useState<string | null>(null);
|
||||
const [eventTypeDuration, setEventTypeDuration] = useState<number | null>(null);
|
||||
const router = useRouter();
|
||||
const { isLoading: isLoadingEvents, data: eventTypes } = useEventTypesPublic(props.calUsername);
|
||||
const { isLoading: isLoadingEvents, data: eventTypes } = useEventTypes(props.calUsername);
|
||||
const rescheduleUid = (router.query.rescheduleUid as string) ?? "";
|
||||
const eventTypeSlugQueryParam = (router.query.eventTypeSlug as string) ?? "";
|
||||
|
||||
@@ -28,26 +28,28 @@ export default function Bookings(props: { calUsername: string; calEmail: string
|
||||
|
||||
{!isLoadingEvents && !eventTypeSlug && Boolean(eventTypes?.length) && !rescheduleUid && (
|
||||
<div className="flex flex-col gap-4">
|
||||
{eventTypes?.map((event: { id: number; slug: string; title: string; length: number }) => {
|
||||
const formatEventSlug = event.slug
|
||||
.split("-")
|
||||
.map((item) => `${item[0].toLocaleUpperCase()}${item.slice(1)}`)
|
||||
.join(" ");
|
||||
{eventTypes?.map(
|
||||
(event: { id: number; slug: string; title: string; lengthInMinutes: number }) => {
|
||||
const formatEventSlug = event.slug
|
||||
.split("-")
|
||||
.map((item) => `${item[0].toLocaleUpperCase()}${item.slice(1)}`)
|
||||
.join(" ");
|
||||
|
||||
return (
|
||||
<div
|
||||
onClick={() => {
|
||||
setEventTypeSlug(event.slug);
|
||||
setEventTypeDuration(event.length);
|
||||
}}
|
||||
className="mx-10 w-[80vw] cursor-pointer rounded-md border-[0.8px] border-black px-10 py-4"
|
||||
key={event.id}>
|
||||
<h1 className="text-lg font-semibold">{formatEventSlug}</h1>
|
||||
<p>{`/${event.slug}`}</p>
|
||||
<span className="border-none bg-gray-800 px-2 text-white">{event?.length}</span>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
return (
|
||||
<div
|
||||
onClick={() => {
|
||||
setEventTypeSlug(event.slug);
|
||||
setEventTypeDuration(event.lengthInMinutes);
|
||||
}}
|
||||
className="mx-10 w-[80vw] cursor-pointer rounded-md border-[0.8px] border-black px-10 py-4"
|
||||
key={event.id}>
|
||||
<h1 className="text-lg font-semibold">{formatEventSlug}</h1>
|
||||
<p>{`/${event.slug}`}</p>
|
||||
<span className="border-none bg-gray-800 px-2 text-white">{event?.lengthInMinutes}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in new issue
Block a user