diff --git a/web/components/analytics/custom-analytics/create-update-analytics-modal.tsx b/web/components/analytics/custom-analytics/create-update-analytics-modal.tsx deleted file mode 100644 index 508f5722ec0..00000000000 --- a/web/components/analytics/custom-analytics/create-update-analytics-modal.tsx +++ /dev/null @@ -1,174 +0,0 @@ -import React from "react"; - -import { useRouter } from "next/router"; - -// react-hook-form -import { Controller, useForm } from "react-hook-form"; -// headless ui -import { Dialog, Transition } from "@headlessui/react"; -// services -import analyticsService from "services/analytics.service"; -// hooks -import useToast from "hooks/use-toast"; -// ui -import { Button, Input, TextArea } from "@plane/ui"; -// types -import { IAnalyticsParams, ISaveAnalyticsFormData } from "types"; - -// types -type Props = { - isOpen: boolean; - handleClose: () => void; - params?: IAnalyticsParams; -}; - -type FormValues = { - name: string; - description: string; -}; - -const defaultValues: FormValues = { - name: "", - description: "", -}; - -export const CreateUpdateAnalyticsModal: React.FC = ({ isOpen, handleClose, params }) => { - const router = useRouter(); - const { workspaceSlug } = router.query; - - const { setToastAlert } = useToast(); - - const { - formState: { errors, isSubmitting }, - handleSubmit, - control, - reset, - } = useForm({ - defaultValues, - }); - - const onClose = () => { - handleClose(); - reset(defaultValues); - }; - - const onSubmit = async (formData: FormValues) => { - if (!workspaceSlug) return; - - const payload: ISaveAnalyticsFormData = { - name: formData.name, - description: formData.description, - query_dict: { - x_axis: "priority", - y_axis: "issue_count", - ...params, - project: params?.project ?? [], - }, - }; - - await analyticsService - .saveAnalytics(workspaceSlug.toString(), payload) - .then(() => { - setToastAlert({ - type: "success", - title: "Success!", - message: "Analytics saved successfully.", - }); - onClose(); - }) - .catch(() => - setToastAlert({ - type: "error", - title: "Error!", - message: "Analytics could not be saved. Please try again.", - }) - ); - }; - - return ( - - - -
- - -
-
- - -
-
- - Save Analytics - -
- ( - - )} - /> - ( -