From fc5901d2d67cd5554a6b8e7495a1656004b89b38 Mon Sep 17 00:00:00 2001 From: LAKHAN BAHETI Date: Thu, 22 Feb 2024 12:33:58 +0530 Subject: [PATCH] chore: updated project-pages related events --- .../sign-up-forms/optional-set-password.tsx | 2 +- .../core/modals/gpt-assistant-popover.tsx | 23 ++++- .../list/quick-add-issue-form.tsx | 2 +- web/components/issues/issue-layouts/utils.tsx | 4 +- web/components/pages/pages-list/list-item.tsx | 71 ++++++++++++---- .../workspace/delete-workspace-modal.tsx | 2 +- web/components/workspace/sidebar-dropdown.tsx | 1 - web/components/workspace/views/header.tsx | 2 +- web/constants/event-tracker.ts | 11 +++ .../projects/[projectId]/pages/[pageId].tsx | 84 +++++++++++++++++-- .../[workspaceSlug]/settings/members.tsx | 2 +- web/pages/invitations/index.tsx | 2 +- 12 files changed, 171 insertions(+), 35 deletions(-) diff --git a/web/components/account/sign-up-forms/optional-set-password.tsx b/web/components/account/sign-up-forms/optional-set-password.tsx index b49adabbb..1eeb45b48 100644 --- a/web/components/account/sign-up-forms/optional-set-password.tsx +++ b/web/components/account/sign-up-forms/optional-set-password.tsx @@ -11,7 +11,7 @@ import { Button, Input } from "@plane/ui"; import { checkEmailValidity } from "helpers/string.helper"; // constants import { ESignUpSteps } from "components/account"; -import { PASSWORD_CREATE_SELECTED, PASSWORD_CREATE_SKIPPED, SETUP_PASSWORD } from "constants/event-tracker"; +import { PASSWORD_CREATE_SKIPPED, SETUP_PASSWORD } from "constants/event-tracker"; // icons import { Eye, EyeOff } from "lucide-react"; diff --git a/web/components/core/modals/gpt-assistant-popover.tsx b/web/components/core/modals/gpt-assistant-popover.tsx index 590015e12..34c5c673a 100644 --- a/web/components/core/modals/gpt-assistant-popover.tsx +++ b/web/components/core/modals/gpt-assistant-popover.tsx @@ -17,7 +17,9 @@ type Props = { isOpen: boolean; projectId: string; handleClose: () => void; - onResponse: (response: any) => void; + onResponse: (question: string, response: any) => void; + onGenerateResponse?: (question: string, response: any) => void; + onReGenerateResponse?: (question: string, response: any) => void; onError?: (error: any) => void; placement?: Placement; prompt?: string; @@ -33,7 +35,19 @@ type FormData = { const aiService = new AIService(); export const GptAssistantPopover: React.FC = (props) => { - const { isOpen, projectId, handleClose, onResponse, onError, placement, prompt, button, className = "" } = props; + const { + isOpen, + projectId, + handleClose, + onResponse, + onGenerateResponse, + onReGenerateResponse, + onError, + placement, + prompt, + button, + className = "", + } = props; // states const [response, setResponse] = useState(""); const [invalidResponse, setInvalidResponse] = useState(false); @@ -55,6 +69,7 @@ export const GptAssistantPopover: React.FC = (props) => { handleSubmit, control, reset, + getValues, setFocus, formState: { isSubmitting }, } = useForm({ @@ -120,6 +135,8 @@ export const GptAssistantPopover: React.FC = (props) => { } await callAIService(formData); + if (response !== "" && onReGenerateResponse) onReGenerateResponse(formData.task, response); + else if (response === "" && onGenerateResponse) onGenerateResponse(formData.task, response); }; useEffect(() => { @@ -164,7 +181,7 @@ export const GptAssistantPopover: React.FC = (props) => {