fix: placeholder in custom event name (#7247)
* fix: replace placeholder * refactor: replace placeholder into a separate functionpull/7260/head^2
parent
17345f9326
commit
b018ee34a7
|
@ -82,13 +82,14 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
|
||||||
setCustomInputs([...customInputs]);
|
setCustomInputs([...customInputs]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const replaceEventNamePlaceholder = (eventNameObject: EventNameObjectType, previewEventName: string) =>
|
||||||
|
previewEventName
|
||||||
|
.replace("{Event type title}", eventNameObject.eventType)
|
||||||
|
.replace("{Scheduler}", eventNameObject.attendeeName)
|
||||||
|
.replace("{Organiser}", eventNameObject.host);
|
||||||
|
|
||||||
const changePreviewText = (eventNameObject: EventNameObjectType, previewEventName: string) => {
|
const changePreviewText = (eventNameObject: EventNameObjectType, previewEventName: string) => {
|
||||||
setPreviewText(
|
setPreviewText(replaceEventNamePlaceholder(eventNameObject, previewEventName));
|
||||||
previewEventName
|
|
||||||
.replace("{Event type title}", eventNameObject.eventType)
|
|
||||||
.replace("{Scheduler}", eventNameObject.attendeeName)
|
|
||||||
.replace("{Organiser}", eventNameObject.host)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -101,6 +102,8 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
|
||||||
}
|
}
|
||||||
}, [eventType.customInputs]);
|
}, [eventType.customInputs]);
|
||||||
|
|
||||||
|
const eventNamePlaceholder = replaceEventNamePlaceholder(eventNameObject, t("meeting_with_user"));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col space-y-8">
|
<div className="flex flex-col space-y-8">
|
||||||
{/**
|
{/**
|
||||||
|
@ -141,7 +144,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
|
||||||
<TextField
|
<TextField
|
||||||
label={t("event_name_in_calendar")}
|
label={t("event_name_in_calendar")}
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={t("meeting_with_user")}
|
placeholder={eventNamePlaceholder}
|
||||||
defaultValue={eventType.eventName || ""}
|
defaultValue={eventType.eventName || ""}
|
||||||
{...formMethods.register("eventName", {
|
{...formMethods.register("eventName", {
|
||||||
onChange: (e) => {
|
onChange: (e) => {
|
||||||
|
@ -413,7 +416,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
|
||||||
<TextField
|
<TextField
|
||||||
label={t("event_name_in_calendar")}
|
label={t("event_name_in_calendar")}
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={t("meeting_with_user")}
|
placeholder={eventNamePlaceholder}
|
||||||
defaultValue={eventType.eventName || ""}
|
defaultValue={eventType.eventName || ""}
|
||||||
{...formMethods.register("eventName", {
|
{...formMethods.register("eventName", {
|
||||||
onChange: (e) => {
|
onChange: (e) => {
|
||||||
|
|
Loading…
Reference in New Issue