From b3a9e6e83d58e01a4eaf58c81d8b9b6c1bb976a3 Mon Sep 17 00:00:00 2001 From: gurusainath Date: Thu, 2 Nov 2023 19:56:59 +0530 Subject: [PATCH 1/2] fix: resolved z-index issue on peek overview component --- .../columns/issue/issue-column.tsx | 199 ++++++++++-------- .../issues/issue-peek-overview/root.tsx | 2 +- .../issues/issue-peek-overview/view.tsx | 10 +- 3 files changed, 119 insertions(+), 92 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 18daa039ac2..55261a8b5b2 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 @@ -53,105 +53,130 @@ export const IssueColumn: React.FC = ({ }); }; + const [issuePeekOverview, setIssuePeekOverView] = useState<{ + workspaceSlug: string; + projectId: string; + issueId: string; + } | null>(null); + 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 && ( -
- + )} +
+ +
handleIssuePeekOverview(issue)} + > + {issue.name}
- )} +
+
+ + {issuePeekOverview && ( + handleUpdateIssue(issueToUpdate as IIssue, issueToUpdate)} + /> )} - handleUpdateIssue(issueToUpdate as IIssue, issueToUpdate)} - > - - -
- {issue.name} -
-
-
-
-
+ ); }; diff --git a/web/components/issues/issue-peek-overview/root.tsx b/web/components/issues/issue-peek-overview/root.tsx index 142adad9296..71a5a39e97f 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 3f1b0765a0d..83eb7737aaf 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 && (
Date: Fri, 3 Nov 2023 02:29:43 +0530 Subject: [PATCH 2/2] fix: fix issue with peekover view in spreadsheet view --- .../columns/issue/issue-column.tsx | 25 ++++++------------- .../issue/spreadsheet-issue-column.tsx | 14 ++++++++--- .../spreadsheet/spreadsheet-view.tsx | 19 +++++++++++--- 3 files changed, 34 insertions(+), 24 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 55261a8b5b2..3fd042c1d3c 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,11 +58,6 @@ export const IssueColumn: React.FC = ({ }); }; - const [issuePeekOverview, setIssuePeekOverView] = useState<{ - workspaceSlug: string; - projectId: string; - issueId: string; - } | null>(null); const handleIssuePeekOverview = (issue: IIssue) => { const { query } = router; setIssuePeekOverView({ @@ -168,15 +168,6 @@ export const IssueColumn: React.FC = ({
- - {issuePeekOverview && ( - handleUpdateIssue(issueToUpdate as IIssue, issueToUpdate)} - /> - )} ); }; 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 265925eb0d7..703174de591 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 3f49670f348..800383d1def 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)} + /> + )}
); });