From 58977e02e258f68280663ceaa5a393b4b8ddfa83 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Thu, 30 Jan 2025 13:17:31 +0530 Subject: [PATCH] fix: recents widget title truncate --- web/core/components/core/list/list-item.tsx | 14 ++++--- .../components/home/widgets/recents/issue.tsx | 23 ++++++++---- .../components/home/widgets/recents/page.tsx | 37 +++++++++---------- .../home/widgets/recents/project.tsx | 25 +++++++------ 4 files changed, 56 insertions(+), 43 deletions(-) diff --git a/web/core/components/core/list/list-item.tsx b/web/core/components/core/list/list-item.tsx index 223879334b8..104cf3eb89f 100644 --- a/web/core/components/core/list/list-item.tsx +++ b/web/core/components/core/list/list-item.tsx @@ -8,7 +8,7 @@ import { cn } from "@/helpers/common.helper"; import { useAppRouter } from "@/hooks/use-app-router"; interface IListItemProps { - title: string; + title?: string; itemLink: string; onItemClick?: (e: React.MouseEvent) => void; prependTitleElement?: JSX.Element; @@ -72,10 +72,14 @@ export const ListItem: FC = (props) => { disabled={disableLink} >
- {prependTitleElement && {prependTitleElement}} - - {title} - + {prependTitleElement && ( + {prependTitleElement} + )} + {title && ( + + {title} + + )}
{appendTitleElement && {appendTitleElement}} diff --git a/web/core/components/home/widgets/recents/issue.tsx b/web/core/components/home/widgets/recents/issue.tsx index 77e90447223..af08942818b 100644 --- a/web/core/components/home/widgets/recents/issue.tsx +++ b/web/core/components/home/widgets/recents/issue.tsx @@ -1,9 +1,15 @@ +// plane types import { TActivityEntityData, TIssueEntityData } from "@plane/types"; +// plane ui import { LayersIcon, PriorityIcon, StateGroupIcon, Tooltip } from "@plane/ui"; +// components import { ListItem } from "@/components/core/list"; import { MemberDropdown } from "@/components/dropdowns"; +// helpers import { calculateTimeAgo } from "@/helpers/date-time.helper"; +// hooks import { useIssueDetail, useProjectState } from "@/hooks/store"; +// plane web components import { IssueIdentifier } from "@/plane-web/components/issues"; type BlockProps = { @@ -24,9 +30,9 @@ export const RecentIssue = (props: BlockProps) => { +
{issueDetails.type ? ( { /> ) : (
-
- +
+
-
+
{issueDetails?.project_identifier}-{issueDetails?.sequence_id}
)} -
{issueDetails?.name}
-
{calculateTimeAgo(activity.visited_at)}
+
+ } + appendTitleElement={ +
+ {calculateTimeAgo(activity.visited_at)}
} quickActionElement={ diff --git a/web/core/components/home/widgets/recents/page.tsx b/web/core/components/home/widgets/recents/page.tsx index 41d73a1e556..95f78737ae8 100644 --- a/web/core/components/home/widgets/recents/page.tsx +++ b/web/core/components/home/widgets/recents/page.tsx @@ -37,29 +37,26 @@ export const RecentPage = (props: BlockProps) => { -
-
- <> - {pageDetails?.logo_props?.in_use ? ( - - ) : ( - - )} - -
- {pageDetails?.project_identifier && ( -
- {pageDetails?.project_identifier} -
+
+
+ {pageDetails?.logo_props?.in_use ? ( + + ) : ( + )}
-
- {getPageName(pageDetails?.name)} -
-
{calculateTimeAgo(activity.visited_at)}
+ {pageDetails?.project_identifier && ( +
+ {pageDetails?.project_identifier} +
+ )} +
+ } + appendTitleElement={ +
+ {calculateTimeAgo(activity.visited_at)}
} quickActionElement={ diff --git a/web/core/components/home/widgets/recents/project.tsx b/web/core/components/home/widgets/recents/project.tsx index 92d5cd45e8c..1663b6bf474 100644 --- a/web/core/components/home/widgets/recents/project.tsx +++ b/web/core/components/home/widgets/recents/project.tsx @@ -1,8 +1,12 @@ import { useRouter } from "next/navigation"; +// plane types import { TActivityEntityData, TProjectEntityData } from "@plane/types"; +// plane ui import { Logo } from "@plane/ui"; +// components import { ListItem } from "@/components/core/list"; import { MemberDropdown } from "@/components/dropdowns"; +// helpers import { calculateTimeAgo } from "@/helpers/date-time.helper"; type BlockProps = { @@ -21,19 +25,18 @@ export const RecentProject = (props: BlockProps) => { -
-
- -
-
- {projectDetails?.identifier} -
+
+
+
-
{projectDetails?.name}
-
{calculateTimeAgo(activity.visited_at)}
+
{projectDetails?.identifier}
+
+ } + appendTitleElement={ +
+ {calculateTimeAgo(activity.visited_at)}
} quickActionElement={