From 57d1de4709930359736d3b866112ed56eeb89211 Mon Sep 17 00:00:00 2001 From: Ryukemeister Date: Wed, 1 Nov 2023 00:23:01 +0530 Subject: [PATCH] split event type into smaller components --- packages/atoms/EventTypeList/EventType.tsx | 199 +++++++-------------- 1 file changed, 61 insertions(+), 138 deletions(-) diff --git a/packages/atoms/EventTypeList/EventType.tsx b/packages/atoms/EventTypeList/EventType.tsx index dc34bc1f4c..f09b1f1b39 100644 --- a/packages/atoms/EventTypeList/EventType.tsx +++ b/packages/atoms/EventTypeList/EventType.tsx @@ -1,20 +1,13 @@ import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; -import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, - DropdownMenuSeparator, -} from "@/components/ui/dropdown-menu"; import { Switch } from "@/components/ui/switch"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; -import { MoreHorizontal, ExternalLink, LinkIcon, Edit2, Copy, Trash, Code } from "lucide-react"; +import { EventTypeDialog } from "EventTypeList/components/controls/Dialog"; +import { EventTypeDropdown } from "EventTypeList/components/controls/Dropdown"; +import { EventTypeTooltip } from "EventTypeList/components/controls/Tooltip"; +import { ExternalLink, LinkIcon } from "lucide-react"; import { memo, useState } from "react"; import { useOrgBranding } from "@calcom/ee/organizations/context/provider"; -import { EventTypeEmbedButton } from "@calcom/features/embed/EventTypeEmbed"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { SchedulingType } from "@calcom/prisma/enums"; import { ArrowButton, AvatarGroup, ButtonGroup } from "@calcom/ui"; @@ -152,144 +145,74 @@ export function EventType({ {isManagedEventType && ( <> {type.hidden && Hidden} - - - -
- { - onMutate({ id: type.id, hidden: !type.hidden }); - }} - /> -
-
- - {type.hidden ? "Show on profile" : "Hide from profile"} - -
-
+ + { + onMutate({ id: type.id, hidden: !type.hidden }); + }} + /> + + } + content={type.hidden ? "Show on profile" : "Hide from profile"} + /> )} {!isManagedEventType && ( <> - - - - {/* TODO: add toast */} - - - Preview - - - - - - - - Copy link to event - - + { + onPreview(calLink); + }}> + + + } + content="Preview" + /> + { + onCopy(calLink); + }}> + + + } + content="Copy link to event" + /> )} - - - - - - {!readOnly && ( - - - - )} - {!isManagedEventType && !isChildrenManagedEventType && ( - <> - - - - - )} - {!isManagedEventType && ( - - - Embed - - - )} - {(group.metadata?.readOnly === false || group.metadata.readOnly === null) && - !isChildrenManagedEventType && ( - <> - - - {/* Button type should be destructive here */} - - - - )} - - + - - - - Delete event type? - - Anyone who you've shared this link with will no longer be able to book using it. - - + - - + } + /> ); }