Compare commits

...

4 Commits

Author SHA1 Message Date
Joe Au-Yeung ea2fb9c0dc Type fix 2023-10-31 10:54:29 -04:00
Joe Au-Yeung af129f1756
Merge branch 'main' into fix/missing-credential-id 2023-10-31 10:33:59 -04:00
Joe Au-Yeung e94976bf97
Merge branch 'main' into fix/missing-credential-id 2023-10-26 09:54:35 -04:00
Joe Au-Yeung 30183a9dc5 Attach credentialId to location option 2023-10-25 14:10:32 -04:00
3 changed files with 10 additions and 5 deletions

View File

@ -298,7 +298,7 @@ export const EventSetupTab = (
!validLocations.find((location) => location.type === newLocationType); !validLocations.find((location) => location.type === newLocationType);
if (canAddLocation) { if (canAddLocation) {
updateLocationField(index, { type: newLocationType }); updateLocationField(index, { type: newLocationType, credentialId: e.credentialId });
} else { } else {
updateLocationField(index, { type: field.type }); updateLocationField(index, { type: field.type });
showToast(t("location_already_exists"), "warning"); showToast(t("location_already_exists"), "warning");
@ -382,7 +382,7 @@ export const EventSetupTab = (
!validLocations.find((location) => location.type === newLocationType); !validLocations.find((location) => location.type === newLocationType);
if (canAppendLocation) { if (canAppendLocation) {
append({ type: newLocationType }); append({ type: newLocationType, credentialId: e.credentialId });
setSelectedNewOption(e); setSelectedNewOption(e);
} else { } else {
showToast(t("location_already_exists"), "warning"); showToast(t("location_already_exists"), "warning");

View File

@ -2,7 +2,6 @@ import type { GroupBase, Props, SingleValue } from "react-select";
import { components } from "react-select"; import { components } from "react-select";
import type { EventLocationType } from "@calcom/app-store/locations"; import type { EventLocationType } from "@calcom/app-store/locations";
import type { CredentialDataWithTeamName } from "@calcom/app-store/utils";
import { classNames } from "@calcom/lib"; import { classNames } from "@calcom/lib";
import invertLogoOnDark from "@calcom/lib/invertLogoOnDark"; import invertLogoOnDark from "@calcom/lib/invertLogoOnDark";
import { Select } from "@calcom/ui"; import { Select } from "@calcom/ui";
@ -13,7 +12,7 @@ export type LocationOption = {
icon?: string; icon?: string;
disabled?: boolean; disabled?: boolean;
address?: string; address?: string;
credential?: CredentialDataWithTeamName; credentialId?: number;
}; };
export type SingleValueLocationOption = SingleValue<LocationOption>; export type SingleValueLocationOption = SingleValue<LocationOption>;

View File

@ -88,7 +88,13 @@ export async function getLocationGroupedOptions(
teamName: credential.team?.name, teamName: credential.team?.name,
}))) { }))) {
const label = `${app.locationOption.label} ${teamName ? `(${teamName})` : ""}`; const label = `${app.locationOption.label} ${teamName ? `(${teamName})` : ""}`;
const option = { ...app.locationOption, label, icon: app.logo, slug: app.slug }; const option = {
...app.locationOption,
label,
icon: app.logo,
slug: app.slug,
credentialId: app.credential.id,
};
if (apps[groupByCategory]) { if (apps[groupByCategory]) {
apps[groupByCategory] = [...apps[groupByCategory], option]; apps[groupByCategory] = [...apps[groupByCategory], option];
} else { } else {