[CAL-845] Improve the custom event name modal UI/UX (#6660)

Co-authored-by: gitstart-calcom <[email protected]>
This commit is contained in:
GitStart-Cal.comandgitstart-calcom authored and GitHub committed 2023-02-01 13:10:16 +01:00
1 parent 7f65d7f3c3
commit df25ae6a3d
5 files changed
+377 -24

No files matched your search

+7 -8
View File
@@ -2,7 +2,7 @@ import { TFunction } from "next-i18next";
import { guessEventLocationType } from "@calcom/app-store/locations";
type EventNameObjectType = {
export type EventNameObjectType = {
attendeeName: string;
eventType: string;
eventName?: string | null;
@@ -11,7 +11,7 @@ type EventNameObjectType = {
t: TFunction;
};
export function getEventName(eventNameObj: EventNameObjectType, forAttendeeView = false) {
export function getEventName(eventNameObj: EventNameObjectType) {
if (!eventNameObj.eventName)
return eventNameObj.t("event_between_users", {
eventName: eventNameObj.eventType,
@@ -22,20 +22,19 @@ export function getEventName(eventNameObj: EventNameObjectType, forAttendeeView
let eventName = eventNameObj.eventName;
let locationString = eventNameObj.location || "";
if (eventNameObj.eventName.includes("{LOCATION}")) {
if (eventNameObj.eventName.includes("{Location}")) {
const eventLocationType = guessEventLocationType(eventNameObj.location);
if (eventLocationType) {
locationString = eventLocationType.label;
}
eventName = eventName.replace("{LOCATION}", locationString);
eventName = eventName.replace("{Location}", locationString);
}
return (
eventName
// Need this for compatibility with older event names
.replace("{USER}", eventNameObj.attendeeName)
.replace("{ATTENDEE}", eventNameObj.attendeeName)
.replace("{HOST}", eventNameObj.host)
.replace("{HOST/ATTENDEE}", forAttendeeView ? eventNameObj.host : eventNameObj.attendeeName)
.replace("{Event type title}", eventNameObj.eventType)
.replace("{Scheduler}", eventNameObj.attendeeName)
.replace("{Organiser}", eventNameObj.host)
);
}