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:
Garret Patti
2026-04-06 14:23:34 -04:00
parent 957d884903
commit 5d27ba351b
4 changed files with 92 additions and 8 deletions

View File

@@ -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
}