Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add "somewhere else" as a location option #15108

Merged
merged 12 commits into from
Aug 30, 2024
4 changes: 3 additions & 1 deletion apps/web/components/dialog/EditLocationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ export const EditLocationDialog = (props: ISetLocationDialog) => {
});
if (booking) {
locationOptions.map((location) =>
location.options.filter((l) => !["phone", "attendeeInPerson"].includes(l.value))
location.options.filter(
(l) => !["phone", "attendeeInPerson", "somewhereElse"].includes(l.value)
)
);
}
return (
Expand Down
1 change: 1 addition & 0 deletions apps/web/public/message-pin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions apps/web/public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@
"address": "Address",
"enter_address": "Enter address",
"in_person_attendee_address": "In Person (Attendee Address)",
"somewhere_else": "Somewhere Else",
"any_location": "Any location",
"yes": "Yes",
"no": "No",
"additional_notes": "Additional notes",
Expand Down
31 changes: 28 additions & 3 deletions packages/app-store/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ export type DefaultEventLocationType = {
| "locationPhoneNumber"
| "phone"
| "hostDefault";
defaultValueVariable: "address" | "attendeeAddress" | "link" | "hostPhoneNumber" | "hostDefault" | "phone";
defaultValueVariable:
| "address"
| "attendeeAddress"
| "link"
| "hostPhoneNumber"
| "hostDefault"
| "phone"
| "anyLocation";
} & (
| {
organizerInputType: "phone" | "text" | null;
Expand All @@ -35,7 +42,7 @@ export type DefaultEventLocationType = {
attendeeInputPlaceholder?: null;
}
| {
attendeeInputType: "phone" | "attendeeAddress" | null;
attendeeInputType: "phone" | "attendeeAddress" | "anyLocation" | null;
attendeeInputPlaceholder: string;
organizerInputType?: null;
organizerInputPlaceholder?: null;
Expand Down Expand Up @@ -78,6 +85,7 @@ export enum DefaultEventLocationTypeEnum {
Link = "link",
// Same as `OrganizerDefaultConferencingAppType`
Conferencing = "conferencing",
SomewhereElse = "somewhereElse",
}

export const defaultLocations: DefaultEventLocationType[] = [
Expand All @@ -94,6 +102,19 @@ export const defaultLocations: DefaultEventLocationType[] = [
iconUrl: "/map-pin-dark.svg",
category: "in person",
},
{
default: true,
type: DefaultEventLocationTypeEnum.SomewhereElse,
label: "somewhere_else",
variable: "address",
organizerInputType: null,
messageForOrganizer: "Cal will ask your invitee to enter any location before scheduling.",
attendeeInputType: "anyLocation",
attendeeInputPlaceholder: "any_location",
defaultValueVariable: "anyLocation",
iconUrl: "/message-pin.svg",
category: "other",
},
{
default: true,
type: DefaultEventLocationTypeEnum.InPerson,
Expand Down Expand Up @@ -163,6 +184,7 @@ const translateAbleKeys = [
"link_meeting",
"organizer_phone_number",
"organizer_default_conferencing_app",
"somewhere_else",
];

export type LocationObject = {
Expand All @@ -171,7 +193,10 @@ export type LocationObject = {
displayLocationPublicly?: boolean;
credentialId?: number;
} & Partial<
Record<"address" | "attendeeAddress" | "link" | "hostPhoneNumber" | "hostDefault" | "phone", string>
Record<
"address" | "attendeeAddress" | "link" | "hostPhoneNumber" | "hostDefault" | "phone" | "anyLocation",
string
>
>;

// integrations:jitsi | 919999999999 | Delhi | https://manual.meeting.link | Around Video
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const BookingFields = ({

// Attendee location field can be edited during reschedule
if (field.name === SystemField.Enum.location) {
if (locationResponse?.value === "attendeeInPerson" || "phone") {
if (["attendeeInPerson", "phone", "somewhereElse"].includes(locationResponse?.value)) {
readOnly = false;
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/features/bookings/lib/getBookingFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ export const ensureBookingInputsHaveSystemFields = ({
required: true,
placeholder: "",
},
somewhereElse: {
type: "text",
required: true,
placeholder: "",
},
phone: {
type: "phone",
required: true,
Expand Down
1 change: 1 addition & 0 deletions packages/features/eventtypes/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type FormValues = {
type: EventLocationType["type"];
address?: string;
attendeeAddress?: string;
anyLocation?: string;
link?: string;
hostPhoneNumber?: string;
displayLocationPublicly?: boolean;
Expand Down
Loading