From 81256d63732562ef1ad37b04f387b398e04a0ed0 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:17:38 +0530 Subject: [PATCH] chore: add tooltips to issue properties with no value (#3169) * chore: add tolltips to properties with no value * chore: update property types --- .../issue-layouts/kanban/properties.tsx | 8 +-- .../issues/issue-layouts/list/properties.tsx | 8 +-- .../issues/issue-layouts/properties/date.tsx | 63 ++++++++++--------- .../issue-layouts/properties/labels.tsx | 20 +++--- 4 files changed, 54 insertions(+), 45 deletions(-) diff --git a/web/components/issues/issue-layouts/kanban/properties.tsx b/web/components/issues/issue-layouts/kanban/properties.tsx index 788607690..9590c9068 100644 --- a/web/components/issues/issue-layouts/kanban/properties.tsx +++ b/web/components/issues/issue-layouts/kanban/properties.tsx @@ -57,7 +57,7 @@ export const KanBanProperties: React.FC = observer((props) => ); }; - const handleStartDate = (date: string) => { + const handleStartDate = (date: string | null) => { handleIssues( !sub_group_id && sub_group_id === "null" ? null : sub_group_id, !group_id && group_id === "null" ? null : group_id, @@ -65,7 +65,7 @@ export const KanBanProperties: React.FC = observer((props) => ); }; - const handleTargetDate = (date: string) => { + const handleTargetDate = (date: string | null) => { handleIssues( !sub_group_id && sub_group_id === "null" ? null : sub_group_id, !group_id && group_id === "null" ? null : group_id, @@ -122,7 +122,7 @@ export const KanBanProperties: React.FC = observer((props) => {displayProperties && displayProperties?.start_date && ( handleStartDate(date)} + onChange={(date) => handleStartDate(date)} disabled={isReadOnly} type="start_date" /> @@ -132,7 +132,7 @@ export const KanBanProperties: React.FC = observer((props) => {displayProperties && displayProperties?.due_date && ( handleTargetDate(date)} + onChange={(date) => handleTargetDate(date)} disabled={isReadOnly} type="target_date" /> diff --git a/web/components/issues/issue-layouts/list/properties.tsx b/web/components/issues/issue-layouts/list/properties.tsx index 8b6f54010..eeff3b273 100644 --- a/web/components/issues/issue-layouts/list/properties.tsx +++ b/web/components/issues/issue-layouts/list/properties.tsx @@ -40,11 +40,11 @@ export const ListProperties: FC = observer((props) => { handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, assignees: ids }); }; - const handleStartDate = (date: string) => { + const handleStartDate = (date: string | null) => { handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, start_date: date }); }; - const handleTargetDate = (date: string) => { + const handleTargetDate = (date: string | null) => { handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, target_date: date }); }; @@ -106,7 +106,7 @@ export const ListProperties: FC = observer((props) => { {displayProperties && displayProperties?.start_date && ( handleStartDate(date)} + onChange={(date) => handleStartDate(date)} disabled={isReadonly} type="start_date" /> @@ -116,7 +116,7 @@ export const ListProperties: FC = observer((props) => { {displayProperties && displayProperties?.due_date && ( handleTargetDate(date)} + onChange={(date) => handleTargetDate(date)} disabled={isReadonly} type="target_date" /> diff --git a/web/components/issues/issue-layouts/properties/date.tsx b/web/components/issues/issue-layouts/properties/date.tsx index 9077c68d8..cfe3481e3 100644 --- a/web/components/issues/issue-layouts/properties/date.tsx +++ b/web/components/issues/issue-layouts/properties/date.tsx @@ -12,11 +12,11 @@ import { Tooltip } from "@plane/ui"; // hooks import useDynamicDropdownPosition from "hooks/use-dynamic-dropdown"; // helpers -import { renderDateFormat } from "helpers/date-time.helper"; +import { renderDateFormat, renderFormattedDate } from "helpers/date-time.helper"; export interface IIssuePropertyDate { - value: any; - onChange: (date: any) => void; + value: string | null; + onChange: (date: string | null) => void; disabled?: boolean; type: "start_date" | "target_date"; } @@ -57,33 +57,40 @@ export const IssuePropertyDate: React.FC = observer((props) <> e.stopPropagation()} > -
- - {value && ( - <> - -
{value}
-
- -
{ - if (onChange) onChange(null); - }} - > - -
- - )} -
+ +
+
+ + {value && ( + <> +
{value}
+
{ + if (onChange) onChange(null); + }} + > + +
+ + )} +
+
+
@@ -94,7 +101,7 @@ export const IssuePropertyDate: React.FC = observer((props) {({ close }) => ( { + onChange={(val, e) => { e?.stopPropagation(); if (onChange && val) { onChange(renderDateFormat(val)); diff --git a/web/components/issues/issue-layouts/properties/labels.tsx b/web/components/issues/issue-layouts/properties/labels.tsx index a4bd54338..282268d7b 100644 --- a/web/components/issues/issue-layouts/properties/labels.tsx +++ b/web/components/issues/issue-layouts/properties/labels.tsx @@ -107,7 +107,7 @@ export const IssuePropertyLabels: React.FC = observer((pro {projectLabels ?.filter((l) => value.includes(l.id)) .map((label) => ( - +
= observer((pro
) ) : ( -
- - {placeholderText} -
+ +
+ + {placeholderText} +
+
)}
);