Skip to content

Commit

Permalink
Fixed: Limit titles in task name to 10 artists
Browse files Browse the repository at this point in the history
(cherry picked from commit c81ae6546118e954e481894d0b3fa6e9a20359c7)

Closes #4777
  • Loading branch information
mynameisbogdan committed Apr 28, 2024
1 parent 8b57b33 commit 66c7521
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion frontend/src/System/Tasks/Queued/QueuedTaskRowNameCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<span title={titles.join(', ')}>
{titles.slice(0, 10).join(', ')}, {titles.length - 10} more
</span>
);
}

return <span>{titles.join(', ')}</span>;
}

export interface QueuedTaskRowNameCellProps {
commandName: string;
body: CommandBody;
Expand All @@ -32,7 +48,7 @@ export default function QueuedTaskRowNameCell(
<span className={styles.commandName}>
{commandName}
{sortedArtists.length ? (
<span> - {sortedArtists.map((a) => a.artistName).join(', ')}</span>
<span> - {formatTitles(sortedArtists.map((a) => a.artistName))}</span>
) : null}
</span>

Expand Down

0 comments on commit 66c7521

Please sign in to comment.