mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
remove compilation from primary album section groupings
This commit is contained in:
@@ -981,71 +981,30 @@ const groupAlbumsByReleaseType = (
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Priority 2: Compilations
|
const releaseTypes = album.releaseTypes || [];
|
||||||
if (album.isCompilation) {
|
const normalizedTypes = releaseTypes.map((type) => type.toLowerCase());
|
||||||
const compilationKey = 'compilation';
|
|
||||||
if (!acc[compilationKey]) {
|
let matchedType: null | string = null;
|
||||||
acc[compilationKey] = [];
|
|
||||||
}
|
if (normalizedTypes.includes('album')) {
|
||||||
acc[compilationKey].push(album);
|
matchedType = 'album';
|
||||||
return acc;
|
} else if (normalizedTypes.includes('single')) {
|
||||||
|
matchedType = 'single';
|
||||||
|
} else if (normalizedTypes.includes('ep')) {
|
||||||
|
matchedType = 'ep';
|
||||||
|
} else if (normalizedTypes.includes('broadcast')) {
|
||||||
|
matchedType = 'broadcast';
|
||||||
|
} else if (normalizedTypes.includes('other')) {
|
||||||
|
matchedType = 'other';
|
||||||
|
} else {
|
||||||
|
matchedType = 'album';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Priority 3: EP
|
const releaseTypeKey = matchedType;
|
||||||
const hasEPType = album.releaseTypes?.some((type) => type.toLowerCase() === 'ep');
|
if (!acc[releaseTypeKey]) {
|
||||||
if (hasEPType) {
|
acc[releaseTypeKey] = [];
|
||||||
const epKey = 'ep';
|
|
||||||
if (!acc[epKey]) {
|
|
||||||
acc[epKey] = [];
|
|
||||||
}
|
|
||||||
acc[epKey].push(album);
|
|
||||||
return acc;
|
|
||||||
}
|
}
|
||||||
|
acc[releaseTypeKey].push(album);
|
||||||
// Priority 4: Single (other non-album types)
|
|
||||||
const hasSingleType = album.releaseTypes?.some(
|
|
||||||
(type) => type.toLowerCase() === 'single',
|
|
||||||
);
|
|
||||||
if (hasSingleType) {
|
|
||||||
const singleKey = 'single';
|
|
||||||
if (!acc[singleKey]) {
|
|
||||||
acc[singleKey] = [];
|
|
||||||
}
|
|
||||||
acc[singleKey].push(album);
|
|
||||||
return acc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Priority 5: Broadcast (if has album type)
|
|
||||||
const hasBroadcastType = album.releaseTypes?.some(
|
|
||||||
(type) => type.toLowerCase() === 'broadcast',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (hasBroadcastType) {
|
|
||||||
const broadcastKey = 'broadcast';
|
|
||||||
if (!acc[broadcastKey]) {
|
|
||||||
acc[broadcastKey] = [];
|
|
||||||
}
|
|
||||||
acc[broadcastKey].push(album);
|
|
||||||
return acc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Priority 6: Other
|
|
||||||
const hasOtherType = album.releaseTypes?.some((type) => type.toLowerCase() === 'other');
|
|
||||||
if (hasOtherType) {
|
|
||||||
const otherKey = 'other';
|
|
||||||
if (!acc[otherKey]) {
|
|
||||||
acc[otherKey] = [];
|
|
||||||
}
|
|
||||||
acc[otherKey].push(album);
|
|
||||||
return acc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Priority 7: Album (falls back all unknown release types to album)
|
|
||||||
const albumKey = 'album';
|
|
||||||
if (!acc[albumKey]) {
|
|
||||||
acc[albumKey] = [];
|
|
||||||
}
|
|
||||||
acc[albumKey].push(album);
|
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{} as Record<string, Album[]>,
|
{} as Record<string, Album[]>,
|
||||||
|
|||||||
Reference in New Issue
Block a user