Skip to content

Commit d099992

Browse files
committed
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>
1 parent 368ecf8 commit d099992

3 files changed

Lines changed: 46 additions & 4 deletions

File tree

server/routes/issue.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ issueRoutes.get<Record<string, string>, IssueResultsResponse>(
5454
.leftJoinAndSelect('issue.createdBy', 'createdBy')
5555
.leftJoinAndSelect('issue.media', 'media')
5656
.leftJoinAndSelect('issue.modifiedBy', 'modifiedBy')
57+
.leftJoinAndSelect('issue.comments', 'comments')
58+
.leftJoinAndSelect('comments.user', 'user')
5759
.where('issue.status IN (:...issueStatus)', {
5860
issueStatus: statusFilter,
5961
});

src/components/IssueList/IssueItem/index.tsx

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Badge from '@app/components/Common/Badge';
22
import Button from '@app/components/Common/Button';
33
import CachedImage from '@app/components/Common/CachedImage';
4+
import Tooltip from '@app/components/Common/Tooltip';
45
import { issueOptions } from '@app/components/IssueModal/constants';
56
import { Permission, useUser } from '@app/hooks/useUser';
67
import globalMessages from '@app/i18n/globalMessages';
@@ -26,6 +27,7 @@ const messages = defineMessages('components.IssueList.IssueItem', {
2627
opened: 'Opened',
2728
viewissue: 'View Issue',
2829
unknownissuetype: 'Unknown',
30+
descriptionpreview: 'Issue Description',
2931
});
3032

3133
const isMovie = (movie: MovieDetails | TvDetails): movie is MovieDetails => {
@@ -107,8 +109,15 @@ const IssueItem = ({ issue }: IssueItemProps) => {
107109
}
108110
}
109111

112+
const description = issue.comments?.[0]?.message || '';
113+
const maxDescriptionLength = 120;
114+
const shouldTruncate = description.length > maxDescriptionLength;
115+
const truncatedDescription = shouldTruncate
116+
? description.substring(0, maxDescriptionLength) + '...'
117+
: description;
118+
110119
return (
111-
<div className="relative flex w-full flex-col justify-between overflow-hidden rounded-xl bg-gray-800 py-4 text-gray-400 shadow-md ring-1 ring-gray-700 xl:h-28 xl:flex-row">
120+
<div className="relative flex w-full flex-col justify-between overflow-hidden rounded-xl bg-gray-800 py-4 text-gray-400 shadow-md ring-1 ring-gray-700 xl:flex-row">
112121
{title.backdropPath && (
113122
<div className="absolute inset-0 z-0 w-full bg-cover bg-center xl:w-2/3">
114123
<CachedImage
@@ -168,8 +177,38 @@ const IssueItem = ({ issue }: IssueItemProps) => {
168177
>
169178
{isMovie(title) ? title.title : title.name}
170179
</Link>
180+
{description && (
181+
<div className="mt-1 max-w-full">
182+
<div className="overflow-hidden text-sm text-gray-300">
183+
{shouldTruncate ? (
184+
<Tooltip
185+
content={
186+
<div className="max-w-sm p-3">
187+
<div className="mb-1 text-sm font-medium text-gray-200">
188+
Issue Description
189+
</div>
190+
<div className="whitespace-pre-wrap text-sm leading-relaxed text-gray-300">
191+
{description}
192+
</div>
193+
</div>
194+
}
195+
tooltipConfig={{
196+
placement: 'top',
197+
offset: [0, 8],
198+
}}
199+
>
200+
<span className="block cursor-help truncate transition-colors hover:text-gray-200">
201+
{truncatedDescription}
202+
</span>
203+
</Tooltip>
204+
) : (
205+
<span className="block break-words">{description}</span>
206+
)}
207+
</div>
208+
</div>
209+
)}
171210
{problemSeasonEpisodeLine.length > 0 && (
172-
<div className="card-field">
211+
<div className="card-field mt-1">
173212
{problemSeasonEpisodeLine.map((t, k) => (
174213
<span key={k}>{t}</span>
175214
))}

src/i18n/locale/en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"components.Discover.StudioSlider.studios": "Studios",
105105
"components.Discover.TvGenreList.seriesgenres": "Series Genres",
106106
"components.Discover.TvGenreSlider.tvgenres": "Series Genres",
107+
"components.DiscoverTvUpcoming.upcomingtv": "Upcoming Series",
107108
"components.Discover.createnewslider": "Create New Slider",
108109
"components.Discover.customizediscover": "Customize Discover",
109110
"components.Discover.discover": "Discover",
@@ -137,7 +138,6 @@
137138
"components.Discover.upcomingtv": "Upcoming Series",
138139
"components.Discover.updatefailed": "Something went wrong updating the discover customization settings.",
139140
"components.Discover.updatesuccess": "Updated discover customization settings.",
140-
"components.DiscoverTvUpcoming.upcomingtv": "Upcoming Series",
141141
"components.DownloadBlock.estimatedtime": "Estimated {time}",
142142
"components.DownloadBlock.formattedTitle": "{title}: Season {seasonNumber} Episode {episodeNumber}",
143143
"components.IssueDetails.IssueComment.areyousuredelete": "Are you sure you want to delete this comment?",
@@ -180,6 +180,7 @@
180180
"components.IssueDetails.toaststatusupdated": "Issue status updated successfully!",
181181
"components.IssueDetails.toaststatusupdatefailed": "Something went wrong while updating the issue status.",
182182
"components.IssueDetails.unknownissuetype": "Unknown",
183+
"components.IssueList.IssueItem.descriptionpreview": "Issue Description",
183184
"components.IssueList.IssueItem.episodes": "{episodeCount, plural, one {Episode} other {Episodes}}",
184185
"components.IssueList.IssueItem.issuestatus": "Status",
185186
"components.IssueList.IssueItem.issuetype": "Type",
@@ -1225,7 +1226,7 @@
12251226
"components.Setup.librarieserror": "Validation failed. Please toggle the libraries again to continue.",
12261227
"components.Setup.servertype": "Choose Server Type",
12271228
"components.Setup.setup": "Setup",
1228-
"components.Setup.signin": "Sign in to your account",
1229+
"components.Setup.signin": "Sign In",
12291230
"components.Setup.signinMessage": "Get started by signing in",
12301231
"components.Setup.signinWithEmby": "Enter your Emby details",
12311232
"components.Setup.signinWithJellyfin": "Enter your Jellyfin details",

0 commit comments

Comments
 (0)