feat: conferencing atoms (#17988)
* added api/v2 for zoom connect * Update conferencing.controller.ts * fix: added api for ConferencingAppsViewPlatformWrapper * type fixes * added getBulkEventTypes api for bulk-update default location * added bulk-update-to-default-location * fix:bulk-update-to-default-location * invalidated * fixed returnTo and onErrorReturnTo * make logos work for conferencing atoms * smalll improvements * fixup * share common types * type fix, and fixed a typo * fix: type-error * fix: json.parse(json.parse()) * fix: invalidate query * fix: removing app throws error in the main app * undo platform-libraries-1.2.3 * update platform-libraries version --------- Co-authored-by: Morgan <[email protected]>
This commit is contained in:
1 parent
44115ac7fa
commit
063400fcbc
54 files changed
+1898
-413
No files matched your search
@@ -3,7 +3,6 @@ import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Dialog, DialogContent, Form, DialogFooter, DialogClose, Button, CheckboxField } from "@calcom/ui";
|
||||
|
||||
export const BulkUpdateEventSchema = z.object({
|
||||
@@ -11,28 +10,35 @@ export const BulkUpdateEventSchema = z.object({
|
||||
});
|
||||
|
||||
export type BulkUpdatParams = { eventTypeIds: number[]; callback: () => void };
|
||||
export type EventTypes = Array<{ id: number; title: string }>;
|
||||
|
||||
export function BulkEditDefaultForEventsModal(props: {
|
||||
export function BulkEditDefaultForEventsModal({
|
||||
eventTypes,
|
||||
isEventTypesFetching,
|
||||
...props
|
||||
}: {
|
||||
open: boolean;
|
||||
setOpen: (open: boolean) => void;
|
||||
bulkUpdateFunction: (params: BulkUpdatParams) => void;
|
||||
isPending: boolean;
|
||||
description: string;
|
||||
isEventTypesFetching?: boolean;
|
||||
eventTypes?: EventTypes;
|
||||
handleBulkEditDialogToggle: () => void;
|
||||
}) {
|
||||
const { t } = useLocale();
|
||||
const utils = trpc.useUtils();
|
||||
const { data, isFetching } = trpc.viewer.eventTypes.bulkEventFetch.useQuery();
|
||||
|
||||
const form = useForm({
|
||||
resolver: zodResolver(BulkUpdateEventSchema),
|
||||
defaultValues: {
|
||||
eventTypeIds: data?.eventTypes.map((e) => e.id) ?? [],
|
||||
eventTypeIds: eventTypes?.map((e) => e.id) ?? [],
|
||||
},
|
||||
});
|
||||
|
||||
const eventTypesSelected = form.watch("eventTypeIds");
|
||||
const isButtonDisabled = eventTypesSelected.length === 0;
|
||||
|
||||
if (isFetching || !open || !data?.eventTypes) return null;
|
||||
if (isEventTypesFetching || !open || !eventTypes) return null;
|
||||
|
||||
return (
|
||||
<Dialog name="Bulk Default Location Update" open={props.open} onOpenChange={props.setOpen}>
|
||||
@@ -50,19 +56,19 @@ export function BulkEditDefaultForEventsModal(props: {
|
||||
});
|
||||
}}>
|
||||
<div className="flex flex-col space-y-2">
|
||||
{data.eventTypes.length > 0 && (
|
||||
{eventTypes.length > 0 && (
|
||||
<div className="flex items-center space-x-2 rounded-md px-3 pb-2.5 pt-1">
|
||||
<CheckboxField
|
||||
description={t("select_all")}
|
||||
descriptionAsLabel
|
||||
onChange={(e) => {
|
||||
form.setValue("eventTypeIds", e.target.checked ? data.eventTypes.map((e) => e.id) : []);
|
||||
form.setValue("eventTypeIds", e.target.checked ? eventTypes.map((e) => e.id) : []);
|
||||
}}
|
||||
checked={eventTypesSelected.length === data.eventTypes.length}
|
||||
checked={eventTypesSelected.length === eventTypes.length}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{data.eventTypes.map((eventType) => (
|
||||
{eventTypes.map((eventType) => (
|
||||
<div key={eventType.id} className="bg-muted flex items-center space-x-2 rounded-md px-3 py-2.5">
|
||||
<CheckboxField
|
||||
description={eventType.title}
|
||||
@@ -83,7 +89,7 @@ export function BulkEditDefaultForEventsModal(props: {
|
||||
<DialogFooter showDivider className="mt-10">
|
||||
<DialogClose
|
||||
onClick={() => {
|
||||
utils.viewer.getUsersDefaultConferencingApp.invalidate();
|
||||
props.handleBulkEditDialogToggle();
|
||||
}}
|
||||
/>
|
||||
<Button type="submit" color="primary" loading={props.isPending} disabled={isButtonDisabled}>
|
||||
|
||||
Reference in new issue
Block a user