feat: Removed offset start times feature from UI (#20634)
* feat: Removed offset start times feature from UI * conditionally rendering offsetStart (#20622) * fixes for failing tests * fixes failing tests * failing test fixes
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user