feat(uploads): show artist and album in batch headers
This commit is contained in:
1 parent
39bf7d4b70
commit
5876ae29cc
2 files changed
+17
-1
No files matched your search
@@ -36,6 +36,16 @@ export function BatchCard({
|
||||
const all = ids.every((id) => selected.has(id));
|
||||
const size = files.reduce((n, f) => n + f.size_bytes, 0);
|
||||
const summary = batchSummary(files);
|
||||
const metadata = first.metadata;
|
||||
const albumArtist = metadata?.albumartist || metadata?.artist || '';
|
||||
const singleAlbum = releaseGroups.length === 1 ? releaseGroups[0]
|
||||
: releaseGroups.length === 0 && metadata?.album && files.every((file) =>
|
||||
file.metadata?.album.trim().toLowerCase() === metadata.album.trim().toLowerCase()
|
||||
&& (file.metadata.albumartist || file.metadata.artist || '').trim().toLowerCase() === albumArtist.trim().toLowerCase())
|
||||
? { artist: albumArtist, album: metadata.album } : undefined;
|
||||
const albumTitle = singleAlbum?.album && singleAlbum.album.trim().toLowerCase() !== 'unknown album'
|
||||
? [singleAlbum.artist.trim().toLowerCase() === 'unknown artist' ? '' : singleAlbum.artist, singleAlbum.album].filter(Boolean).join(' — ')
|
||||
: undefined;
|
||||
return (
|
||||
<section className={u.batch} aria-label={t('uploads.batch_of', { author: first.author.username })}>
|
||||
<div className={u.batchHead}>
|
||||
@@ -45,7 +55,10 @@ export function BatchCard({
|
||||
{selectable && (
|
||||
<input type="checkbox" aria-label={t('uploads.select_batch')} checked={all} onChange={(e) => onToggle(ids, e.target.checked)} />
|
||||
)}
|
||||
<b>{first.author.username}</b>
|
||||
{albumTitle ? <div className={u.batchIdentity}>
|
||||
<strong title={albumTitle}>{albumTitle}</strong>
|
||||
<span>{first.author.username}</span>
|
||||
</div> : <b>{first.author.username}</b>}
|
||||
<span>{formatDateTime(first.created_at, i18n.language)}</span>
|
||||
<span>{t('uploads.batch_size', { count: files.length, size: formatBytes(size, i18n.language) })}</span>
|
||||
<span>{summary.formats.map(([format, count]) => `${count} × ${format || t('uploads.format_unknown')}`).join(' · ')}</span>
|
||||
|
||||
@@ -179,6 +179,9 @@
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.batchIdentity { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: min(360px, 100%); }
|
||||
.batchIdentity strong { color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
|
||||
|
||||
.batchToggle { min-width: 44px; min-height: 44px; padding: 8px; }
|
||||
.batchExpanded { transform: rotate(90deg); }
|
||||
|
||||
|
||||
Reference in new issue
Block a user