From 849d3a66c143bde26845cb3736a54867da4eb365 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 23 Feb 2024 19:03:45 +0530 Subject: [PATCH] [WEB-540] fix: hide `sub_issue`, `link`, `attachment` property from list/ kanban view if their count is 0. (#3768) * [WEB-540] fix: hide `sub_issue`, `link`, `attachment` property from list/ kanban view if their count is 0. * chore: use `cn` helper function instead of string interpolation. --- .../issue-layouts/properties/all-properties.tsx | 16 +++++++++++----- .../spreadsheet/columns/sub-issue-column.tsx | 11 +++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/web/components/issues/issue-layouts/properties/all-properties.tsx b/web/components/issues/issue-layouts/properties/all-properties.tsx index 840967565..7ef9aace8 100644 --- a/web/components/issues/issue-layouts/properties/all-properties.tsx +++ b/web/components/issues/issue-layouts/properties/all-properties.tsx @@ -21,6 +21,7 @@ import { } from "components/dropdowns"; // helpers import { renderFormattedPayloadDate } from "helpers/date-time.helper"; +import { cn } from "helpers/common.helper"; // types import { TIssue, IIssueDisplayProperties, TIssuePriorities } from "@plane/types"; // constants @@ -378,12 +379,17 @@ export const IssueProperties: React.FC = observer((props) => { !!properties.sub_issue_count} + shouldRenderProperty={(properties) => !!properties.sub_issue_count && !!issue.sub_issues_count} >
{}} + className={cn( + "flex h-5 flex-shrink-0 items-center justify-center gap-2 overflow-hidden rounded border-[0.5px] border-custom-border-300 px-2.5 py-1", + { + "hover:bg-custom-background-80 cursor-pointer": issue.sub_issues_count, + } + )} >
{issue.sub_issues_count}
@@ -395,7 +401,7 @@ export const IssueProperties: React.FC = observer((props) => { !!properties.attachment_count} + shouldRenderProperty={(properties) => !!properties.attachment_count && !!issue.attachment_count} >
@@ -409,7 +415,7 @@ export const IssueProperties: React.FC = observer((props) => { !!properties.link} + shouldRenderProperty={(properties) => !!properties.link && !!issue.link_count} >
diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx index 20864eb96..c635ca85e 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx @@ -5,6 +5,8 @@ import { useRouter } from "next/router"; import { useApplication } from "hooks/store"; // types import { TIssue } from "@plane/types"; +// helpers +import { cn } from "helpers/common.helper"; type Props = { issue: TIssue; @@ -30,8 +32,13 @@ export const SpreadsheetSubIssueColumn: React.FC = observer((props: Props return (
{}} + className={cn( + "flex h-11 w-full items-center px-2.5 py-1 text-xs border-b-[0.5px] border-custom-border-200 hover:bg-custom-background-80", + { + "cursor-pointer": issue?.sub_issues_count, + } + )} > {issue?.sub_issues_count} {issue?.sub_issues_count === 1 ? "sub-issue" : "sub-issues"}