From 35d8698ca050c2407b95ed3bf7040e3b225ea6d9 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sat, 27 Dec 2025 15:23:42 -0800 Subject: [PATCH] add broadcast and other release type groupings --- .../album-artist-detail-content.tsx | 61 ++++++++++++++++--- src/renderer/store/app.store.ts | 6 +- 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/src/renderer/features/artists/components/album-artist-detail-content.tsx b/src/renderer/features/artists/components/album-artist-detail-content.tsx index 727029fdc..e9499b15c 100644 --- a/src/renderer/features/artists/components/album-artist-detail-content.tsx +++ b/src/renderer/features/artists/components/album-artist-detail-content.tsx @@ -927,8 +927,10 @@ const groupAlbumsByReleaseType = ( } // Priority 4: Single (other non-album types) - const hasAlbumType = album.releaseTypes?.some((type) => type.toLowerCase() === 'album'); - if (!hasAlbumType) { + const hasSingleType = album.releaseTypes?.some( + (type) => type.toLowerCase() === 'single', + ); + if (hasSingleType) { const singleKey = 'single'; if (!acc[singleKey]) { acc[singleKey] = []; @@ -937,12 +939,37 @@ const groupAlbumsByReleaseType = ( return acc; } - // Priority 5: Album - const albumKey = 'album'; - if (!acc[albumKey]) { - acc[albumKey] = []; + // 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; } - 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; }, {} as Record, @@ -995,7 +1022,15 @@ const ArtistAlbums = () => { }, [filteredAndSortedAlbums, routeId, groupingType]); 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 index = priorityOrder.indexOf(releaseType); return index === -1 ? 999 : index; @@ -1015,6 +1050,11 @@ const ArtistAlbums = () => { postProcess: 'sentenceCase', }); break; + case 'broadcast': + displayName = t('releaseType.primary.broadcast', { + postProcess: 'sentenceCase', + }); + break; case 'compilation': displayName = t('releaseType.secondary.compilation', { postProcess: 'sentenceCase', @@ -1025,6 +1065,11 @@ const ArtistAlbums = () => { postProcess: 'sentenceCase', }); break; + case 'other': + displayName = t('releaseType.primary.other', { + postProcess: 'sentenceCase', + }); + break; case 'single': displayName = t('releaseType.primary.single', { postProcess: 'sentenceCase', diff --git a/src/renderer/store/app.store.ts b/src/renderer/store/app.store.ts index 6040e67fb..efa1538ad 100644 --- a/src/renderer/store/app.store.ts +++ b/src/renderer/store/app.store.ts @@ -68,7 +68,11 @@ export const useAppStore = createWithEqualityFn()( }, setAlbumArtistDetailSort: (sortBy, sortOrder) => { set((state) => { - state.albumArtistDetailSort = { ...state.albumArtistDetailSort, sortBy, sortOrder }; + state.albumArtistDetailSort = { + ...state.albumArtistDetailSort, + sortBy, + sortOrder, + }; }); }, setAppStore: (data) => {