mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-17 00:44:23 +02:00
add proper labels to ND tag filters
This commit is contained in:
@@ -13,6 +13,7 @@ import { useGenreList } from '/@/renderer/features/genres/api/genres-api';
|
|||||||
import { sharedQueries } from '/@/renderer/features/shared/api/shared-api';
|
import { sharedQueries } from '/@/renderer/features/shared/api/shared-api';
|
||||||
import { useCurrentServer, useCurrentServerId } from '/@/renderer/store';
|
import { useCurrentServer, useCurrentServerId } from '/@/renderer/store';
|
||||||
import { titleCase } from '/@/renderer/utils';
|
import { titleCase } from '/@/renderer/utils';
|
||||||
|
import { NDSongQueryFieldsLabelMap } from '/@/shared/api/navidrome/navidrome-types';
|
||||||
import { Divider } from '/@/shared/components/divider/divider';
|
import { Divider } from '/@/shared/components/divider/divider';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { NumberInput } from '/@/shared/components/number-input/number-input';
|
import { NumberInput } from '/@/shared/components/number-input/number-input';
|
||||||
@@ -269,7 +270,7 @@ const TagFilters = () => {
|
|||||||
for (const tag of tagsQuery.data?.enumTags || []) {
|
for (const tag of tagsQuery.data?.enumTags || []) {
|
||||||
if (!tagsQuery.data?.excluded.album.includes(tag.name)) {
|
if (!tagsQuery.data?.excluded.album.includes(tag.name)) {
|
||||||
results.push({
|
results.push({
|
||||||
label: titleCase(tag.name),
|
label: NDSongQueryFieldsLabelMap[tag.name] ?? titleCase(tag.name),
|
||||||
options: tag.options,
|
options: tag.options,
|
||||||
value: tag.name,
|
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 { useSongListFilters } from '/@/renderer/features/songs/hooks/use-song-list-filters';
|
||||||
import { useCurrentServerId } from '/@/renderer/store';
|
import { useCurrentServerId } from '/@/renderer/store';
|
||||||
import { titleCase } from '/@/renderer/utils';
|
import { titleCase } from '/@/renderer/utils';
|
||||||
|
import { NDSongQueryFieldsLabelMap } from '/@/shared/api/navidrome/navidrome-types';
|
||||||
import { Divider } from '/@/shared/components/divider/divider';
|
import { Divider } from '/@/shared/components/divider/divider';
|
||||||
import { NumberInput } from '/@/shared/components/number-input/number-input';
|
import { NumberInput } from '/@/shared/components/number-input/number-input';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
@@ -171,7 +172,7 @@ const TagFilters = () => {
|
|||||||
for (const tag of tagsQuery.data?.enumTags || []) {
|
for (const tag of tagsQuery.data?.enumTags || []) {
|
||||||
if (!tagsQuery.data?.excluded.song.includes(tag.name)) {
|
if (!tagsQuery.data?.excluded.song.includes(tag.name)) {
|
||||||
results.push({
|
results.push({
|
||||||
label: titleCase(tag.name),
|
label: NDSongQueryFieldsLabelMap[tag.name] ?? titleCase(tag.name),
|
||||||
options: tag.options,
|
options: tag.options,
|
||||||
value: tag.name,
|
value: tag.name,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -180,6 +180,14 @@ export const NDSongQueryFields = [
|
|||||||
{ label: 'Year', type: 'number', value: 'year' },
|
{ 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 = [
|
export const NDSongQueryPlaylistOperators = [
|
||||||
{
|
{
|
||||||
label: i18n.t('filterOperator.inPlaylist', { postProcess: 'titleCase' }),
|
label: i18n.t('filterOperator.inPlaylist', { postProcess: 'titleCase' }),
|
||||||
|
|||||||
Reference in New Issue
Block a user