From 4c1aee0cfc130a99d1249d2b8936e04aa7e82d4d Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:20:14 +0530 Subject: [PATCH] fix: resolve z-index and peek overview component bug (#2624) * fix: resolved z-index issue on peek overview component * fix: fix issue with peekover view in spreadsheet view --------- Co-authored-by: gurusainath --- .../columns/issue/issue-column.tsx | 198 ++++++++++-------- .../issue/spreadsheet-issue-column.tsx | 14 +- .../spreadsheet/spreadsheet-view.tsx | 19 +- .../issues/issue-peek-overview/root.tsx | 2 +- .../issues/issue-peek-overview/view.tsx | 10 +- 5 files changed, 140 insertions(+), 103 deletions(-) diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/issue/issue-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/issue/issue-column.tsx index 18daa039a..3fd042c1d 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/issue/issue-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/issue/issue-column.tsx @@ -5,7 +5,6 @@ import { MoreHorizontal, Pencil, Trash2, ChevronRight, Link } from "lucide-react // hooks import useToast from "hooks/use-toast"; // components -import { IssuePeekOverview } from "components/issues/issue-peek-overview"; import { Tooltip } from "@plane/ui"; // helpers import { copyUrlToClipboard } from "helpers/string.helper"; @@ -16,10 +15,16 @@ type Props = { issue: IIssue; expanded: boolean; handleToggleExpand: (issueId: string) => void; - handleUpdateIssue: (issue: IIssue, data: Partial) => void; properties: IIssueDisplayProperties; handleEditIssue: (issue: IIssue) => void; handleDeleteIssue: (issue: IIssue) => void; + setIssuePeekOverView: React.Dispatch< + React.SetStateAction<{ + workspaceSlug: string; + projectId: string; + issueId: string; + } | null> + >; disableUserActions: boolean; nestingLevel: number; }; @@ -28,7 +33,7 @@ export const IssueColumn: React.FC = ({ issue, expanded, handleToggleExpand, - handleUpdateIssue, + setIssuePeekOverView, properties, handleEditIssue, handleDeleteIssue, @@ -53,105 +58,116 @@ export const IssueColumn: React.FC = ({ }); }; + const handleIssuePeekOverview = (issue: IIssue) => { + const { query } = router; + setIssuePeekOverView({ + workspaceSlug: issue?.workspace_detail?.slug, + projectId: issue?.project_detail?.id, + issueId: issue?.id, + }); + router.push({ + pathname: router.pathname, + query: { ...query, peekIssueId: issue?.id }, + }); + }; + const paddingLeft = `${nestingLevel * 54}px`; return ( -
- {properties.key && ( -
-
- - {issue.project_detail?.identifier}-{issue.sequence_id} - + <> +
+ {properties.key && ( +
+
+ + {issue.project_detail?.identifier}-{issue.sequence_id} + - {!disableUserActions && ( -
- setIsOpen(nextOpenState)} - content={ -
- + {!disableUserActions && ( +
+ setIsOpen(nextOpenState)} + content={ +
+ - + - -
- } - placement="bottom-start" + +
+ } + placement="bottom-start" + > + + +
+ )} +
+ + {issue.sub_issues_count > 0 && ( +
+
)}
- - {issue.sub_issues_count > 0 && ( -
- -
- )} -
- )} - handleUpdateIssue(issueToUpdate as IIssue, issueToUpdate)} - > - - -
+ )} +
+ +
handleIssuePeekOverview(issue)} + > {issue.name}
- -
- -
+ +
+
+ ); }; diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/issue/spreadsheet-issue-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/issue/spreadsheet-issue-column.tsx index 265925eb0..703174de5 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/issue/spreadsheet-issue-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/issue/spreadsheet-issue-column.tsx @@ -11,9 +11,15 @@ type Props = { issue: IIssue; expandedIssues: string[]; setExpandedIssues: React.Dispatch>; - handleUpdateIssue: (issue: IIssue, data: Partial) => void; properties: IIssueDisplayProperties; handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void; + setIssuePeekOverView: React.Dispatch< + React.SetStateAction<{ + workspaceSlug: string; + projectId: string; + issueId: string; + } | null> + >; disableUserActions: boolean; nestingLevel?: number; }; @@ -22,7 +28,7 @@ export const SpreadsheetIssuesColumn: React.FC = ({ issue, expandedIssues, setExpandedIssues, - handleUpdateIssue, + setIssuePeekOverView, properties, handleIssueAction, disableUserActions, @@ -51,9 +57,9 @@ export const SpreadsheetIssuesColumn: React.FC = ({ expanded={isExpanded} handleToggleExpand={handleToggleExpand} properties={properties} - handleUpdateIssue={handleUpdateIssue} handleEditIssue={() => handleIssueAction(issue, "edit")} handleDeleteIssue={() => handleIssueAction(issue, "delete")} + setIssuePeekOverView={setIssuePeekOverView} disableUserActions={disableUserActions} nestingLevel={nestingLevel} /> @@ -67,10 +73,10 @@ export const SpreadsheetIssuesColumn: React.FC = ({ key={subIssue.id} issue={subIssue} expandedIssues={expandedIssues} - handleUpdateIssue={handleUpdateIssue} setExpandedIssues={setExpandedIssues} properties={properties} handleIssueAction={handleIssueAction} + setIssuePeekOverView={setIssuePeekOverView} disableUserActions={disableUserActions} nestingLevel={nestingLevel + 1} /> diff --git a/web/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx b/web/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx index 3f49670f3..800383d1d 100644 --- a/web/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx @@ -1,10 +1,10 @@ import React, { useEffect, useRef, useState } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; -import { PlusIcon } from "lucide-react"; // components import { SpreadsheetColumnsList, SpreadsheetIssuesColumn, SpreadsheetInlineCreateIssueForm } from "components/issues"; -import { CustomMenu, Spinner } from "@plane/ui"; +import { IssuePeekOverview } from "components/issues/issue-peek-overview"; +import { Spinner } from "@plane/ui"; // types import { IIssue, @@ -47,6 +47,11 @@ export const SpreadsheetView: React.FC = observer((props) => { } = props; const [expandedIssues, setExpandedIssues] = useState([]); + const [issuePeekOverview, setIssuePeekOverView] = useState<{ + workspaceSlug: string; + projectId: string; + issueId: string; + } | null>(null); const [isInlineCreateIssueFormOpen, setIsInlineCreateIssueFormOpen] = useState(false); @@ -104,11 +109,11 @@ export const SpreadsheetView: React.FC = observer((props) => { key={`${issue.id}_${index}`} issue={issue} expandedIssues={expandedIssues} - handleUpdateIssue={handleUpdateIssue} setExpandedIssues={setExpandedIssues} properties={displayProperties} handleIssueAction={handleIssueAction} disableUserActions={disableUserActions} + setIssuePeekOverView={setIssuePeekOverView} /> ))}
@@ -174,6 +179,14 @@ export const SpreadsheetView: React.FC = observer((props) => { ))} */}
+ {issuePeekOverview && ( + handleUpdateIssue(issueToUpdate as IIssue, issueToUpdate)} + /> + )} ); }); diff --git a/web/components/issues/issue-peek-overview/root.tsx b/web/components/issues/issue-peek-overview/root.tsx index 142adad92..71a5a39e9 100644 --- a/web/components/issues/issue-peek-overview/root.tsx +++ b/web/components/issues/issue-peek-overview/root.tsx @@ -13,7 +13,7 @@ interface IIssuePeekOverview { projectId: string; issueId: string; handleIssue: (issue: Partial) => void; - children: ReactNode; + children?: ReactNode; } export const IssuePeekOverview: FC = observer((props) => { diff --git a/web/components/issues/issue-peek-overview/view.tsx b/web/components/issues/issue-peek-overview/view.tsx index 3f1b0765a..83eb7737a 100644 --- a/web/components/issues/issue-peek-overview/view.tsx +++ b/web/components/issues/issue-peek-overview/view.tsx @@ -1,6 +1,6 @@ import { FC, ReactNode, useState } from "react"; import { useRouter } from "next/router"; -import { PanelRightOpen, Square, SquareCode, MoveRight, MoveDiagonal, Bell, Link2, Trash2 } from "lucide-react"; +import { MoveRight, MoveDiagonal, Bell, Link2, Trash2 } from "lucide-react"; import { observer } from "mobx-react-lite"; import useSWR from "swr"; // components @@ -165,9 +165,11 @@ export const IssueView: FC = observer((props) => { /> )}
-
- {children} -
+ {children && ( +
+ {children} +
+ )} {issueId === peekIssueId && (