2022-06-07 14:49:39 +00:00
|
|
|
import type { TFunction } from "next-i18next";
|
|
|
|
|
2022-06-06 17:49:56 +00:00
|
|
|
import { getAppName } from "@calcom/app-store/utils";
|
2022-08-11 00:53:05 +00:00
|
|
|
import { getVideoCallPassword, getVideoCallUrl, getProviderName } from "@calcom/lib/CalEventParser";
|
2022-06-06 17:49:56 +00:00
|
|
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
|
|
|
|
|
|
|
import { Info } from "./Info";
|
|
|
|
import { LinkIcon } from "./LinkIcon";
|
|
|
|
|
2022-06-07 14:49:39 +00:00
|
|
|
export function LocationInfo(props: { calEvent: CalendarEvent; t: TFunction }) {
|
|
|
|
const { t } = props;
|
2022-08-11 00:53:05 +00:00
|
|
|
const providerName =
|
|
|
|
(props.calEvent.location && getAppName(props.calEvent.location)) || getProviderName(props.calEvent);
|
2022-06-06 17:49:56 +00:00
|
|
|
|
|
|
|
if (props.calEvent.videoCallData) {
|
|
|
|
const meetingId = props.calEvent.videoCallData.id;
|
2022-08-11 00:53:05 +00:00
|
|
|
const meetingPassword = getVideoCallPassword(props.calEvent);
|
|
|
|
const meetingUrl = getVideoCallUrl(props.calEvent);
|
2022-06-06 17:49:56 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Info
|
|
|
|
label={t("where")}
|
|
|
|
withSpacer
|
|
|
|
description={
|
2022-06-17 18:34:41 +00:00
|
|
|
meetingUrl ? (
|
|
|
|
<a
|
|
|
|
href={meetingUrl}
|
|
|
|
target="_blank"
|
|
|
|
title={t("meeting_url")}
|
|
|
|
style={{ color: "#3E3E3E" }}
|
|
|
|
rel="noreferrer">
|
|
|
|
{providerName} <LinkIcon />
|
|
|
|
</a>
|
|
|
|
) : (
|
|
|
|
<>{t("something_went_wrong")}</>
|
|
|
|
)
|
2022-06-06 17:49:56 +00:00
|
|
|
}
|
|
|
|
extraInfo={
|
|
|
|
<>
|
|
|
|
{meetingId && (
|
|
|
|
<div style={{ color: "#494949", fontWeight: 400, lineHeight: "24px" }}>
|
|
|
|
<>
|
|
|
|
{t("meeting_id")}: <span>{meetingId}</span>
|
|
|
|
</>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{meetingPassword && (
|
|
|
|
<div style={{ color: "#494949", fontWeight: 400, lineHeight: "24px" }}>
|
|
|
|
<>
|
|
|
|
{t("meeting_password")}: <span>{meetingPassword}</span>
|
|
|
|
</>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{meetingUrl && (
|
|
|
|
<div style={{ color: "#494949", fontWeight: 400, lineHeight: "24px" }}>
|
|
|
|
<>
|
|
|
|
{t("meeting_url")}:{" "}
|
2022-06-29 18:22:07 +00:00
|
|
|
<a href={meetingUrl} title={t("meeting_url")} style={{ color: "#3E3E3E" }}>
|
2022-06-06 17:49:56 +00:00
|
|
|
{meetingUrl}
|
|
|
|
</a>
|
|
|
|
</>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-06-06 19:49:00 +00:00
|
|
|
if (props.calEvent.additionalInformation?.hangoutLink) {
|
|
|
|
const hangoutLink: string = props.calEvent.additionalInformation.hangoutLink;
|
2022-06-06 17:49:56 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Info
|
|
|
|
label={t("where")}
|
|
|
|
withSpacer
|
|
|
|
description={
|
2022-06-17 18:34:41 +00:00
|
|
|
<a
|
|
|
|
href={hangoutLink}
|
|
|
|
target="_blank"
|
|
|
|
title={t("meeting_url")}
|
|
|
|
style={{ color: "#3E3E3E" }}
|
|
|
|
rel="noreferrer">
|
|
|
|
Google <LinkIcon />
|
|
|
|
</a>
|
2022-06-06 17:49:56 +00:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<Info
|
|
|
|
label={t("where")}
|
|
|
|
withSpacer
|
|
|
|
description={providerName || props.calEvent.location}
|
|
|
|
extraInfo={
|
2022-06-17 09:02:29 +00:00
|
|
|
(providerName === "Zoom" || providerName === "Google") && props.calEvent.requiresConfirmation ? (
|
2022-06-06 17:49:56 +00:00
|
|
|
<p style={{ color: "#494949", fontWeight: 400, lineHeight: "24px" }}>
|
|
|
|
<>{t("meeting_url_provided_after_confirmed")}</>
|
|
|
|
</p>
|
|
|
|
) : null
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|