mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-22 02:16:39 +02:00
fix: use compilation release type label on album details (#2236)
This commit is contained in:
@@ -105,7 +105,17 @@ const AlbumMetadataTags = ({ album }: AlbumMetadataTagsProps) => {
|
|||||||
const defaultTagItems = useMemo(() => {
|
const defaultTagItems = useMemo(() => {
|
||||||
if (!album) return [];
|
if (!album) return [];
|
||||||
|
|
||||||
const releaseTypes = normalizeReleaseTypes(album.releaseTypes ?? [], t).map((type) => ({
|
const releaseTypes = [...(album.releaseTypes ?? [])];
|
||||||
|
|
||||||
|
const hasCompilationReleaseType = releaseTypes.some(
|
||||||
|
(type) => type.toLowerCase() === 'compilation',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (album.isCompilation && !hasCompilationReleaseType) {
|
||||||
|
releaseTypes.push('compilation');
|
||||||
|
}
|
||||||
|
|
||||||
|
const releaseTypeItems = normalizeReleaseTypes(releaseTypes, t).map((type) => ({
|
||||||
id: type,
|
id: type,
|
||||||
value: titleCase(type),
|
value: titleCase(type),
|
||||||
}));
|
}));
|
||||||
@@ -124,24 +134,15 @@ const AlbumMetadataTags = ({ album }: AlbumMetadataTagsProps) => {
|
|||||||
|
|
||||||
const items: Array<{ id: string; value: ReactNode | string | undefined }> = [];
|
const items: Array<{ id: string; value: ReactNode | string | undefined }> = [];
|
||||||
|
|
||||||
items.push(
|
items.push(...releaseTypeItems, ...releaseCountries, ...releaseStatuses, {
|
||||||
...releaseTypes,
|
id: 'explicitStatus',
|
||||||
{
|
value:
|
||||||
id: 'isCompilation',
|
album.explicitStatus === ExplicitStatus.EXPLICIT
|
||||||
value: album?.isCompilation ? t('filter.isCompilation') : undefined,
|
? t('common.explicit')
|
||||||
},
|
: album.explicitStatus === ExplicitStatus.CLEAN
|
||||||
...releaseCountries,
|
? t('common.clean')
|
||||||
...releaseStatuses,
|
: undefined,
|
||||||
{
|
});
|
||||||
id: 'explicitStatus',
|
|
||||||
value:
|
|
||||||
album.explicitStatus === ExplicitStatus.EXPLICIT
|
|
||||||
? t('common.explicit')
|
|
||||||
: album.explicitStatus === ExplicitStatus.CLEAN
|
|
||||||
? t('common.clean')
|
|
||||||
: undefined,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return items.filter((item) => item.value);
|
return items.filter((item) => item.value);
|
||||||
}, [album, t]);
|
}, [album, t]);
|
||||||
|
|||||||
Reference in New Issue
Block a user