fix: ai translations description for atoms (#17875)
* remove ai translations description for atoms * PR feedback * fixup --------- Co-authored-by: Benny Joo <[email protected]> Co-authored-by: Somay Chauhan <[email protected]> Co-authored-by: Morgan <[email protected]>
This commit is contained in:
5 files changed
+19
-11
No files matched your search
@@ -1,6 +1,5 @@
|
|||||||
import { AnimatePresence, LazyMotion, m } from "framer-motion";
|
import { AnimatePresence, LazyMotion, m } from "framer-motion";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { useSearchParams } from "next/navigation";
|
|
||||||
import { useEffect, useMemo, useRef } from "react";
|
import { useEffect, useMemo, useRef } from "react";
|
||||||
import { Toaster } from "react-hot-toast";
|
import { Toaster } from "react-hot-toast";
|
||||||
import StickyBox from "react-sticky-box";
|
import StickyBox from "react-sticky-box";
|
||||||
@@ -67,14 +66,10 @@ const BookerComponent = ({
|
|||||||
isPlatform,
|
isPlatform,
|
||||||
orgBannerUrl,
|
orgBannerUrl,
|
||||||
customClassNames,
|
customClassNames,
|
||||||
|
areInstantMeetingParametersSet = false,
|
||||||
|
userLocale,
|
||||||
}: BookerProps & WrappedBookerProps) => {
|
}: BookerProps & WrappedBookerProps) => {
|
||||||
const { t } = useLocale();
|
const { t } = useLocale();
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const areInstantMeetingParametersSet = !!event.data?.instantMeetingParameters
|
|
||||||
? searchParams &&
|
|
||||||
event.data.instantMeetingParameters.every((param) => Array.from(searchParams.values()).includes(param))
|
|
||||||
: true;
|
|
||||||
|
|
||||||
const [bookerState, setBookerState] = useBookerStore((state) => [state.state, state.setState], shallow);
|
const [bookerState, setBookerState] = useBookerStore((state) => [state.state, state.setState], shallow);
|
||||||
const selectedDate = useBookerStore((state) => state.selectedDate);
|
const selectedDate = useBookerStore((state) => state.selectedDate);
|
||||||
@@ -358,6 +353,7 @@ const BookerComponent = ({
|
|||||||
event={event.data}
|
event={event.data}
|
||||||
isPending={event.isPending}
|
isPending={event.isPending}
|
||||||
isPlatform={isPlatform}
|
isPlatform={isPlatform}
|
||||||
|
locale={userLocale}
|
||||||
/>
|
/>
|
||||||
{layout !== BookerLayouts.MONTH_VIEW &&
|
{layout !== BookerLayouts.MONTH_VIEW &&
|
||||||
!(layout === "mobile" && bookerState === "booking") && (
|
!(layout === "mobile" && bookerState === "booking") && (
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { m } from "framer-motion";
|
import { m } from "framer-motion";
|
||||||
import { useSession } from "next-auth/react";
|
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { useEffect, useMemo } from "react";
|
import { useEffect, useMemo } from "react";
|
||||||
import { shallow } from "zustand/shallow";
|
import { shallow } from "zustand/shallow";
|
||||||
@@ -12,9 +11,9 @@ import { EventMetaBlock } from "@calcom/features/bookings/components/event-meta/
|
|||||||
import { useTimePreferences } from "@calcom/features/bookings/lib";
|
import { useTimePreferences } from "@calcom/features/bookings/lib";
|
||||||
import type { BookerEvent } from "@calcom/features/bookings/types";
|
import type { BookerEvent } from "@calcom/features/bookings/types";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { locales as i18nLocales } from "@calcom/lib/i18n";
|
|
||||||
import { EventTypeAutoTranslatedField } from "@calcom/prisma/enums";
|
import { EventTypeAutoTranslatedField } from "@calcom/prisma/enums";
|
||||||
|
|
||||||
|
import i18nConfigration from "../../../../../i18n.json";
|
||||||
import { fadeInUp } from "../config";
|
import { fadeInUp } from "../config";
|
||||||
import { useBookerStore } from "../store";
|
import { useBookerStore } from "../store";
|
||||||
import { FromToTime } from "../utils/dates";
|
import { FromToTime } from "../utils/dates";
|
||||||
@@ -31,6 +30,7 @@ export const EventMeta = ({
|
|||||||
isPending,
|
isPending,
|
||||||
isPlatform = true,
|
isPlatform = true,
|
||||||
classNames,
|
classNames,
|
||||||
|
locale,
|
||||||
}: {
|
}: {
|
||||||
event?: Pick<
|
event?: Pick<
|
||||||
BookerEvent,
|
BookerEvent,
|
||||||
@@ -61,8 +61,8 @@ export const EventMeta = ({
|
|||||||
eventMetaTitle?: string;
|
eventMetaTitle?: string;
|
||||||
eventMetaTimezoneSelect?: string;
|
eventMetaTimezoneSelect?: string;
|
||||||
};
|
};
|
||||||
|
locale?: string | null;
|
||||||
}) => {
|
}) => {
|
||||||
const session = useSession();
|
|
||||||
const { setTimezone, timeFormat, timezone } = useTimePreferences();
|
const { setTimezone, timeFormat, timezone } = useTimePreferences();
|
||||||
const selectedDuration = useBookerStore((state) => state.selectedDuration);
|
const selectedDuration = useBookerStore((state) => state.selectedDuration);
|
||||||
const selectedTimeslot = useBookerStore((state) => state.selectedTimeslot);
|
const selectedTimeslot = useBookerStore((state) => state.selectedTimeslot);
|
||||||
@@ -81,6 +81,7 @@ export const EventMeta = ({
|
|||||||
() => (isPlatform ? [PlatformTimezoneSelect] : [WebTimezoneSelect]),
|
() => (isPlatform ? [PlatformTimezoneSelect] : [WebTimezoneSelect]),
|
||||||
[isPlatform]
|
[isPlatform]
|
||||||
);
|
);
|
||||||
|
const i18nLocales = i18nConfigration.locale.targets.concat([i18nConfigration.locale.source]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//In case the event has lockTimeZone enabled ,set the timezone to event's attached availability timezone
|
//In case the event has lockTimeZone enabled ,set the timezone to event's attached availability timezone
|
||||||
@@ -107,7 +108,7 @@ export const EventMeta = ({
|
|||||||
: isHalfFull
|
: isHalfFull
|
||||||
? "text-yellow-500"
|
? "text-yellow-500"
|
||||||
: "text-bookinghighlight";
|
: "text-bookinghighlight";
|
||||||
const userLocale = session.data?.user.locale ?? navigator.language;
|
const userLocale = locale ?? navigator.language;
|
||||||
const translatedDescription = (event?.fieldTranslations ?? []).find(
|
const translatedDescription = (event?.fieldTranslations ?? []).find(
|
||||||
(trans) =>
|
(trans) =>
|
||||||
trans.field === EventTypeAutoTranslatedField.DESCRIPTION &&
|
trans.field === EventTypeAutoTranslatedField.DESCRIPTION &&
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ export interface BookerProps {
|
|||||||
teamMemberEmail?: string | null;
|
teamMemberEmail?: string | null;
|
||||||
crmOwnerRecordType?: string | null;
|
crmOwnerRecordType?: string | null;
|
||||||
crmAppSlug?: string | null;
|
crmAppSlug?: string | null;
|
||||||
|
areInstantMeetingParametersSet?: boolean;
|
||||||
|
userLocale?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type WrappedBookerPropsMain = {
|
export type WrappedBookerPropsMain = {
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ export const EventSetupTab = (
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
{!isPlatform && (
|
||||||
<div className="[&_label]:my-1 [&_label]:font-normal">
|
<div className="[&_label]:my-1 [&_label]:font-normal">
|
||||||
<SettingsToggle
|
<SettingsToggle
|
||||||
title={t("translate_description_button")}
|
title={t("translate_description_button")}
|
||||||
@@ -153,6 +154,7 @@ export const EventSetupTab = (
|
|||||||
tooltip={!orgId ? t("orgs_upgrade_to_enable_feature") : undefined}
|
tooltip={!orgId ? t("orgs_upgrade_to_enable_feature") : undefined}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
<TextField
|
<TextField
|
||||||
required
|
required
|
||||||
label={isPlatform ? "Slug" : t("URL")}
|
label={isPlatform ? "Slug" : t("URL")}
|
||||||
|
|||||||
@@ -181,6 +181,11 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
|
|||||||
theme: event.data?.profile.theme,
|
theme: event.data?.profile.theme,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const areInstantMeetingParametersSet = !!event.data?.instantMeetingParameters
|
||||||
|
? searchParams &&
|
||||||
|
event.data.instantMeetingParameters.every((param) => Array.from(searchParams.values()).includes(param))
|
||||||
|
: true;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BookerComponent
|
<BookerComponent
|
||||||
{...props}
|
{...props}
|
||||||
@@ -219,6 +224,8 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
|
|||||||
schedule={schedule}
|
schedule={schedule}
|
||||||
verifyCode={verifyCode}
|
verifyCode={verifyCode}
|
||||||
isPlatform={false}
|
isPlatform={false}
|
||||||
|
areInstantMeetingParametersSet={areInstantMeetingParametersSet}
|
||||||
|
userLocale={session?.user.locale}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user