From 2c3f952862f056813ba1cdb7bb901b4050245a1b Mon Sep 17 00:00:00 2001 From: dakshesh14 Date: Mon, 25 Sep 2023 17:26:37 +0530 Subject: [PATCH 1/2] feat: sticking quick-add at the bottom of the screen fix: opening create issue modal instead of quick-add in draft-issues, my-issue and profile page --- .../core/views/board-view/single-board.tsx | 10 ++- .../views/inline-issue-create-wrapper.tsx | 9 -- .../list-view/inline-create-issue-form.tsx | 19 ++-- .../core/views/list-view/single-list.tsx | 15 +++- .../spreadsheet-view/spreadsheet-view.tsx | 86 +++++++++---------- web/components/gantt-chart/sidebar.tsx | 45 +++++----- .../profile/profile-issues-view.tsx | 3 +- web/layouts/app-layout/app-sidebar.tsx | 10 ++- .../projects/[projectId]/cycles/[cycleId].tsx | 10 ++- .../[projectId]/modules/[moduleId].tsx | 6 +- 10 files changed, 118 insertions(+), 95 deletions(-) diff --git a/web/components/core/views/board-view/single-board.tsx b/web/components/core/views/board-view/single-board.tsx index 3e174ead20e..3ab38516285 100644 --- a/web/components/core/views/board-view/single-board.tsx +++ b/web/components/core/views/board-view/single-board.tsx @@ -63,6 +63,10 @@ export const SingleBoard: React.FC = (props) => { const router = useRouter(); const { cycleId, moduleId } = router.query; + const isMyIssuesPage = router.pathname.split("/")[3] === "my-issues"; + const isProfileIssuesPage = router.pathname.split("/")[2] === "profile"; + const isDraftIssuesPage = router.pathname.split("/")[4] === "draft-issues"; + const type = cycleId ? "cycle" : moduleId ? "module" : "issue"; // Check if it has at least 4 tickets since it is enough to accommodate the Calendar height @@ -213,7 +217,11 @@ export const SingleBoard: React.FC = (props) => { - ) : ( - !disableUserActions && ( - - - Add Issue - - } - position="left" - optionsClassName="left-5 !w-36" - noBorder - > - setIsInlineCreateIssueFormOpen(true)}> - Create new + ) + : !disableUserActions && + !isInlineCreateIssueFormOpen && ( + + + Add Issue + + } + position="left" + verticalPosition="top" + optionsClassName="left-5 !w-36" + noBorder + > + setIsInlineCreateIssueFormOpen(true)}> + Create new + + {openIssuesListModal && ( + + Add an existing issue - {openIssuesListModal && ( - - Add an existing issue - - )} - - ) + )} + )} - - )} ) : ( diff --git a/web/components/gantt-chart/sidebar.tsx b/web/components/gantt-chart/sidebar.tsx index 0d90ffdd06e..35b253ef9d5 100644 --- a/web/components/gantt-chart/sidebar.tsx +++ b/web/components/gantt-chart/sidebar.tsx @@ -155,31 +155,32 @@ export const GanttSidebar: React.FC = (props) => { )} {droppableProvided.placeholder} - - setIsCreateIssueFormOpen(false)} - prePopulatedData={{ - start_date: new Date(Date.now()).toISOString().split("T")[0], - target_date: new Date(Date.now() + 86400000).toISOString().split("T")[0], - ...(cycleId && { cycle: cycleId.toString() }), - ...(moduleId && { module: moduleId.toString() }), - }} - /> - - {!isCreateIssueFormOpen && ( - - )} )} +
+ setIsCreateIssueFormOpen(false)} + prePopulatedData={{ + start_date: new Date(Date.now()).toISOString().split("T")[0], + target_date: new Date(Date.now() + 86400000).toISOString().split("T")[0], + ...(cycleId && { cycle: cycleId.toString() }), + ...(moduleId && { module: moduleId.toString() }), + }} + /> + + {!isCreateIssueFormOpen && ( + + )} +
); }; diff --git a/web/components/profile/profile-issues-view.tsx b/web/components/profile/profile-issues-view.tsx index 035e8b990da..9d6a53ffec9 100644 --- a/web/components/profile/profile-issues-view.tsx +++ b/web/components/profile/profile-issues-view.tsx @@ -227,7 +227,8 @@ export const ProfileIssuesView = () => { router.pathname.includes("my-issues")) ?? false; - const disableAddIssueOption = isSubscribedIssuesRoute || isMySubscribedIssues; + const disableAddIssueOption = + isSubscribedIssuesRoute || isMySubscribedIssues || user?.id !== userId; return ( <> diff --git a/web/layouts/app-layout/app-sidebar.tsx b/web/layouts/app-layout/app-sidebar.tsx index 03ac723876a..64dbd3f0482 100644 --- a/web/layouts/app-layout/app-sidebar.tsx +++ b/web/layouts/app-layout/app-sidebar.tsx @@ -1,3 +1,4 @@ +import dynamic from "next/dynamic"; // hooks import useTheme from "hooks/use-theme"; // components @@ -5,8 +6,15 @@ import { WorkspaceHelpSection, WorkspaceSidebarDropdown, WorkspaceSidebarMenu, - WorkspaceSidebarQuickAction, } from "components/workspace"; + +const WorkspaceSidebarQuickAction = dynamic( + () => import("components/workspace").then((mod) => mod.WorkspaceSidebarQuickAction), + { + ssr: false, + } +); + import { ProjectSidebarList } from "components/project"; import { PublishProjectModal } from "components/project/publish-project/modal"; import { ConfirmProjectLeaveModal } from "components/project/confirm-project-leave-modal"; diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx index de6ad561ee0..f2962938483 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx @@ -189,10 +189,12 @@ const SingleCycle: React.FC = () => { {cycleStatus === "completed" && ( setTransferIssuesModal(true)} /> )} - +
+ +
{ onClose={() => setAnalyticsModal(false)} />
From 46d1309adf807b586a4fa9ee59b6b4baf1e6df52 Mon Sep 17 00:00:00 2001 From: dakshesh14 Date: Mon, 25 Sep 2023 18:00:46 +0530 Subject: [PATCH 2/2] fix: build error due to dynamic import --- web/layouts/app-layout/app-sidebar.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/layouts/app-layout/app-sidebar.tsx b/web/layouts/app-layout/app-sidebar.tsx index 64dbd3f0482..19878458ad0 100644 --- a/web/layouts/app-layout/app-sidebar.tsx +++ b/web/layouts/app-layout/app-sidebar.tsx @@ -8,8 +8,11 @@ import { WorkspaceSidebarMenu, } from "components/workspace"; -const WorkspaceSidebarQuickAction = dynamic( - () => import("components/workspace").then((mod) => mod.WorkspaceSidebarQuickAction), +const WorkspaceSidebarQuickAction = dynamic<{}>( + () => + import("components/workspace/sidebar-quick-action").then( + (mod) => mod.WorkspaceSidebarQuickAction + ), { ssr: false, }