2022-08-26 00:48:50 +00:00
|
|
|
import { getEventLocationType, locationKeyToString } from "@calcom/app-store/locations";
|
2022-08-29 16:01:45 +00:00
|
|
|
import { classNames } from "@calcom/lib";
|
2022-11-23 02:55:25 +00:00
|
|
|
import { Icon, Tooltip } from "@calcom/ui";
|
2022-08-26 00:48:50 +00:00
|
|
|
|
|
|
|
import { Props } from "./pages/AvailabilityPage";
|
|
|
|
|
|
|
|
export function AvailableEventLocations({ locations }: { locations: Props["eventType"]["locations"] }) {
|
2022-08-29 16:01:45 +00:00
|
|
|
return locations.length ? (
|
2022-10-18 23:31:41 +00:00
|
|
|
<div className="dark:text-darkgray-600 mr-6 flex w-full flex-col space-y-2 break-words text-sm text-gray-600">
|
|
|
|
{locations.map((location) => {
|
|
|
|
const eventLocationType = getEventLocationType(location.type);
|
|
|
|
if (!eventLocationType) {
|
|
|
|
// It's possible that the location app got uninstalled
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<div key={location.type} className="flex flex-row items-center text-sm font-medium">
|
2022-11-22 12:04:06 +00:00
|
|
|
{eventLocationType.iconUrl === "/link.svg" ? (
|
|
|
|
<Icon.FiLink className="dark:text-darkgray-600 mr-[10px] ml-[2px] h-4 w-4 opacity-70 dark:opacity-100 " />
|
|
|
|
) : (
|
|
|
|
<img
|
|
|
|
src={eventLocationType.iconUrl}
|
|
|
|
className={classNames(
|
|
|
|
"mr-[10px] ml-[2px] h-4 w-4 opacity-70 dark:opacity-100 ",
|
|
|
|
!eventLocationType.iconUrl?.includes("api") ? "dark:invert" : ""
|
|
|
|
)}
|
|
|
|
alt={`${eventLocationType.label} icon`}
|
|
|
|
/>
|
|
|
|
)}
|
2022-10-19 18:00:48 +00:00
|
|
|
<Tooltip content={locationKeyToString(location)}>
|
2022-11-05 19:26:48 +00:00
|
|
|
<p className="truncate">{locationKeyToString(location)}</p>
|
2022-10-19 18:00:48 +00:00
|
|
|
</Tooltip>
|
2022-10-18 23:31:41 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
})}
|
2022-08-26 00:48:50 +00:00
|
|
|
</div>
|
2022-08-29 16:01:45 +00:00
|
|
|
) : (
|
|
|
|
<></>
|
2022-08-26 00:48:50 +00:00
|
|
|
);
|
|
|
|
}
|