redesign artist page (#416) (#447)

This commit is contained in:
jeffvli
2025-12-26 21:13:04 -08:00
parent 06e757d3b2
commit 796e511626
11 changed files with 565 additions and 216 deletions
+40 -1
View File
@@ -1,4 +1,4 @@
import { TFunction } from 'react-i18next';
import { TFunction } from 'i18next';
import { titleCase } from '/@/renderer/utils/title-case';
@@ -55,3 +55,42 @@ export const normalizeReleaseTypes = (types: string[], t: TFunction) => {
return primary.concat(secondary, unknown);
};
export const normalizeToPrimaryReleaseTypes = (types: string[], t: TFunction) => {
const primary: string[] = [];
for (const type of types) {
const lower = type.toLocaleLowerCase();
if (lower in PRIMARY_MAPPING) {
primary.push(
t(`releaseType.primary.${PRIMARY_MAPPING[lower]}`, { postProcess: 'sentenceCase' }),
);
}
}
// If no primary types found, use "other" category
if (primary.length === 0) {
primary.push(
t(`releaseType.primary.${PRIMARY_MAPPING.other}`, { postProcess: 'sentenceCase' }),
);
}
return primary;
};
export const normalizeToSecondaryReleaseTypes = (types: string[], t: TFunction) => {
const secondary: string[] = [];
for (const type of types) {
const lower = type.toLocaleLowerCase();
if (lower in SECONDARY_MAPPING) {
secondary.push(
t(`releaseType.secondary.${SECONDARY_MAPPING[lower]}`, {
postProcess: 'sentenceCase',
}),
);
}
}
secondary.sort();
return secondary;
};