mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 13:40:24 +02:00
properly handle disableArtistFilter and disableGenreFilter props for all list filters
This commit is contained in:
@@ -3,7 +3,6 @@ import { useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { getItemImageUrl } from '/@/renderer/components/item-image/item-image';
|
||||
import { useListContext } from '/@/renderer/context/list-context';
|
||||
import { artistsQueries } from '/@/renderer/features/artists/api/artists-api';
|
||||
import { useGenreList } from '/@/renderer/features/genres/api/genres-api';
|
||||
import {
|
||||
@@ -27,19 +26,19 @@ import { AlbumArtistListSort, LibraryItem, SortOrder } from '/@/shared/types/dom
|
||||
|
||||
interface JellyfinSongFiltersProps {
|
||||
disableArtistFilter?: boolean;
|
||||
disableGenreFilter?: boolean;
|
||||
}
|
||||
|
||||
export const JellyfinSongFilters = ({ disableArtistFilter }: JellyfinSongFiltersProps) => {
|
||||
export const JellyfinSongFilters = ({
|
||||
disableArtistFilter,
|
||||
disableGenreFilter,
|
||||
}: JellyfinSongFiltersProps) => {
|
||||
const server = useCurrentServer();
|
||||
const serverId = server.id;
|
||||
const { t } = useTranslation();
|
||||
const { query, setArtistIds, setCustom, setFavorite, setMaxYear, setMinYear } =
|
||||
useSongListFilters();
|
||||
|
||||
const { customFilters } = useListContext();
|
||||
|
||||
const isGenrePage = customFilters?.genreIds !== undefined;
|
||||
|
||||
// Despite the fact that getTags returns genres, it only returns genre names.
|
||||
// We prefer using IDs, hence the double query
|
||||
const genreListQuery = useGenreList();
|
||||
@@ -280,7 +279,7 @@ export const JellyfinSongFilters = ({ disableArtistFilter }: JellyfinSongFilters
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{!isGenrePage && (
|
||||
{!disableGenreFilter && (
|
||||
<>
|
||||
<Divider my="md" />
|
||||
<VirtualMultiSelect
|
||||
|
||||
@@ -3,7 +3,6 @@ import { useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { getItemImageUrl } from '/@/renderer/components/item-image/item-image';
|
||||
import { useListContext } from '/@/renderer/context/list-context';
|
||||
import { artistsQueries } from '/@/renderer/features/artists/api/artists-api';
|
||||
import { useGenreList } from '/@/renderer/features/genres/api/genres-api';
|
||||
import {
|
||||
@@ -24,17 +23,21 @@ import { Text } from '/@/shared/components/text/text';
|
||||
import { useDebouncedCallback } from '/@/shared/hooks/use-debounced-callback';
|
||||
import { AlbumArtistListSort, LibraryItem, SortOrder } from '/@/shared/types/domain-types';
|
||||
|
||||
export const NavidromeSongFilters = () => {
|
||||
interface NavidromeSongFiltersProps {
|
||||
disableArtistFilter?: boolean;
|
||||
disableGenreFilter?: boolean;
|
||||
}
|
||||
|
||||
export const NavidromeSongFilters = ({
|
||||
disableArtistFilter,
|
||||
disableGenreFilter,
|
||||
}: NavidromeSongFiltersProps) => {
|
||||
const { t } = useTranslation();
|
||||
const server = useCurrentServer();
|
||||
const serverId = server.id;
|
||||
const { query, setArtistIds, setCustom, setFavorite, setGenreId, setMaxYear, setMinYear } =
|
||||
useSongListFilters();
|
||||
|
||||
const { customFilters } = useListContext();
|
||||
|
||||
const isGenrePage = customFilters?.genreIds !== undefined;
|
||||
|
||||
const genreListQuery = useGenreList();
|
||||
|
||||
const genreList = useMemo(() => {
|
||||
@@ -257,18 +260,22 @@ export const NavidromeSongFilters = () => {
|
||||
w="100%"
|
||||
/>
|
||||
</Stack>
|
||||
<Divider my="md" />
|
||||
<VirtualMultiSelect
|
||||
displayCountType="song"
|
||||
height={300}
|
||||
label={artistFilterLabel}
|
||||
onChange={handleArtistChange}
|
||||
options={selectableAlbumArtists}
|
||||
RowComponent={ArtistMultiSelectRow}
|
||||
singleSelect={artistSelectMode === 'single'}
|
||||
value={selectedArtistIds}
|
||||
/>
|
||||
{!isGenrePage && (
|
||||
{!disableArtistFilter && (
|
||||
<>
|
||||
<Divider my="md" />
|
||||
<VirtualMultiSelect
|
||||
displayCountType="song"
|
||||
height={300}
|
||||
label={artistFilterLabel}
|
||||
onChange={handleArtistChange}
|
||||
options={selectableAlbumArtists}
|
||||
RowComponent={ArtistMultiSelectRow}
|
||||
singleSelect={artistSelectMode === 'single'}
|
||||
value={selectedArtistIds}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{!disableGenreFilter && (
|
||||
<VirtualMultiSelect
|
||||
displayCountType="song"
|
||||
height={220}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { ChangeEvent, useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { getItemImageUrl } from '/@/renderer/components/item-image/item-image';
|
||||
import { useListContext } from '/@/renderer/context/list-context';
|
||||
import { artistsQueries } from '/@/renderer/features/artists/api/artists-api';
|
||||
import { useGenreList } from '/@/renderer/features/genres/api/genres-api';
|
||||
import {
|
||||
@@ -20,15 +19,19 @@ import { Switch } from '/@/shared/components/switch/switch';
|
||||
import { Text } from '/@/shared/components/text/text';
|
||||
import { AlbumArtistListSort, LibraryItem, SortOrder } from '/@/shared/types/domain-types';
|
||||
|
||||
export const SubsonicSongFilters = () => {
|
||||
interface SubsonicSongFiltersProps {
|
||||
disableArtistFilter?: boolean;
|
||||
disableGenreFilter?: boolean;
|
||||
}
|
||||
|
||||
export const SubsonicSongFilters = ({
|
||||
disableArtistFilter,
|
||||
disableGenreFilter,
|
||||
}: SubsonicSongFiltersProps) => {
|
||||
const { t } = useTranslation();
|
||||
const serverId = useCurrentServerId();
|
||||
const { query, setArtistIds, setFavorite, setGenreId } = useSongListFilters();
|
||||
|
||||
const { customFilters } = useListContext();
|
||||
|
||||
const isGenrePage = customFilters?.genreIds !== undefined;
|
||||
|
||||
const genreListQuery = useGenreList();
|
||||
|
||||
const genreList = useMemo(() => {
|
||||
@@ -149,19 +152,23 @@ export const SubsonicSongFilters = () => {
|
||||
/>
|
||||
</Group>
|
||||
))}
|
||||
<Divider my="md" />
|
||||
<VirtualMultiSelect
|
||||
disabled={isArtistDisabled}
|
||||
displayCountType="song"
|
||||
height={300}
|
||||
label={artistFilterLabel}
|
||||
onChange={handleArtistFilter}
|
||||
options={selectableAlbumArtists}
|
||||
RowComponent={ArtistMultiSelectRow}
|
||||
singleSelect={true}
|
||||
value={selectedArtistIds}
|
||||
/>
|
||||
{!isGenrePage && (
|
||||
{!disableArtistFilter && (
|
||||
<>
|
||||
<Divider my="md" />
|
||||
<VirtualMultiSelect
|
||||
disabled={isArtistDisabled}
|
||||
displayCountType="song"
|
||||
height={300}
|
||||
label={artistFilterLabel}
|
||||
onChange={handleArtistFilter}
|
||||
options={selectableAlbumArtists}
|
||||
RowComponent={ArtistMultiSelectRow}
|
||||
singleSelect={true}
|
||||
value={selectedArtistIds}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{!disableGenreFilter && (
|
||||
<>
|
||||
<Divider my="md" />
|
||||
<VirtualMultiSelect
|
||||
|
||||
Reference in New Issue
Block a user