Feat/Display location information publicly (#2752)
* Updating checkbox field to reflect new designs * Include Infobadge option checkbox * Checkbox Field + i18n * Default checked - true * Sync with router * Extracting Types * Update filtering logic * Add UI to booking page * Default address/link * Update hashedlink page * Tidy up * Video icon * Add nullish check * Update to use RHF controller Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
9 files changed
+168
-18
No files matched your search
@@ -16,5 +16,27 @@ export enum AppStoreLocationType {
|
||||
Teams = "integrations:office365_video",
|
||||
}
|
||||
|
||||
export type LocationObject = {
|
||||
type: LocationType;
|
||||
address?: string;
|
||||
link?: string;
|
||||
displayLocationPublicly?: boolean;
|
||||
hostPhoneNumber?: string;
|
||||
};
|
||||
|
||||
export const LocationType = { ...DefaultLocationType, ...AppStoreLocationType };
|
||||
export type LocationType = DefaultLocationType | AppStoreLocationType;
|
||||
|
||||
export const locationHiddenFilter = (locations: LocationObject[]) =>
|
||||
locations.filter((el) => {
|
||||
// Filter out locations that are not to be displayed publicly
|
||||
const values = Object.values(AppStoreLocationType);
|
||||
// Display if the location can be set to public - and also display all locations like google meet etc
|
||||
if (el.displayLocationPublicly || values.includes(el["type"] as unknown as AppStoreLocationType))
|
||||
return el;
|
||||
else {
|
||||
delete el.address;
|
||||
delete el.link;
|
||||
return el;
|
||||
}
|
||||
});
|
||||
@@ -9,6 +9,7 @@ export const eventTypeLocations = z.array(
|
||||
type: z.nativeEnum(LocationType),
|
||||
address: z.string().optional(),
|
||||
link: z.string().url().optional(),
|
||||
displayLocationPublicly: z.boolean().optional(),
|
||||
hostPhoneNumber: z.string().optional(),
|
||||
})
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user