add dialog component for delete handler

event-type-list
Ryukemeister 2023-10-27 00:19:22 +05:30
parent ce98f69ca4
commit c517d4dacd
1 changed files with 29 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { import {
DropdownMenu, DropdownMenu,
DropdownMenuContent, DropdownMenuContent,
@ -10,7 +11,7 @@ import {
import { Switch } from "@/components/ui/switch"; import { Switch } from "@/components/ui/switch";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { MoreHorizontal, ExternalLink, LinkIcon, Edit2, Copy, Trash, Code } from "lucide-react"; import { MoreHorizontal, ExternalLink, LinkIcon, Edit2, Copy, Trash, Code } from "lucide-react";
import { memo } from "react"; import { memo, useState } from "react";
import { useOrgBranding } from "@calcom/ee/organizations/context/provider"; import { useOrgBranding } from "@calcom/ee/organizations/context/provider";
import { EventTypeEmbedButton } from "@calcom/features/embed/EventTypeEmbed"; import { EventTypeEmbedButton } from "@calcom/features/embed/EventTypeEmbed";
@ -102,6 +103,7 @@ export function EventType({
const isChildrenManagedEventType = const isChildrenManagedEventType =
type.metadata?.managedEventConfig !== undefined && type.schedulingType !== SchedulingType.MANAGED; type.metadata?.managedEventConfig !== undefined && type.schedulingType !== SchedulingType.MANAGED;
const orgBranding = useOrgBranding(); const orgBranding = useOrgBranding();
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
return ( return (
<li> <li>
@ -280,6 +282,32 @@ export function EventType({
</div> </div>
</div> </div>
</div> </div>
<Dialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Delete event type?</DialogTitle>
<DialogDescription>
Anyone who you&apos;ve shared this link with will no longer be able to book using it.
</DialogDescription>
</DialogHeader>
<div className="flex items-center justify-end">
<Button
onClick={() => {
setDeleteDialogOpen(false);
}}
variant="outline"
className="border-none">
Cancel
</Button>
<Button
onClick={() => {
// Add appropriate event handler to delete given event type
}}>
Yes, delete
</Button>
</div>
</DialogContent>
</Dialog>
</li> </li>
); );
} }