diff --git a/web/core/components/issues/issue-layouts/list/block.tsx b/web/core/components/issues/issue-layouts/list/block.tsx index e11d261de97..4f2de20f68a 100644 --- a/web/core/components/issues/issue-layouts/list/block.tsx +++ b/web/core/components/issues/issue-layouts/list/block.tsx @@ -17,7 +17,6 @@ import { IssueProperties } from "@/components/issues/issue-layouts/properties"; import { cn } from "@/helpers/common.helper"; // hooks import { useAppTheme, useIssueDetail, useProject } from "@/hooks/store"; -import useIssuePeekOverviewRedirection from "@/hooks/use-issue-peek-overview-redirection"; import { TSelectionHelper } from "@/hooks/use-multiple-select"; import { usePlatformOS } from "@/hooks/use-platform-os"; // plane web components @@ -70,16 +69,21 @@ export const IssueBlock = observer((props: IssueBlockProps) => { // hooks const { sidebarCollapsed: isSidebarCollapsed } = useAppTheme(); const { getProjectIdentifierById } = useProject(); - const { getIsIssuePeeked, peekIssue, subIssues: subIssuesStore } = useIssueDetail(); - const { handleRedirection } = useIssuePeekOverviewRedirection(); - const { isMobile } = usePlatformOS(); + const { getIsIssuePeeked, peekIssue, setPeekIssue, subIssues: subIssuesStore } = useIssueDetail(); - // handlers - const handleIssuePeekOverview = (issue: TIssue) => handleRedirection(workspaceSlug, issue, isMobile, nestingLevel); + const handleIssuePeekOverview = (issue: TIssue) => + workspaceSlug && + issue && + issue.project_id && + issue.id && + !getIsIssuePeeked(issue.id) && + setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id, nestingLevel: nestingLevel }); const issue = issuesMap[issueId]; const subIssuesCount = issue?.sub_issues_count ?? 0; + const { isMobile } = usePlatformOS(); + useEffect(() => { const element = issueRef.current; @@ -126,155 +130,128 @@ export const IssueBlock = observer((props: IssueBlockProps) => { }; //TODO: add better logic. This is to have a min width for ID/Key based on the length of project identifier - const keyMinWidth = displayProperties?.key ? (projectIdentifier?.length ?? 0) * 7 : 0; + const keyMinWidth = (projectIdentifier?.length ?? 0) * 7; return ( - { - if (!canDrag) { - setToast({ - type: TOAST_TYPE.WARNING, - title: "Cannot move issue", - message: "Drag and drop is disabled for the current grouping", - }); - } - }} + handleIssuePeekOverview(issue)} + className="w-full truncate cursor-pointer text-sm text-custom-text-100" + disabled={!!issue?.tempId} > -
-
-
- {/* select checkbox */} - {projectId && canSelectIssues && ( - - Only issues within the current -
- project can be selected. - - } - disabled={issue.project_id === projectId} - > -
- + { + if (!canDrag) { + setToast({ + type: TOAST_TYPE.WARNING, + title: "Cannot move issue", + message: "Drag and drop is disabled for the current grouping", + }); + } + }} + > +
+
+
+ {/* select checkbox */} + {projectId && canSelectIssues && ( + + Only issues within the current +
+ project can be selected. + + } + disabled={issue.project_id === projectId} + renderByDefault={false} + > +
+ +
+
+ )} + {displayProperties && displayProperties?.key && ( +
+ {issue.project_id && ( + + )}
- - )} - {displayProperties && (displayProperties.key || displayProperties.issue_type) && ( -
- {issue.project_id && ( - + )} + + {/* sub-issues chevron */} +
+ {subIssuesCount > 0 && ( + )}
- )} - {/* sub-issues chevron */} -
- {subIssuesCount > 0 && ( - + {issue?.tempId !== undefined && ( +
)}
- {issue?.tempId !== undefined && ( -
- )} -
- - {issue?.is_draft ? ( - -

{issue.name}

-
- ) : ( - handleIssuePeekOverview(issue)} - className="w-full truncate cursor-pointer text-sm text-custom-text-100" - disabled={!!issue?.tempId} - > + {issue?.is_draft ? ( + +

{issue.name}

+
+ ) : (

{issue.name}

-
- )} -
- {!issue?.tempId && ( -
- {quickActions({ - issue, - parentRef: issueRef, - })} + )}
- )} -
-
- {!issue?.tempId ? ( - <> - + {!issue?.tempId && (
{quickActions({ @@ -282,13 +259,38 @@ export const IssueBlock = observer((props: IssueBlockProps) => { parentRef: issueRef, })}
- - ) : ( -
- -
- )} -
- + )} +
+
+ {!issue?.tempId ? ( + <> + +
+ {quickActions({ + issue, + parentRef: issueRef, + })} +
+ + ) : ( +
+ +
+ )} +
+ + ); -}); +}); \ No newline at end of file diff --git a/web/core/components/issues/relations/issue-list-item.tsx b/web/core/components/issues/relations/issue-list-item.tsx index be8c7688a4e..4f24679cf5b 100644 --- a/web/core/components/issues/relations/issue-list-item.tsx +++ b/web/core/components/issues/relations/issue-list-item.tsx @@ -84,86 +84,86 @@ export const RelationIssueListItem: FC = observer((props) => { return (
- {issue && ( -
- -
-
-
- {projectDetail && ( - - )} -
+ handleIssuePeekOverview(issue)} + className="w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100" + > + {issue && ( +
+ +
+
+
+ {projectDetail && ( + + )} +
- handleIssuePeekOverview(issue)} - className="w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100" - > {issue.name} - -
-
- -
-
- - {!disabled && ( - -
- - Edit issue -
-
- )} - - -
- - Copy issue link -
-
- - {!disabled && ( - +
+
+ +
+
+ + {!disabled && ( + +
+ + Edit issue +
+
+ )} + +
- - Remove relation + + Copy issue link
- )} - {!disabled && ( - -
- - Delete issue -
-
- )} -
+ {!disabled && ( + +
+ + Remove relation +
+
+ )} + + {!disabled && ( + +
+ + Delete issue +
+
+ )} + +
-
- )} + )} +
); }); diff --git a/web/core/components/issues/sub-issues/issue-list-item.tsx b/web/core/components/issues/sub-issues/issue-list-item.tsx index c6422d9c6d1..e2ad9c5cdae 100644 --- a/web/core/components/issues/sub-issues/issue-list-item.tsx +++ b/web/core/components/issues/sub-issues/issue-list-item.tsx @@ -82,159 +82,158 @@ export const IssueListItem: React.FC = observer((props) => { return (
- {issue && ( -
-
- {/* disable the chevron when current issue is also the root issue*/} - {subIssueCount > 0 && !isCurrentIssueRoot && ( - <> - {subIssueHelpers.preview_loader.includes(issue.id) ? ( -
- -
- ) : ( -
{ - if (!subIssueHelpers.issue_visibility.includes(issueId)) { - setSubIssueHelpers(parentIssueId, "preview_loader", issueId); - await subIssueOperations.fetchSubIssues(workspaceSlug, projectId, issueId); - setSubIssueHelpers(parentIssueId, "preview_loader", issueId); - } - setSubIssueHelpers(parentIssueId, "issue_visibility", issueId); - }} - > - -
- )} - - )} -
- -
-
-
- {projectDetail && ( - + handleIssuePeekOverview(issue)} + className="w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100" + > + {issue && ( +
+
+ {/* disable the chevron when current issue is also the root issue*/} + {subIssueCount > 0 && !isCurrentIssueRoot && ( + <> + {subIssueHelpers.preview_loader.includes(issue.id) ? ( +
+ +
+ ) : ( +
{ + if (!subIssueHelpers.issue_visibility.includes(issueId)) { + setSubIssueHelpers(parentIssueId, "preview_loader", issueId); + await subIssueOperations.fetchSubIssues(workspaceSlug, projectId, issueId); + setSubIssueHelpers(parentIssueId, "preview_loader", issueId); + } + setSubIssueHelpers(parentIssueId, "issue_visibility", issueId); + }} + > + +
+ )} + )}
- handleIssuePeekOverview(issue)} - className="w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100" - > +
+
+
+ {projectDetail && ( + + )} +
{issue.name} - -
+
-
- -
+
+ +
-
- - {disabled && ( - { - handleIssueCrudState("update", parentIssueId, { ...issue }); - toggleCreateIssueModal(true); - }} - > -
- - Edit issue -
-
- )} +
+ + {disabled && ( + { + handleIssueCrudState("update", parentIssueId, { ...issue }); + toggleCreateIssueModal(true); + }} + > +
+ + Edit issue +
+
+ )} - - subIssueOperations.copyText(`${workspaceSlug}/projects/${issue.project_id}/issues/${issue.id}`) - } - > -
- - Copy issue link -
-
- - {disabled && ( { - issue.project_id && - subIssueOperations.removeSubIssue(workspaceSlug, issue.project_id, parentIssueId, issue.id); - }} + onClick={() => + subIssueOperations.copyText(`${workspaceSlug}/projects/${issue.project_id}/issues/${issue.id}`) + } >
- - Remove parent issue + + Copy issue link
- )} - {disabled && ( - { - handleIssueCrudState("delete", parentIssueId, issue); - toggleDeleteIssueModal(issue.id); - }} - > -
- - Delete issue -
-
- )} -
+ {disabled && ( + { + issue.project_id && + subIssueOperations.removeSubIssue(workspaceSlug, issue.project_id, parentIssueId, issue.id); + }} + > +
+ + Remove parent issue +
+
+ )} + + {disabled && ( + { + handleIssueCrudState("delete", parentIssueId, issue); + toggleDeleteIssueModal(issue.id); + }} + > +
+ + Delete issue +
+
+ )} + +
-
- )} - - {/* should not expand the current issue if it is also the root issue*/} - {subIssueHelpers.issue_visibility.includes(issueId) && - issue.project_id && - subIssueCount > 0 && - !isCurrentIssueRoot && ( - )} + + {/* should not expand the current issue if it is also the root issue*/} + {subIssueHelpers.issue_visibility.includes(issueId) && + issue.project_id && + subIssueCount > 0 && + !isCurrentIssueRoot && ( + + )} +
); });