diff --git a/packages/atoms/availabilitylist/NewScheduleButton.tsx b/packages/atoms/availabilitylist/NewScheduleButton.tsx index 25ae48df3a..1abe6e7915 100644 --- a/packages/atoms/availabilitylist/NewScheduleButton.tsx +++ b/packages/atoms/availabilitylist/NewScheduleButton.tsx @@ -1,19 +1,65 @@ -import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; +import { + Dialog, + DialogTrigger, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { useForm } from "react-hook-form"; + +import type { HttpError } from "@calcom/lib/http-error"; +import { Plus } from "@calcom/ui/components/icon"; import { Button } from "../src/components/ui/button"; import { Form } from "./Form"; +import type { Schedule } from ".prisma/client"; + +// create mutation handler to be handled outside the component +// then passed in as a prop +// TODO: translations can be taken care of later + +export function NewScheduleButton({ + name = "new-schedule", + createMutation, +}: { + name?: string; + createMutation: (values: { + onSucess: (schedule: Schedule) => void; + onError: (err: HttpError) => void; + }) => void; +}) { + const form = useForm<{ + name: string; + }>(); + const { register } = form; -export function NewScheduleButton({ name = "new-schedule" }: { name?: string }) { return (
- + Add new schedule -
+ { + createMutation(values); + }}> + + + + + + +