From 49725e11b3fe6ae7967d58674a3b3bc8ff1a0d29 Mon Sep 17 00:00:00 2001 From: Ryukemeister Date: Mon, 30 Oct 2023 22:56:58 +0530 Subject: [PATCH] replace dropdown with controls component --- .../components/availability/index.tsx | 91 +++++++------------ 1 file changed, 33 insertions(+), 58 deletions(-) diff --git a/packages/atoms/availability-list/components/availability/index.tsx b/packages/atoms/availability-list/components/availability/index.tsx index c8465ed40e..3be30876de 100644 --- a/packages/atoms/availability-list/components/availability/index.tsx +++ b/packages/atoms/availability-list/components/availability/index.tsx @@ -1,15 +1,8 @@ import { Badge } from "@/components/ui/badge"; -import { Button } from "@/components/ui/button"; -import { - DropdownMenu, - DropdownMenuTrigger, - DropdownMenuContent, - DropdownMenuItem, -} from "@/components/ui/dropdown-menu"; -import { Toaster } from "@/components/ui/toaster"; import { useToast } from "@/components/ui/use-toast"; import type { Schedule } from "availability-list"; -import { Globe, MoreHorizontal, Star, Copy, Trash } from "lucide-react"; +import { Controls } from "availability-list/components/controls"; +import { Globe } from "lucide-react"; import { Fragment } from "react"; import { availabilityAsString } from "@calcom/lib/availability"; @@ -36,6 +29,31 @@ export function Availability({ }: AvailabilityProps) { const { toast } = useToast(); + function handleDelete() { + if (!isDeletable) { + toast({ + description: "You are required to have at least one schedule", + }); + } else { + deleteFunction({ + scheduleId: schedule.id, + }); + } + } + + function handleSetDefault() { + updateDefault({ + scheduleId: schedule.id, + isDefault: true, + }); + } + + function handleDuplicate() { + duplicateFunction({ + scheduleId: schedule.id, + }); + } + return (
  • @@ -65,55 +83,12 @@ export function Availability({

    - - - - - - {!schedule.isDefault && ( - { - updateDefault({ - scheduleId: schedule.id, - isDefault: true, - }); - }} - className="min-w-40 focus:ring-mute min-w-40 focus:ring-muted"> - - Set as default - - )} - { - duplicateFunction({ - scheduleId: schedule.id, - }); - }}> - - Duplicate - - { - if (!isDeletable) { - toast({ - description: "You are required to have at least one schedule", - }); - } else { - deleteFunction({ - scheduleId: schedule.id, - }); - } - }}> - - Delete - - - - +
  • );