From 13fe4c890b02cb99ff546a256256062f348ad7a3 Mon Sep 17 00:00:00 2001 From: 0xsysr3ll <31414959+0xSysR3ll@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:24:08 +0200 Subject: [PATCH] feat(issue): add issue description preview (#1881) * feat(issue): add issue description preview This PR adds a description preview to the issues list page, allowing users to quickly view issue details without navigating to individual issue pages. Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me> * fix(issue): remove unnecessary user join Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me> --------- Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me> --- server/routes/issue.ts | 1 + src/components/IssueList/IssueItem/index.tsx | 43 +++++++++++++++++++- src/i18n/locale/en.json | 1 + 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/server/routes/issue.ts b/server/routes/issue.ts index 953b37574..5b0bbd983 100644 --- a/server/routes/issue.ts +++ b/server/routes/issue.ts @@ -54,6 +54,7 @@ issueRoutes.get, IssueResultsResponse>( .leftJoinAndSelect('issue.createdBy', 'createdBy') .leftJoinAndSelect('issue.media', 'media') .leftJoinAndSelect('issue.modifiedBy', 'modifiedBy') + .leftJoinAndSelect('issue.comments', 'comments') .where('issue.status IN (:...issueStatus)', { issueStatus: statusFilter, }); diff --git a/src/components/IssueList/IssueItem/index.tsx b/src/components/IssueList/IssueItem/index.tsx index 53c618fea..ddaa0db3b 100644 --- a/src/components/IssueList/IssueItem/index.tsx +++ b/src/components/IssueList/IssueItem/index.tsx @@ -1,6 +1,7 @@ import Badge from '@app/components/Common/Badge'; import Button from '@app/components/Common/Button'; import CachedImage from '@app/components/Common/CachedImage'; +import Tooltip from '@app/components/Common/Tooltip'; import { issueOptions } from '@app/components/IssueModal/constants'; import { Permission, useUser } from '@app/hooks/useUser'; import globalMessages from '@app/i18n/globalMessages'; @@ -26,6 +27,7 @@ const messages = defineMessages('components.IssueList.IssueItem', { opened: 'Opened', viewissue: 'View Issue', unknownissuetype: 'Unknown', + descriptionpreview: 'Issue Description', }); const isMovie = (movie: MovieDetails | TvDetails): movie is MovieDetails => { @@ -107,8 +109,15 @@ const IssueItem = ({ issue }: IssueItemProps) => { } } + const description = issue.comments?.[0]?.message || ''; + const maxDescriptionLength = 120; + const shouldTruncate = description.length > maxDescriptionLength; + const truncatedDescription = shouldTruncate + ? description.substring(0, maxDescriptionLength) + '...' + : description; + return ( -
+
{title.backdropPath && (
{ > {isMovie(title) ? title.title : title.name} + {description && ( +
+
+ {shouldTruncate ? ( + +
+ Issue Description +
+
+ {description} +
+
+ } + tooltipConfig={{ + placement: 'top', + offset: [0, 8], + }} + > + + {truncatedDescription} + + + ) : ( + {description} + )} +
+
+ )} {problemSeasonEpisodeLine.length > 0 && ( -
+
{problemSeasonEpisodeLine.map((t, k) => ( {t} ))} diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index 1585a4252..0049d4d75 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -180,6 +180,7 @@ "components.IssueDetails.toaststatusupdated": "Issue status updated successfully!", "components.IssueDetails.toaststatusupdatefailed": "Something went wrong while updating the issue status.", "components.IssueDetails.unknownissuetype": "Unknown", + "components.IssueList.IssueItem.descriptionpreview": "Issue Description", "components.IssueList.IssueItem.episodes": "{episodeCount, plural, one {Episode} other {Episodes}}", "components.IssueList.IssueItem.issuestatus": "Status", "components.IssueList.IssueItem.issuetype": "Type",