feat: link advanced event type settings to docs (#24629)
* feat: link advanced event type settings to docs * Limits and Assignment tab settings * remove testing code * add noopener noreferrer rel to links --------- Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
1 parent
6beb279a27
commit
9d1cf3e70e
9 files changed
+169
-33
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import type { TFunction } from "i18next";
|
||||
import Link from "next/link";
|
||||
|
||||
import ServerTrans from "@calcom/lib/components/ServerTrans";
|
||||
import { IS_CALCOM } from "@calcom/lib/constants";
|
||||
|
||||
type LearnMoreLinkProps = {
|
||||
t: TFunction;
|
||||
i18nKey: string;
|
||||
href: string;
|
||||
};
|
||||
|
||||
export const LearnMoreLink = ({ t, i18nKey, href }: LearnMoreLinkProps) => {
|
||||
if (!IS_CALCOM) {
|
||||
const text = t(i18nKey)
|
||||
.replace(/<0>[\s\S]*?<\/0>/g, "")
|
||||
.trim();
|
||||
return <>{text}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<ServerTrans
|
||||
t={t}
|
||||
i18nKey={i18nKey}
|
||||
components={[
|
||||
<Link
|
||||
key={i18nKey}
|
||||
className="underline underline-offset-2"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={href}>
|
||||
Learn more
|
||||
</Link>,
|
||||
]}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -3,5 +3,6 @@ import dynamic from "next/dynamic";
|
||||
export { default as CheckedTeamSelect } from "./CheckedTeamSelect";
|
||||
export { CreateEventTypeDialog } from "./CreateEventTypeDialog";
|
||||
export { default as EventTypeDescription } from "./EventTypeDescription";
|
||||
export { LearnMoreLink } from "./LearnMoreLink";
|
||||
export { MultiplePrivateLinksController } from "./MultiplePrivateLinksController";
|
||||
export const EventTypeDescriptionLazy = dynamic(() => import("./EventTypeDescription"));
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
allowDisablingHostConfirmationEmails,
|
||||
} from "@calcom/features/ee/workflows/lib/allowDisablingStandardEmails";
|
||||
import { MultiplePrivateLinksController } from "@calcom/features/eventtypes/components";
|
||||
import { LearnMoreLink } from "@calcom/features/eventtypes/components/LearnMoreLink";
|
||||
import type { EventNameObjectType } from "@calcom/features/eventtypes/lib/eventNaming";
|
||||
import { getEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
||||
import type {
|
||||
@@ -638,7 +639,11 @@ export const EventAdvancedTab = ({
|
||||
{t("booking_questions_title")}
|
||||
</div>
|
||||
<p className="text-subtle mt-1 max-w-[280px] break-words text-sm sm:max-w-[500px]">
|
||||
{t("booking_questions_description")}
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="booking_questions_description"
|
||||
href="https://cal.com/help/event-types/booking-questions"
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
<div className="border-subtle bg-default rounded-lg border p-5">
|
||||
@@ -689,7 +694,13 @@ export const EventAdvancedTab = ({
|
||||
title={t("disable_cancelling")}
|
||||
data-testid="disable-cancelling-toggle"
|
||||
{...disableCancellingLocked}
|
||||
description={t("description_disable_cancelling")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="description_disable_cancelling"
|
||||
href="https://cal.com/help/event-types/disable-canceling-rescheduling#disable-cancelling"
|
||||
/>
|
||||
}
|
||||
checked={disableCancelling}
|
||||
onCheckedChange={(val) => {
|
||||
setDisableCancelling(val);
|
||||
@@ -709,7 +720,13 @@ export const EventAdvancedTab = ({
|
||||
title={t("disable_rescheduling")}
|
||||
data-testid="disable-rescheduling-toggle"
|
||||
{...disableReschedulingLocked}
|
||||
description={t("description_disable_rescheduling")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="description_disable_rescheduling"
|
||||
href="https://cal.com/help/event-types/disable-canceling-rescheduling#disable-rescheduling"
|
||||
/>
|
||||
}
|
||||
checked={disableRescheduling}
|
||||
onCheckedChange={(val) => {
|
||||
setDisableRescheduling(val);
|
||||
@@ -841,7 +858,13 @@ export const EventAdvancedTab = ({
|
||||
data-testid="disable-notes"
|
||||
title={t("disable_notes")}
|
||||
{...hideCalendarNotesLocked}
|
||||
description={t("disable_notes_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="disable_notes_description"
|
||||
href="https://cal.com/help/event-types/hide-notes"
|
||||
/>
|
||||
}
|
||||
checked={value}
|
||||
onCheckedChange={(e) => onChange(e)}
|
||||
/>
|
||||
@@ -958,7 +981,13 @@ export const EventAdvancedTab = ({
|
||||
data-testid="multiplePrivateLinksCheck"
|
||||
title={t("multiple_private_links_title")}
|
||||
{...multiplePrivateLinksLocked}
|
||||
description={t("multiple_private_links_description", { appName: APP_NAME })}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="multiple_private_links_description"
|
||||
href="https://cal.com/help/event-types/private-links"
|
||||
/>
|
||||
}
|
||||
tooltip={isManagedEventType ? t("managed_event_field_parent_control_disabled") : ""}
|
||||
checked={multiplePrivateLinksVisible}
|
||||
onCheckedChange={(e) => {
|
||||
@@ -1005,7 +1034,13 @@ export const EventAdvancedTab = ({
|
||||
data-testid="offer-seats-toggle"
|
||||
title={t("offer_seats")}
|
||||
{...seatsLocked}
|
||||
description={t("offer_seats_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="offer_seats_description"
|
||||
href="https://cal.com/help/event-types/offer-seats"
|
||||
/>
|
||||
}
|
||||
checked={value}
|
||||
disabled={noShowFeeEnabled || multiLocation || (!seatsEnabled && isRecurringEvent)}
|
||||
tooltip={
|
||||
@@ -1131,7 +1166,13 @@ export const EventAdvancedTab = ({
|
||||
)}
|
||||
title={t("hide_organizer_email")}
|
||||
{...hideOrganizerEmailLocked}
|
||||
description={t("hide_organizer_email_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="hide_organizer_email_description"
|
||||
href="https://cal.com/help/event-types/hideorganizersemail#hide-organizers-email"
|
||||
/>
|
||||
}
|
||||
descriptionClassName={customClassNames?.hideOrganizerEmail?.description}
|
||||
checked={value}
|
||||
onCheckedChange={(e) => onChange(e)}
|
||||
@@ -1161,7 +1202,13 @@ export const EventAdvancedTab = ({
|
||||
)}
|
||||
title={t("lock_timezone_toggle_on_booking_page")}
|
||||
{...lockTimeZoneToggleOnBookingPageLocked}
|
||||
description={t("description_lock_timezone_toggle_on_booking_page")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="description_lock_timezone_toggle_on_booking_page"
|
||||
href="https://cal.com/help/event-types/timezone-lock"
|
||||
/>
|
||||
}
|
||||
checked={value}
|
||||
onCheckedChange={(e) => {
|
||||
onChange(e);
|
||||
@@ -1208,7 +1255,13 @@ export const EventAdvancedTab = ({
|
||||
switchContainerClassName={classNames("border-subtle rounded-lg border py-6 px-4 sm:px-6")}
|
||||
title={t("allow_rescheduling_past_events")}
|
||||
{...reschedulingPastBookingsLocked}
|
||||
description={t("allow_rescheduling_past_events_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="allow_rescheduling_past_events_description"
|
||||
href="https://cal.com/help/event-types/allow-rescheduling"
|
||||
/>
|
||||
}
|
||||
checked={value}
|
||||
onCheckedChange={(e) => onChange(e)}
|
||||
/>
|
||||
@@ -1376,7 +1429,13 @@ export const EventAdvancedTab = ({
|
||||
toggleSwitchAtTheEnd={true}
|
||||
labelClassName="text-sm"
|
||||
title={t("show_optimized_slots")}
|
||||
description={t("show_optimized_slots_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="show_optimized_slots_description"
|
||||
href="https://cal.com/help/event-types/optimized-slots#optimized-slots"
|
||||
/>
|
||||
}
|
||||
checked={isChecked}
|
||||
{...showOptimizedSlotsLocked}
|
||||
onCheckedChange={(active) => {
|
||||
|
||||
+8
-1
@@ -6,6 +6,7 @@ import { Controller, useFormContext } from "react-hook-form";
|
||||
import type z from "zod";
|
||||
|
||||
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
|
||||
import { LearnMoreLink } from "@calcom/features/eventtypes/components/LearnMoreLink";
|
||||
import type { EventTypeSetup, SettingsToggleClassNames } from "@calcom/features/eventtypes/lib/types";
|
||||
import type { FormValues } from "@calcom/features/eventtypes/lib/types";
|
||||
import ServerTrans from "@calcom/lib/components/ServerTrans";
|
||||
@@ -99,7 +100,13 @@ export default function RequiresConfirmationController({
|
||||
data-testid="requires-confirmation"
|
||||
disabled={seatsEnabled || requiresConfirmationLockedProps.disabled}
|
||||
tooltip={seatsEnabled ? t("seat_options_doesnt_support_confirmation") : undefined}
|
||||
description={t("requires_confirmation_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="requires_confirmation_description"
|
||||
href="https://cal.com/help/event-types/how-to-requires"
|
||||
/>
|
||||
}
|
||||
checked={requiresConfirmation}
|
||||
LockedIcon={requiresConfirmationLockedProps.LockedIcon}
|
||||
onCheckedChange={(val) => {
|
||||
|
||||
@@ -14,6 +14,7 @@ import AssignAllTeamMembers from "@calcom/features/eventtypes/components/AssignA
|
||||
import type { ChildrenEventTypeSelectCustomClassNames } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
|
||||
import ChildrenEventTypeSelect from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
|
||||
import { sortHosts } from "@calcom/features/eventtypes/components/HostEditDialogs";
|
||||
import { LearnMoreLink } from "@calcom/features/eventtypes/components/LearnMoreLink";
|
||||
import type {
|
||||
FormValues,
|
||||
TeamMember,
|
||||
@@ -477,7 +478,11 @@ const RoundRobinHosts = ({
|
||||
"text-subtle max-w-full break-words text-sm leading-tight",
|
||||
customClassNames?.description
|
||||
)}>
|
||||
{hostGroups?.length > 0 ? t("round_robin_groups_helper") : t("round_robin_helper")}
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey={hostGroups?.length > 0 ? "round_robin_groups_helper" : "round_robin_helper"}
|
||||
href="https://cal.com/help/event-types/round-robin"
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
<Button color="secondary" size="sm" StartIcon="plus" onClick={handleAddGroup}>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Controller, useFormContext } from "react-hook-form";
|
||||
import type { SingleValue } from "react-select";
|
||||
|
||||
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
|
||||
import { LearnMoreLink } from "@calcom/features/eventtypes/components/LearnMoreLink";
|
||||
import { getDefinedBufferTimes } from "@calcom/features/eventtypes/lib/getDefinedBufferTimes";
|
||||
import type { FormValues, EventTypeSetupProps, InputClassNames } from "@calcom/features/eventtypes/lib/types";
|
||||
import type { SelectClassNames, SettingsToggleClassNames } from "@calcom/features/eventtypes/lib/types";
|
||||
@@ -594,7 +595,13 @@ export const EventLimitsTab = ({ eventType, customClassNames }: EventLimitsTabPr
|
||||
labelClassName={classNames("text-sm", customClassNames?.bookingFrequencyLimit?.label)}
|
||||
title={t("limit_booking_frequency")}
|
||||
{...bookingLimitsLocked}
|
||||
description={t("limit_booking_frequency_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="limit_booking_frequency_description"
|
||||
href="https://cal.com/help/event-types/booking-frequency"
|
||||
/>
|
||||
}
|
||||
checked={isChecked}
|
||||
onCheckedChange={(active) => {
|
||||
if (active) {
|
||||
@@ -725,7 +732,13 @@ export const EventLimitsTab = ({ eventType, customClassNames }: EventLimitsTabPr
|
||||
childrenClassName={classNames("lg:ml-0", customClassNames?.futureBookingLimit?.children)}
|
||||
descriptionClassName={customClassNames?.futureBookingLimit?.description}
|
||||
title={t("limit_future_bookings")}
|
||||
description={t("limit_future_bookings_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="limit_future_bookings_description"
|
||||
href="https://cal.com/help/event-types/limit-future-bookings"
|
||||
/>
|
||||
}
|
||||
{...periodTypeLocked}
|
||||
checked={isChecked}
|
||||
onCheckedChange={(isEnabled) => {
|
||||
|
||||
+8
-1
@@ -1,6 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import { Controller, useFormContext } from "react-hook-form";
|
||||
|
||||
import { LearnMoreLink } from "@calcom/features/eventtypes/components/LearnMoreLink";
|
||||
import type { FormValues } from "@calcom/features/eventtypes/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
@@ -48,7 +49,13 @@ export default function MaxActiveBookingsPerBookerController({
|
||||
)}
|
||||
childrenClassName={classNames("lg:ml-0")}
|
||||
title={t("booker_upcoming_limit")}
|
||||
description={t("booker_booking_limit_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="booker_booking_limit_description"
|
||||
href="https://cal.com/help/event-types/booker-active-booking-limit"
|
||||
/>
|
||||
}
|
||||
checked={isChecked}
|
||||
onCheckedChange={(active) => {
|
||||
if (active) {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState } from "react";
|
||||
import { useFormContext } from "react-hook-form";
|
||||
|
||||
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
|
||||
import { LearnMoreLink } from "@calcom/features/eventtypes/components/LearnMoreLink";
|
||||
import type {
|
||||
EventTypeSetup,
|
||||
InputClassNames,
|
||||
@@ -91,7 +92,13 @@ export default function RecurringEventController({
|
||||
descriptionClassName={customClassNames?.recurringToggle?.description}
|
||||
title={t("recurring_event")}
|
||||
{...recurringLocked}
|
||||
description={t("recurring_event_description")}
|
||||
description={
|
||||
<LearnMoreLink
|
||||
t={t}
|
||||
i18nKey="recurring_event_description"
|
||||
href="https://cal.com/help/event-types/recurring-events"
|
||||
/>
|
||||
}
|
||||
checked={!!recurringEventState}
|
||||
data-testid="recurring-event-check"
|
||||
disabled={(!recurringEventState && isSeatsOffered) || hasBookingLimitPerBooker}
|
||||
|
||||
Reference in new issue
Block a user