cal/lib/event.ts
Syed Ali Shahbaz a404ca847c
updated event title message (#1132)
* updated event title message

* 4 arguments replaced by an object

* translations

* requested changes

* further requested changes

* test fix and other minor changes

* lint fix
2021-11-08 16:34:12 +05:30

20 lines
537 B
TypeScript

import { TFunction } from "next-i18next";
type EventNameObjectType = {
attendeeName: string;
eventType: string;
eventName?: string | null;
host: string;
t: TFunction;
};
export function getEventName(eventNameObj: EventNameObjectType) {
return eventNameObj.eventName
? eventNameObj.eventName.replace("{USER}", eventNameObj.attendeeName)
: eventNameObj.t("event_between_users", {
eventName: eventNameObj.eventType,
host: eventNameObj.host,
attendeeName: eventNameObj.attendeeName,
});
}