From 097365b9b9e4a53f0888777ee1abf142ecc31c25 Mon Sep 17 00:00:00 2001 From: anmolsinghbhatia Date: Mon, 24 Jul 2023 18:43:50 +0530 Subject: [PATCH 1/2] style: issue label ui updated --- .../core/board-view/single-issue.tsx | 10 +--- .../core/list-view/single-issue.tsx | 14 +---- .../core/spreadsheet-view/single-issue.tsx | 12 +--- apps/app/components/issues/index.ts | 1 + apps/app/components/issues/label.tsx | 55 +++++++++++++++++++ 5 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 apps/app/components/issues/label.tsx diff --git a/apps/app/components/core/board-view/single-issue.tsx b/apps/app/components/core/board-view/single-issue.tsx index bd87dde6cbb..bab90c53797 100644 --- a/apps/app/components/core/board-view/single-issue.tsx +++ b/apps/app/components/core/board-view/single-issue.tsx @@ -23,7 +23,7 @@ import { ViewAssigneeSelect, ViewDueDateSelect, ViewEstimateSelect, - ViewLabelSelect, + ViewIssueLabel, ViewPrioritySelect, ViewStateSelect, } from "components/issues"; @@ -365,13 +365,7 @@ export const SingleBoardIssue: React.FC = ({ /> )} {properties.labels && issue.labels.length > 0 && ( - + )} {properties.assignee && ( = ({ isNotAllowed={isNotAllowed} /> )} - {properties.labels && issue.labels.length > 0 && ( - - )} + {properties.labels && } {properties.assignee && ( = ({ )} {properties.labels && (
- +
)} diff --git a/apps/app/components/issues/index.ts b/apps/app/components/issues/index.ts index 0ac13c99281..7e9bff17567 100644 --- a/apps/app/components/issues/index.ts +++ b/apps/app/components/issues/index.ts @@ -13,3 +13,4 @@ export * from "./my-issues-list-item"; export * from "./parent-issues-list-modal"; export * from "./sidebar"; export * from "./sub-issues-list"; +export * from "./label"; diff --git a/apps/app/components/issues/label.tsx b/apps/app/components/issues/label.tsx new file mode 100644 index 00000000000..b59c1e2ec11 --- /dev/null +++ b/apps/app/components/issues/label.tsx @@ -0,0 +1,55 @@ +import React from "react"; + +// components +import { Tooltip } from "components/ui"; +// types +import { IIssue } from "types"; + +type Props = { + issue: IIssue; + maxRender?: number; +}; + +export const ViewIssueLabel: React.FC = ({ issue, maxRender = 1 }) => ( + <> + {issue.label_details.length > 0 ? ( + issue.label_details.length < maxRender || issue.label_details.length === maxRender ? ( + <> + {issue.label_details.map((label, index) => ( +
+ +
+ + {label.name} +
+
+
+ ))} + + ) : ( +
+ l.name).join(", ")} + > +
+ + {`${issue.label_details.length} Labels`} +
+
+
+ ) + ) : ( + "" + )} + +); From ff0275aff6d536334c6d5a6eb6786f4ffd47dc05 Mon Sep 17 00:00:00 2001 From: anmolsinghbhatia Date: Tue, 25 Jul 2023 11:59:21 +0530 Subject: [PATCH 2/2] chore: code refactor --- apps/app/components/issues/label.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app/components/issues/label.tsx b/apps/app/components/issues/label.tsx index b59c1e2ec11..f3a7be9dd96 100644 --- a/apps/app/components/issues/label.tsx +++ b/apps/app/components/issues/label.tsx @@ -13,7 +13,7 @@ type Props = { export const ViewIssueLabel: React.FC = ({ issue, maxRender = 1 }) => ( <> {issue.label_details.length > 0 ? ( - issue.label_details.length < maxRender || issue.label_details.length === maxRender ? ( + issue.label_details.length <= maxRender ? ( <> {issue.label_details.map((label, index) => (