import { getEventLocationType, getTranslatedLocation } from "@calcom/app-store/locations"; import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Tooltip } from "@calcom/ui"; import { Link } from "@calcom/ui/components/icon"; import type { Props } from "./pages/AvailabilityPage"; const excludeNullValues = (value: unknown) => !!value; export function AvailableEventLocations({ locations }: { locations: Props["eventType"]["locations"] }) { const { t } = useLocale(); const renderLocations = locations.map((location, index) => { const eventLocationType = getEventLocationType(location.type); if (!eventLocationType) { // It's possible that the location app got uninstalled return null; } if (eventLocationType.variable === "hostDefault") { return null; } const translatedLocation = getTranslatedLocation(location, eventLocationType, t); return (
{eventLocationType.iconUrl === "/link.svg" ? ( ) : ( {`${eventLocationType.label} )}

{translatedLocation}

); }); const filteredLocations = renderLocations.filter(excludeNullValues) as JSX.Element[]; return filteredLocations.length ? (
{filteredLocations}
) : null; }