Skip to content

Scheduling infrastructure for absolutely everyone.

feat: Removed offset start times feature from UI (#20634)

Avnish Jha10fa080b7f74
diff --git a/apps/web/playwright/eventType/limit-tab.e2e.ts b/apps/web/playwright/eventType/limit-tab.e2e.ts
index 9ec218e9b4e..32f3afd61a9 100644
--- a/apps/web/playwright/eventType/limit-tab.e2e.ts
+++ b/apps/web/playwright/eventType/limit-tab.e2e.ts
@@ -5,7 +5,7 @@ test.describe("Limits Tab - Event Type", () => {
test.beforeEach(async ({ page, users, bookingPage }) => {
await loginUser(users);
await page.goto("/event-types");
- await bookingPage.goToEventType("30 min");
+ await bookingPage.goToEventType("Offset Event");
await bookingPage.goToTab("event_limit_tab_title");
});
diff --git a/apps/web/playwright/fixtures/regularBookings.ts b/apps/web/playwright/fixtures/regularBookings.ts
index b587a5947e2..70dbaf1afcf 100644
--- a/apps/web/playwright/fixtures/regularBookings.ts
+++ b/apps/web/playwright/fixtures/regularBookings.ts
@@ -11,7 +11,17 @@ export const scheduleSuccessfullyText = "This meeting is scheduled";
type UserFixture = ReturnType<typeof createUsersFixture>;
export async function loginUser(users: UserFixture) {
- const pro = await users.create({ name: "testuser" });
+ const pro = await users.create({
+ name: "testuser",
+ eventTypes: [
+ {
+ title: "Offset Event",
+ slug: "offset-event",
+ length: 30,
+ offsetStart: 10,
+ },
+ ],
+ });
await pro.apiLogin();
}
@@ -191,7 +201,6 @@ export function createBookingPageFixture(page: Page) {
const offsetStartTimes = (await localize("en"))("offset_toggle");
const offsetLabel = page.getByLabel(offsetStart);
- await page.locator("fieldset").filter({ hasText: offsetStartTimes }).getByRole("switch").click();
await offsetLabel.fill("10");
await expect(offsetLabel).toHaveValue("10");
await expect(
diff --git a/packages/features/eventtypes/components/tabs/limits/EventLimitsTab.tsx b/packages/features/eventtypes/components/tabs/limits/EventLimitsTab.tsx
index 9d62f43e711..ffc2b4bf8f9 100644
--- a/packages/features/eventtypes/components/tabs/limits/EventLimitsTab.tsx
+++ b/packages/features/eventtypes/components/tabs/limits/EventLimitsTab.tsx
@@ -753,47 +753,50 @@ export const EventLimitsTab = ({ eventType, customClassNames }: EventLimitsTabPr
);
}}
/>
- <SettingsToggle
- labelClassName={classNames("text-sm", customClassNames?.offsetStartTimes?.label)}
- toggleSwitchAtTheEnd={true}
- switchContainerClassName={classNames(
- "border-subtle mt-6 rounded-lg border py-6 px-4 sm:px-6",
- offsetToggle && "rounded-b-none",
- customClassNames?.offsetStartTimes?.container
- )}
- childrenClassName={classNames("lg:ml-0", customClassNames?.offsetStartTimes?.children)}
- title={t("offset_toggle")}
- descriptionClassName={customClassNames?.offsetStartTimes?.description}
- description={t("offset_toggle_description")}
- {...offsetStartLockedProps}
- checked={offsetToggle}
- onCheckedChange={(active) => {
- setOffsetToggle(active);
- if (!active) {
- formMethods.setValue("offsetStart", 0, { shouldDirty: true });
- }
- }}>
- <div className={classNames("border-subtle rounded-b-lg border border-t-0 p-6")}>
- <TextField
- required
- type="number"
- containerClassName={classNames(
- "max-w-80",
- customClassNames?.offsetStartTimes?.offsetInput?.container
- )}
- labelClassName={customClassNames?.offsetStartTimes?.offsetInput?.label}
- addOnClassname={customClassNames?.offsetStartTimes?.offsetInput?.addOn}
- className={customClassNames?.offsetStartTimes?.offsetInput?.input}
- label={t("offset_start")}
- {...formMethods.register("offsetStart", { setValueAs: (value) => Number(value) })}
- addOnSuffix={<>{t("minutes")}</>}
- hint={t("offset_start_description", {
- originalTime: offsetOriginalTime.toLocaleTimeString(i18n.language, { timeStyle: "short" }),
- adjustedTime: offsetAdjustedTime.toLocaleTimeString(i18n.language, { timeStyle: "short" }),
- })}
- />
- </div>
- </SettingsToggle>
+
+ {eventType.offsetStart !== 0 && (
+ <SettingsToggle
+ labelClassName={classNames("text-sm", customClassNames?.offsetStartTimes?.label)}
+ toggleSwitchAtTheEnd={true}
+ switchContainerClassName={classNames(
+ "border-subtle mt-6 rounded-lg border py-6 px-4 sm:px-6",
+ offsetToggle && "rounded-b-none",
+ customClassNames?.offsetStartTimes?.container
+ )}
+ childrenClassName={classNames("lg:ml-0", customClassNames?.offsetStartTimes?.children)}
+ title={t("offset_toggle")}
+ descriptionClassName={customClassNames?.offsetStartTimes?.description}
+ description={t("offset_toggle_description")}
+ {...offsetStartLockedProps}
+ checked={offsetToggle}
+ onCheckedChange={(active) => {
+ setOffsetToggle(active);
+ if (!active) {
+ formMethods.setValue("offsetStart", 0, { shouldDirty: true });
+ }
+ }}>
+ <div className={classNames("border-subtle rounded-b-lg border border-t-0 p-6")}>
+ <TextField
+ required
+ type="number"
+ containerClassName={classNames(
+ "max-w-80",
+ customClassNames?.offsetStartTimes?.offsetInput?.container
+ )}
+ labelClassName={customClassNames?.offsetStartTimes?.offsetInput?.label}
+ addOnClassname={customClassNames?.offsetStartTimes?.offsetInput?.addOn}
+ className={customClassNames?.offsetStartTimes?.offsetInput?.input}
+ label={t("offset_start")}
+ {...formMethods.register("offsetStart", { setValueAs: (value) => Number(value) })}
+ addOnSuffix={<>{t("minutes")}</>}
+ hint={t("offset_start_description", {
+ originalTime: offsetOriginalTime.toLocaleTimeString(i18n.language, { timeStyle: "short" }),
+ adjustedTime: offsetAdjustedTime.toLocaleTimeString(i18n.language, { timeStyle: "short" }),
+ })}
+ />
+ </div>
+ </SettingsToggle>
+ )}
</div>
);
};