mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
fix removed filter functions
This commit is contained in:
@@ -52,7 +52,6 @@ export const SongListHeaderFilters = ({ toggleGenreTarget }: { toggleGenreTarget
|
|||||||
const query = songFilters.query;
|
const query = songFilters.query;
|
||||||
return Boolean(
|
return Boolean(
|
||||||
isFilterValueSet(query[FILTER_KEYS.SONG._CUSTOM]) ||
|
isFilterValueSet(query[FILTER_KEYS.SONG._CUSTOM]) ||
|
||||||
isFilterValueSet(query[FILTER_KEYS.SONG.ALBUM_IDS]) ||
|
|
||||||
isFilterValueSet(query[FILTER_KEYS.SONG.ARTIST_IDS]) ||
|
isFilterValueSet(query[FILTER_KEYS.SONG.ARTIST_IDS]) ||
|
||||||
query[FILTER_KEYS.SONG.FAVORITE] !== undefined ||
|
query[FILTER_KEYS.SONG.FAVORITE] !== undefined ||
|
||||||
isFilterValueSet(query[FILTER_KEYS.SONG.GENRE_ID]) ||
|
isFilterValueSet(query[FILTER_KEYS.SONG.GENRE_ID]) ||
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ export const useSongListFilters = (listKey?: ItemListKey) => {
|
|||||||
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
const albumIds = useMemo(
|
|
||||||
() => parseArrayParam(searchParams, FILTER_KEYS.SONG.ALBUM_IDS),
|
|
||||||
[searchParams],
|
|
||||||
);
|
|
||||||
|
|
||||||
const genreId = useMemo(
|
const genreId = useMemo(
|
||||||
() => parseArrayParam(searchParams, FILTER_KEYS.SONG.GENRE_ID),
|
() => parseArrayParam(searchParams, FILTER_KEYS.SONG.GENRE_ID),
|
||||||
[searchParams],
|
[searchParams],
|
||||||
@@ -63,15 +58,6 @@ export const useSongListFilters = (listKey?: ItemListKey) => {
|
|||||||
[searchParams],
|
[searchParams],
|
||||||
);
|
);
|
||||||
|
|
||||||
const setAlbumIds = useCallback(
|
|
||||||
(value: null | string[]) => {
|
|
||||||
setSearchParams((prev) => setSearchParam(prev, FILTER_KEYS.SONG.ALBUM_IDS, value), {
|
|
||||||
replace: true,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
[setSearchParams],
|
|
||||||
);
|
|
||||||
|
|
||||||
const setGenreId = useCallback(
|
const setGenreId = useCallback(
|
||||||
(value: null | string[]) => {
|
(value: null | string[]) => {
|
||||||
setSearchParams((prev) => setSearchParam(prev, FILTER_KEYS.SONG.GENRE_ID, value), {
|
setSearchParams((prev) => setSearchParam(prev, FILTER_KEYS.SONG.GENRE_ID, value), {
|
||||||
@@ -153,7 +139,6 @@ export const useSongListFilters = (listKey?: ItemListKey) => {
|
|||||||
{
|
{
|
||||||
[FILTER_KEYS.SHARED.SEARCH_TERM]: null,
|
[FILTER_KEYS.SHARED.SEARCH_TERM]: null,
|
||||||
[FILTER_KEYS.SONG._CUSTOM]: null,
|
[FILTER_KEYS.SONG._CUSTOM]: null,
|
||||||
[FILTER_KEYS.SONG.ALBUM_IDS]: null,
|
|
||||||
[FILTER_KEYS.SONG.ARTIST_IDS]: null,
|
[FILTER_KEYS.SONG.ARTIST_IDS]: null,
|
||||||
[FILTER_KEYS.SONG.FAVORITE]: null,
|
[FILTER_KEYS.SONG.FAVORITE]: null,
|
||||||
[FILTER_KEYS.SONG.GENRE_ID]: null,
|
[FILTER_KEYS.SONG.GENRE_ID]: null,
|
||||||
@@ -172,31 +157,18 @@ export const useSongListFilters = (listKey?: ItemListKey) => {
|
|||||||
[FILTER_KEYS.SHARED.SORT_BY]: sortBy ?? undefined,
|
[FILTER_KEYS.SHARED.SORT_BY]: sortBy ?? undefined,
|
||||||
[FILTER_KEYS.SHARED.SORT_ORDER]: sortOrder ?? undefined,
|
[FILTER_KEYS.SHARED.SORT_ORDER]: sortOrder ?? undefined,
|
||||||
[FILTER_KEYS.SONG._CUSTOM]: custom ?? undefined,
|
[FILTER_KEYS.SONG._CUSTOM]: custom ?? undefined,
|
||||||
[FILTER_KEYS.SONG.ALBUM_IDS]: albumIds ?? undefined,
|
|
||||||
[FILTER_KEYS.SONG.ARTIST_IDS]: artistIds ?? undefined,
|
[FILTER_KEYS.SONG.ARTIST_IDS]: artistIds ?? undefined,
|
||||||
[FILTER_KEYS.SONG.FAVORITE]: favorite ?? undefined,
|
[FILTER_KEYS.SONG.FAVORITE]: favorite ?? undefined,
|
||||||
[FILTER_KEYS.SONG.GENRE_ID]: genreId ?? undefined,
|
[FILTER_KEYS.SONG.GENRE_ID]: genreId ?? undefined,
|
||||||
[FILTER_KEYS.SONG.MAX_YEAR]: maxYear ?? undefined,
|
[FILTER_KEYS.SONG.MAX_YEAR]: maxYear ?? undefined,
|
||||||
[FILTER_KEYS.SONG.MIN_YEAR]: minYear ?? undefined,
|
[FILTER_KEYS.SONG.MIN_YEAR]: minYear ?? undefined,
|
||||||
}),
|
}),
|
||||||
[
|
[searchTerm, sortBy, sortOrder, custom, artistIds, favorite, genreId, maxYear, minYear],
|
||||||
searchTerm,
|
|
||||||
sortBy,
|
|
||||||
sortOrder,
|
|
||||||
custom,
|
|
||||||
albumIds,
|
|
||||||
artistIds,
|
|
||||||
favorite,
|
|
||||||
genreId,
|
|
||||||
maxYear,
|
|
||||||
minYear,
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
clear,
|
clear,
|
||||||
query,
|
query,
|
||||||
setAlbumIds,
|
|
||||||
setArtistIds,
|
setArtistIds,
|
||||||
setCustom,
|
setCustom,
|
||||||
setFavorite,
|
setFavorite,
|
||||||
|
|||||||
Reference in New Issue
Block a user