feat: go to Assignment tab after creation and warn if existing without assigning (#14882)
* feat: go to Assignment tab after creation and warn if existing without assigning * Update AssignmentWarningDialog.tsx * fix: some changes * fix: some updates * Update EventTeamTab.tsx * update * update * update test * some fixes * refactor one test and update * Update managed-event-types.e2e.ts --------- Co-authored-by: Keith Williams <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Lauris Skraucis <[email protected]>
This commit is contained in:
5 files changed
+106
-4
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import { useRouter } from "next/navigation";
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
import type { MutableRefObject } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Dialog, DialogContent, Button, DialogFooter } from "@calcom/ui";
|
||||
|
||||
interface AssignmentWarningDialogProps {
|
||||
isOpenAssignmentWarnDialog: boolean;
|
||||
setIsOpenAssignmentWarnDialog: Dispatch<SetStateAction<boolean>>;
|
||||
pendingRoute: string;
|
||||
leaveWithoutAssigningHosts: MutableRefObject<boolean>;
|
||||
id: number;
|
||||
}
|
||||
const AssignmentWarningDialog = (props: AssignmentWarningDialogProps) => {
|
||||
const { t } = useLocale();
|
||||
const {
|
||||
isOpenAssignmentWarnDialog,
|
||||
setIsOpenAssignmentWarnDialog,
|
||||
pendingRoute,
|
||||
leaveWithoutAssigningHosts,
|
||||
id,
|
||||
} = props;
|
||||
const router = useRouter();
|
||||
return (
|
||||
<Dialog open={isOpenAssignmentWarnDialog} onOpenChange={setIsOpenAssignmentWarnDialog}>
|
||||
<DialogContent title={t("leave_without_assigning_anyone")} Icon="circle-alert" type="confirmation">
|
||||
<div className="text-subtle text-sm">
|
||||
<p className="mt-3">{t("leave_without_adding_attendees")}</p>
|
||||
<p className="mt-4">{t("no_availability_shown_to_bookers")}</p>
|
||||
</div>
|
||||
<DialogFooter className="mt-6">
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
setIsOpenAssignmentWarnDialog(false);
|
||||
router.replace(`/event-types/${id}?tabName=team`);
|
||||
}}
|
||||
color="minimal">
|
||||
{t("go_back_and_assign")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
setIsOpenAssignmentWarnDialog(false);
|
||||
leaveWithoutAssigningHosts.current = true;
|
||||
router.replace(pendingRoute);
|
||||
}}>
|
||||
{t("leave_without_assigning")}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
export default AssignmentWarningDialog;
|
||||
Reference in new issue
Block a user