From 2fbc06314e27681a83d737975aa40c97e3e0a022 Mon Sep 17 00:00:00 2001 From: Amit Sharma <74371312+Amit91848@users.noreply.github.com> Date: Fri, 26 Apr 2024 19:48:29 +0530 Subject: [PATCH] feat: Hide recurring tab when payments are enabled (#14731) Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> --- .../eventtype/EventTypeSingleLayout.tsx | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/apps/web/components/eventtype/EventTypeSingleLayout.tsx b/apps/web/components/eventtype/EventTypeSingleLayout.tsx index 821734c3c3..86bca3a700 100644 --- a/apps/web/components/eventtype/EventTypeSingleLayout.tsx +++ b/apps/web/components/eventtype/EventTypeSingleLayout.tsx @@ -10,6 +10,7 @@ import { EventTypeEmbedButton, EventTypeEmbedDialog } from "@calcom/features/emb import type { FormValues, AvailabilityOption } from "@calcom/features/eventtypes/lib/types"; import Shell from "@calcom/features/shell/Shell"; import { classNames } from "@calcom/lib"; +import getPaymentAppData from "@calcom/lib/getPaymentAppData"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { HttpError } from "@calcom/lib/http-error"; import { SchedulingType } from "@calcom/prisma/enums"; @@ -95,12 +96,6 @@ function getNavigation({ icon: "sliders-vertical", info: `event_advanced_tab_description`, }, - { - name: "recurring", - href: `/event-types/${id}?tabName=recurring`, - icon: "repeat", - info: `recurring_event_tab_description`, - }, { name: "apps", href: `/event-types/${id}?tabName=apps`, @@ -209,6 +204,10 @@ function EventTypeSingleLayout({ const watchSchedulingType = formMethods.watch("schedulingType"); const watchChildrenCount = formMethods.watch("children").length; + + const paymentAppData = getPaymentAppData(eventType); + const requirePayment = paymentAppData.price > 0; + // Define tab navigation here const EventTypeTabs = useMemo(() => { const navigation: VerticalTabItemProps[] = getNavigation({ @@ -222,6 +221,14 @@ function EventTypeSingleLayout({ availability, }); + if (!requirePayment) { + navigation.splice(3, 0, { + name: "recurring", + href: `/event-types/${formMethods.getValues("id")}?tabName=recurring`, + icon: "repeat", + info: `recurring_event_tab_description`, + }); + } navigation.splice(1, 0, { name: "availability", href: `/event-types/${formMethods.getValues("id")}?tabName=availability`, @@ -287,6 +294,7 @@ function EventTypeSingleLayout({ isChildrenManagedEventType, team, length, + requirePayment, multipleDuration, formMethods.getValues("id"), watchSchedulingType,