fix search/filter bugs in game and TV libraries
- Game series: filter now checks child games for both search and tag matches instead of always passing series through - TV episodes: tag selector no longer closes after picking a tag - TV episodes: filter panel now filters episodes within a season view - TV series list: series now appear when any of their episodes match the active tag filter (via new /api/tv/series-episode-tags endpoint backed by media_items) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -74,10 +74,21 @@ export default function GamesView({ libraryId }: Props) {
|
||||
: items
|
||||
|
||||
const filtered = visibleItems.filter((item) => {
|
||||
if ('games' in item) {
|
||||
const searchMatch = !search ||
|
||||
item.title.toLowerCase().includes(search.toLowerCase()) ||
|
||||
item.games.some((g) => g.title.toLowerCase().includes(search.toLowerCase()))
|
||||
if (!searchMatch) return false
|
||||
if (selectedTagIds.size > 0) {
|
||||
return item.games.some((g) => {
|
||||
const gameTags = assignments[`${libraryId}:${g.id}`] ?? []
|
||||
return [...selectedTagIds].every((id) => gameTags.includes(id))
|
||||
})
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (search && !item.title.toLowerCase().includes(search.toLowerCase())) return false
|
||||
if (selectedTagIds.size > 0) {
|
||||
// Tag filtering only applies to games (series don't have tags directly)
|
||||
if ('games' in item) return true
|
||||
const gameTags = assignments[`${libraryId}:${item.id}`] ?? []
|
||||
if (![...selectedTagIds].every((id) => gameTags.includes(id))) return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user