fix: location details on new booker (#9710)

* fix: location details on new booker

Signed-off-by: Udit Takkar <[email protected]>

* chore

Signed-off-by: Udit Takkar <[email protected]>

---------

Signed-off-by: Udit Takkar <[email protected]>
This commit is contained in:
Udit Takkar authored and GitHub committed 2023-06-23 11:53:00 +05:30
1 parent 52936f60b4
commit 000a6e0d35
3 files changed
+42 -20

No files matched your search

@@ -1,4 +1,4 @@
import { getEventLocationType } from "@calcom/app-store/locations";
import { getEventLocationType, getTranslatedLocation } from "@calcom/app-store/locations";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Tooltip } from "@calcom/ui";
import { MapPin } from "@calcom/ui/components/icon";
@@ -9,12 +9,24 @@ import { EventMetaBlock } from "./Details";
export const EventLocations = ({ event }: { event: PublicEvent }) => {
const { t } = useLocale();
const locations = event.locations;
if (!locations?.length) return null;
const getLocationToDisplay = (location: PublicEvent["locations"][number]) => {
const eventLocationType = getEventLocationType(location.type);
const translatedLocation = getTranslatedLocation(location, eventLocationType, t);
return translatedLocation;
};
return (
<EventMetaBlock icon={MapPin}>
{locations.length === 1 && (
<div key={locations[0].type}>{t(getEventLocationType(locations[0].type)?.label ?? "")}</div>
<Tooltip content={getLocationToDisplay(locations[0])}>
<div className="" key={locations[0].type}>
{getLocationToDisplay(locations[0])}
</div>
</Tooltip>
)}
{locations.length > 1 && (
<div
@@ -27,7 +39,7 @@ export const EventLocations = ({ event }: { event: PublicEvent }) => {
<ul className="list-disc pl-3">
{locations.map((location) => (
<li key={location.type}>
<span>{t(getEventLocationType(location.type)?.label ?? "")}</span>
<span>{getLocationToDisplay(location)}</span>
</li>
))}
</ul>