add proper labels to ND tag filters

This commit is contained in:
jeffvli
2025-12-13 00:20:43 -08:00
parent a546a4d57b
commit eb100351a6
3 changed files with 12 additions and 2 deletions
@@ -13,6 +13,7 @@ import { useGenreList } from '/@/renderer/features/genres/api/genres-api';
import { sharedQueries } from '/@/renderer/features/shared/api/shared-api';
import { useCurrentServer, useCurrentServerId } from '/@/renderer/store';
import { titleCase } from '/@/renderer/utils';
import { NDSongQueryFieldsLabelMap } from '/@/shared/api/navidrome/navidrome-types';
import { Divider } from '/@/shared/components/divider/divider';
import { Group } from '/@/shared/components/group/group';
import { NumberInput } from '/@/shared/components/number-input/number-input';
@@ -269,7 +270,7 @@ const TagFilters = () => {
for (const tag of tagsQuery.data?.enumTags || []) {
if (!tagsQuery.data?.excluded.album.includes(tag.name)) {
results.push({
label: titleCase(tag.name),
label: NDSongQueryFieldsLabelMap[tag.name] ?? titleCase(tag.name),
options: tag.options,
value: tag.name,
});
@@ -12,6 +12,7 @@ import { sharedQueries } from '/@/renderer/features/shared/api/shared-api';
import { useSongListFilters } from '/@/renderer/features/songs/hooks/use-song-list-filters';
import { useCurrentServerId } from '/@/renderer/store';
import { titleCase } from '/@/renderer/utils';
import { NDSongQueryFieldsLabelMap } from '/@/shared/api/navidrome/navidrome-types';
import { Divider } from '/@/shared/components/divider/divider';
import { NumberInput } from '/@/shared/components/number-input/number-input';
import { Stack } from '/@/shared/components/stack/stack';
@@ -171,7 +172,7 @@ const TagFilters = () => {
for (const tag of tagsQuery.data?.enumTags || []) {
if (!tagsQuery.data?.excluded.song.includes(tag.name)) {
results.push({
label: titleCase(tag.name),
label: NDSongQueryFieldsLabelMap[tag.name] ?? titleCase(tag.name),
options: tag.options,
value: tag.name,
});
@@ -180,6 +180,14 @@ export const NDSongQueryFields = [
{ label: 'Year', type: 'number', value: 'year' },
];
export const NDSongQueryFieldsLabelMap: Record<string, string> = NDSongQueryFields.reduce(
(acc, field) => {
acc[field.value] = field.label;
return acc;
},
{} as Record<string, string>,
);
export const NDSongQueryPlaylistOperators = [
{
label: i18n.t('filterOperator.inPlaylist', { postProcess: 'titleCase' }),