mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-16 16:34:24 +02:00
add broadcast and other release type groupings
This commit is contained in:
@@ -927,8 +927,10 @@ const groupAlbumsByReleaseType = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Priority 4: Single (other non-album types)
|
// Priority 4: Single (other non-album types)
|
||||||
const hasAlbumType = album.releaseTypes?.some((type) => type.toLowerCase() === 'album');
|
const hasSingleType = album.releaseTypes?.some(
|
||||||
if (!hasAlbumType) {
|
(type) => type.toLowerCase() === 'single',
|
||||||
|
);
|
||||||
|
if (hasSingleType) {
|
||||||
const singleKey = 'single';
|
const singleKey = 'single';
|
||||||
if (!acc[singleKey]) {
|
if (!acc[singleKey]) {
|
||||||
acc[singleKey] = [];
|
acc[singleKey] = [];
|
||||||
@@ -937,12 +939,37 @@ const groupAlbumsByReleaseType = (
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Priority 5: Album
|
// Priority 5: Broadcast (if has album type)
|
||||||
const albumKey = 'album';
|
const hasBroadcastType = album.releaseTypes?.some(
|
||||||
if (!acc[albumKey]) {
|
(type) => type.toLowerCase() === 'broadcast',
|
||||||
acc[albumKey] = [];
|
);
|
||||||
|
|
||||||
|
if (hasBroadcastType) {
|
||||||
|
const broadcastKey = 'broadcast';
|
||||||
|
if (!acc[broadcastKey]) {
|
||||||
|
acc[broadcastKey] = [];
|
||||||
|
}
|
||||||
|
acc[broadcastKey].push(album);
|
||||||
|
return acc;
|
||||||
}
|
}
|
||||||
acc[albumKey].push(album);
|
|
||||||
|
// Priority 6: Album
|
||||||
|
const hasAlbumType = album.releaseTypes?.some((type) => type.toLowerCase() === 'album');
|
||||||
|
if (hasAlbumType) {
|
||||||
|
const albumKey = 'album';
|
||||||
|
if (!acc[albumKey]) {
|
||||||
|
acc[albumKey] = [];
|
||||||
|
}
|
||||||
|
acc[albumKey].push(album);
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Priority 7: Other (catch all for unknown release types or specifically other release types)
|
||||||
|
const otherKey = 'other';
|
||||||
|
if (!acc[otherKey]) {
|
||||||
|
acc[otherKey] = [];
|
||||||
|
}
|
||||||
|
acc[otherKey].push(album);
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{} as Record<string, Album[]>,
|
{} as Record<string, Album[]>,
|
||||||
@@ -995,7 +1022,15 @@ const ArtistAlbums = () => {
|
|||||||
}, [filteredAndSortedAlbums, routeId, groupingType]);
|
}, [filteredAndSortedAlbums, routeId, groupingType]);
|
||||||
|
|
||||||
const releaseTypeEntries = useMemo(() => {
|
const releaseTypeEntries = useMemo(() => {
|
||||||
const priorityOrder = ['album', 'ep', 'single', 'compilation', 'appears-on'];
|
const priorityOrder = [
|
||||||
|
'album',
|
||||||
|
'ep',
|
||||||
|
'single',
|
||||||
|
'broadcast',
|
||||||
|
'other',
|
||||||
|
'compilation',
|
||||||
|
'appears-on',
|
||||||
|
];
|
||||||
const getPriority = (releaseType: string) => {
|
const getPriority = (releaseType: string) => {
|
||||||
const index = priorityOrder.indexOf(releaseType);
|
const index = priorityOrder.indexOf(releaseType);
|
||||||
return index === -1 ? 999 : index;
|
return index === -1 ? 999 : index;
|
||||||
@@ -1015,6 +1050,11 @@ const ArtistAlbums = () => {
|
|||||||
postProcess: 'sentenceCase',
|
postProcess: 'sentenceCase',
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 'broadcast':
|
||||||
|
displayName = t('releaseType.primary.broadcast', {
|
||||||
|
postProcess: 'sentenceCase',
|
||||||
|
});
|
||||||
|
break;
|
||||||
case 'compilation':
|
case 'compilation':
|
||||||
displayName = t('releaseType.secondary.compilation', {
|
displayName = t('releaseType.secondary.compilation', {
|
||||||
postProcess: 'sentenceCase',
|
postProcess: 'sentenceCase',
|
||||||
@@ -1025,6 +1065,11 @@ const ArtistAlbums = () => {
|
|||||||
postProcess: 'sentenceCase',
|
postProcess: 'sentenceCase',
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 'other':
|
||||||
|
displayName = t('releaseType.primary.other', {
|
||||||
|
postProcess: 'sentenceCase',
|
||||||
|
});
|
||||||
|
break;
|
||||||
case 'single':
|
case 'single':
|
||||||
displayName = t('releaseType.primary.single', {
|
displayName = t('releaseType.primary.single', {
|
||||||
postProcess: 'sentenceCase',
|
postProcess: 'sentenceCase',
|
||||||
|
|||||||
@@ -68,7 +68,11 @@ export const useAppStore = createWithEqualityFn<AppSlice>()(
|
|||||||
},
|
},
|
||||||
setAlbumArtistDetailSort: (sortBy, sortOrder) => {
|
setAlbumArtistDetailSort: (sortBy, sortOrder) => {
|
||||||
set((state) => {
|
set((state) => {
|
||||||
state.albumArtistDetailSort = { ...state.albumArtistDetailSort, sortBy, sortOrder };
|
state.albumArtistDetailSort = {
|
||||||
|
...state.albumArtistDetailSort,
|
||||||
|
sortBy,
|
||||||
|
sortOrder,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setAppStore: (data) => {
|
setAppStore: (data) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user