From 66c7521f4b0baf7a6086246a28c497acd5f25120 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 25 Apr 2024 22:59:00 +0300 Subject: [PATCH] Fixed: Limit titles in task name to 10 artists (cherry picked from commit c81ae6546118e954e481894d0b3fa6e9a20359c7) Closes #4777 --- .../Tasks/Queued/QueuedTaskRowNameCell.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/frontend/src/System/Tasks/Queued/QueuedTaskRowNameCell.tsx b/frontend/src/System/Tasks/Queued/QueuedTaskRowNameCell.tsx index 9fc4f9e21..77142c5a3 100644 --- a/frontend/src/System/Tasks/Queued/QueuedTaskRowNameCell.tsx +++ b/frontend/src/System/Tasks/Queued/QueuedTaskRowNameCell.tsx @@ -6,6 +6,22 @@ import createMultiArtistsSelector from 'Store/Selectors/createMultiArtistsSelect import translate from 'Utilities/String/translate'; import styles from './QueuedTaskRowNameCell.css'; +function formatTitles(titles: string[]) { + if (!titles) { + return null; + } + + if (titles.length > 11) { + return ( + + {titles.slice(0, 10).join(', ')}, {titles.length - 10} more + + ); + } + + return {titles.join(', ')}; +} + export interface QueuedTaskRowNameCellProps { commandName: string; body: CommandBody; @@ -32,7 +48,7 @@ export default function QueuedTaskRowNameCell( {commandName} {sortedArtists.length ? ( - - {sortedArtists.map((a) => a.artistName).join(', ')} + - {formatTitles(sortedArtists.map((a) => a.artistName))} ) : null}