fix: placeholder in custom event name (#7247)

* fix: replace placeholder

* refactor: replace placeholder into a separate function
pull/7260/head^2
Nafees Nazik 2023-02-23 21:16:36 +05:30 committed by GitHub
parent 17345f9326
commit b018ee34a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 8 deletions

View File

@ -82,13 +82,14 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
setCustomInputs([...customInputs]);
};
const changePreviewText = (eventNameObject: EventNameObjectType, previewEventName: string) => {
setPreviewText(
const replaceEventNamePlaceholder = (eventNameObject: EventNameObjectType, previewEventName: string) =>
previewEventName
.replace("{Event type title}", eventNameObject.eventType)
.replace("{Scheduler}", eventNameObject.attendeeName)
.replace("{Organiser}", eventNameObject.host)
);
.replace("{Organiser}", eventNameObject.host);
const changePreviewText = (eventNameObject: EventNameObjectType, previewEventName: string) => {
setPreviewText(replaceEventNamePlaceholder(eventNameObject, previewEventName));
};
useEffect(() => {
@ -101,6 +102,8 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
}
}, [eventType.customInputs]);
const eventNamePlaceholder = replaceEventNamePlaceholder(eventNameObject, t("meeting_with_user"));
return (
<div className="flex flex-col space-y-8">
{/**
@ -141,7 +144,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
<TextField
label={t("event_name_in_calendar")}
type="text"
placeholder={t("meeting_with_user")}
placeholder={eventNamePlaceholder}
defaultValue={eventType.eventName || ""}
{...formMethods.register("eventName", {
onChange: (e) => {
@ -413,7 +416,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
<TextField
label={t("event_name_in_calendar")}
type="text"
placeholder={t("meeting_with_user")}
placeholder={eventNamePlaceholder}
defaultValue={eventType.eventName || ""}
{...formMethods.register("eventName", {
onChange: (e) => {