Change location of booking (#2658)

* add functionality to change location in booking and send out mail

* add i18n

* change location with dropdown like in event-types

* small fixes and code clean up

* clean code

* improve format of current Location string

* clean code

* clear selection when dialog closed

* added mutation and changed props (first working verison)

* clean code

* clean code

* clean code

* clean code

* fix typo

* change maxHeight of select

* use useWatch for selectedLocation

* pass default values with props

* set current location directly in useState

* clear selected values when updating location

* fix trpc query for credentialst

* change icons for editing booking

* improve naming of variables

* remove unnecessary orderBy

* use locationOptionsToString method

* fix current location naming for Cal Video

* add phone input

* save phone number as location of booking

* remove input field for phone number for event-types

* fix redirection issue

* show previous selected location in event-type

* remove attendee number from selection for booking

* make first letter of location lowercase

* remove input field for attendee phone number

* clear Errors when changing location type

* set location details to optional

* clean code

* fixing issue that dropdown doesn't close when dialog opens

* clean code

* make overflow visibile in dialog

* fix existing bug with address not showing in event-type settings

* fix issue with losing focus after validation

* close rejection dialog

* small spelling fixes

* fix issue with LocationChangeEmail

* fix failing E2E test

* fix failing E2E test

* fix E2E test

* bug fix for saving user phone, and other minor changes

* merge main

* improve text

* fix UI of booking list

* Delete admin

* remove selection after update and submit

* add translation for error message

* add default values for checkbox

* add "your phone number" to locations on booking page

* remove duplicate attributes from viewer.bookings

Co-authored-by: Omar López <[email protected]>

* check if user is authorized to make changes to booking

* remove location string

* clan code for displayLocaitonPublicly checkbox

* fetch locationOptions on server side

* remove trpc query for credentials

* fix phone number input

* fix labels of host and attendee phone number for booking page

* Migrates edit location to tRPC

* Link elemnt should only be used in `a` tags

* Adds missin router

* Migrates locationOptions to tRPC query

* Type fixes

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Alan <[email protected]>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2022-05-27 23:27:41 +00:00
1 parent b869e70a7f
commit 7b01bae829
19 files changed
+1165 -351

No files matched your search

+8
View File
@@ -113,6 +113,14 @@ export function getLocationTypes(): string[] {
export function getLocationLabels(t: TFunction) {
const defaultLocationLabels = defaultLocations.reduce((locations, location) => {
if(location.label === "attendee_phone_number") {
locations[location.value] = t("your_number")
return locations
}
if(location.label === "host_phone_number") {
locations[location.value] = `${t("phone_call")} (${t("number_provided")})`
return locations
}
locations[location.value] = t(location.label);
return locations;
}, {} as Record<LocationType, string>);
+4 -1
View File
@@ -12,6 +12,7 @@ export type ButtonBaseProps = {
disabled?: boolean;
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
StartIcon?: SVGComponent;
startIconClassName?: string;
EndIcon?: SVGComponent;
shallow?: boolean;
};
@@ -30,6 +31,7 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
color = "primary",
size = "base",
StartIcon,
startIconClassName,
EndIcon,
shallow,
// attributes propagated from `HTMLAnchorProps` or `HTMLButtonProps`
@@ -103,7 +105,8 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
<StartIcon
className={classNames(
"inline",
size === "icon" ? "h-5 w-5 " : "-ml-1 h-5 w-5 ltr:mr-2 rtl:ml-2 rtl:-mr-1"
size === "icon" ? "h-5 w-5 " : "-ml-1 h-5 w-5 ltr:mr-2 rtl:ml-2 rtl:-mr-1",
startIconClassName || ""
)}
/>
)}
+5 -5
View File
@@ -52,7 +52,7 @@ export function Dialog(props: DialogProps) {
return (
<DialogPrimitive.Root {...dialogProps}>
<DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-black bg-opacity-50 transition-opacity" />
<DialogPrimitive.Overlay className="fixed inset-0 z-40 transition-opacity bg-black bg-opacity-50 fadeIn" />
{children}
</DialogPrimitive.Root>
);
@@ -64,7 +64,7 @@ type DialogContentProps = React.ComponentProps<typeof DialogPrimitive["Content"]
export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
({ children, ...props }, forwardedRef) => (
<DialogPrimitive.Portal>
<DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-gray-500 bg-opacity-75 transition-opacity" />
<DialogPrimitive.Overlay className="fixed inset-0 z-40 transition-opacity bg-gray-500 bg-opacity-75 fadeIn" />
{/*zIndex one less than Toast */}
<DialogPrimitive.Content
{...props}
@@ -75,7 +75,7 @@ export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps
: props.size == "lg"
? "p-6 sm:max-w-[70rem]"
: "p-6 sm:max-w-[35rem]",
"max-h-[560px] overflow-auto overscroll-auto md:h-auto md:max-h-[inherit]",
"max-h-[560px] overflow-visible overscroll-auto md:h-auto md:max-h-[inherit]",
`${props.className || ""}`
)}
ref={forwardedRef}>
@@ -93,7 +93,7 @@ type DialogHeaderProps = {
export function DialogHeader(props: DialogHeaderProps) {
return (
<div className="mb-8">
<h3 className="leading-16 font-cal text-xl text-gray-900" id="modal-title">
<h3 className="text-xl text-gray-900 leading-16 font-cal" id="modal-title">
{props.title}
</h3>
{props.subtitle && <div className="text-sm text-gray-400">{props.subtitle}</div>}
@@ -104,7 +104,7 @@ export function DialogHeader(props: DialogHeaderProps) {
export function DialogFooter(props: { children: ReactNode }) {
return (
<div>
<div className="mt-5 flex justify-end space-x-2 rtl:space-x-reverse">{props.children}</div>
<div className="flex justify-end mt-5 space-x-2 rtl:space-x-reverse">{props.children}</div>
</div>
);
}