diff --git a/web/components/issues/issue-layouts/roots/project-layout-root.tsx b/web/components/issues/issue-layouts/roots/project-layout-root.tsx index 7f1ea139b..ee82679a5 100644 --- a/web/components/issues/issue-layouts/roots/project-layout-root.tsx +++ b/web/components/issues/issue-layouts/roots/project-layout-root.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import useSWR from "swr"; @@ -14,11 +14,8 @@ import { ProjectSpreadsheetLayout, } from "components/issues"; import { Spinner } from "@plane/ui"; -import { ProjectIssueModal } from "components/issues/issue-modal/modal"; export const ProjectLayoutRoot: React.FC = observer(() => { - const [isModalOpen, setIsModalOpen] = useState(true); - const router = useRouter(); const { workspaceSlug, projectId } = router.query as { workspaceSlug: string; projectId: string }; @@ -37,34 +34,31 @@ export const ProjectLayoutRoot: React.FC = observer(() => { const activeLayout = issueFilters?.displayFilters?.layout; return ( - <> - {projectId && setIsModalOpen(false)} />} -
- +
+ - {loader === "init-loader" ? ( -
- + {loader === "init-loader" ? ( +
+ +
+ ) : ( + <> + {/* {(activeLayout === "list" || activeLayout === "spreadsheet") && issueCount === 0 && } */} +
+ {activeLayout === "list" ? ( + + ) : activeLayout === "kanban" ? ( + + ) : activeLayout === "calendar" ? ( + + ) : activeLayout === "gantt_chart" ? ( + + ) : activeLayout === "spreadsheet" ? ( + + ) : null}
- ) : ( - <> - {/* {(activeLayout === "list" || activeLayout === "spreadsheet") && issueCount === 0 && } */} -
- {activeLayout === "list" ? ( - - ) : activeLayout === "kanban" ? ( - - ) : activeLayout === "calendar" ? ( - - ) : activeLayout === "gantt_chart" ? ( - - ) : activeLayout === "spreadsheet" ? ( - - ) : null} -
- - )} -
- + + )} +
); }); diff --git a/web/components/issues/issue-modal/draft-issue-layout.tsx b/web/components/issues/issue-modal/draft-issue-layout.tsx index 09d9ff290..668c0363d 100644 --- a/web/components/issues/issue-modal/draft-issue-layout.tsx +++ b/web/components/issues/issue-modal/draft-issue-layout.tsx @@ -17,7 +17,7 @@ export interface DraftIssueProps { changesMade: Partial | null; data?: IIssue; onChange: (formData: Partial | null) => void; - onClose: () => void; + onClose: (saveDraftIssueInLocalStorage?: boolean) => void; onSubmit: (formData: Partial) => Promise; projectId: string; } @@ -39,7 +39,7 @@ export const DraftIssueLayout: React.FC = observer((props) => { const handleClose = () => { if (changesMade) setIssueDiscardModal(true); - else onClose(); + else onClose(false); }; const handleCreateDraftIssue = async () => { @@ -58,7 +58,7 @@ export const DraftIssueLayout: React.FC = observer((props) => { onChange(null); setIssueDiscardModal(false); - handleClose(); + onClose(false); }) .catch(() => setToastAlert({ @@ -84,7 +84,7 @@ export const DraftIssueLayout: React.FC = observer((props) => { onDiscard={() => { onChange(null); setIssueDiscardModal(false); - onClose(); + onClose(false); }} /> void; + withDraftIssueWrapper?: boolean; } export const ProjectIssueModal: React.FC = observer((props) => { - const { data, isOpen, onClose } = props; + const { data, isOpen, onClose, withDraftIssueWrapper } = props; const [changesMade, setChangesMade] = useState | null>(null); @@ -38,8 +40,8 @@ export const ProjectIssueModal: React.FC = observer((props) => const { setValue: setLocalStorageDraftIssue } = useLocalStorage("draftedIssue", {}); - const handleClose = () => { - if (changesMade) { + const handleClose = (saveDraftIssueInLocalStorage?: boolean) => { + if (changesMade && saveDraftIssueInLocalStorage) { const draftIssue = JSON.stringify(changesMade); setLocalStorageDraftIssue(draftIssue); @@ -133,7 +135,7 @@ export const ProjectIssueModal: React.FC = observer((props) => return ( - + handleClose(true)}> = observer((props) => leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - setChangesMade(formData)} - onClose={handleClose} - onSubmit={handleFormSubmit} - projectId={selectedProjectId} - /> + {withDraftIssueWrapper ? ( + setChangesMade(formData)} + onClose={handleClose} + onSubmit={handleFormSubmit} + projectId={selectedProjectId} + /> + ) : ( + handleClose(false)} + onSubmit={handleFormSubmit} + projectId={selectedProjectId} + /> + )}