diff --git a/src/components/tv/TvView.tsx b/src/components/tv/TvView.tsx index 241d64b..36ccbfe 100644 --- a/src/components/tv/TvView.tsx +++ b/src/components/tv/TvView.tsx @@ -36,6 +36,7 @@ export default function TvView({ libraryId }: Props) { () => typeof window !== 'undefined' && window.innerWidth >= 768 ) const [selectedSeriesIndex, setSelectedSeriesIndex] = useState(null) + const [selectedSeasonIndex, setSelectedSeasonIndex] = useState(null) const [tagPanel, setTagPanel] = useState<{ itemKey: string; title: string } | null>(null) const [menuOpen, setMenuOpen] = useState(false) const [confirming, setConfirming] = useState(false) @@ -106,16 +107,12 @@ export default function TvView({ libraryId }: Props) { .then((data: TvSeason[]) => { setSeasons(data) setLoading(false) - // Flat series: a single synthetic season (id='.') means episodes live - // directly in the series folder — skip the seasons screen automatically. - if (data.length === 1 && data[0].id === '.') { - openSeason(data[0]) - } }) .catch(() => { setError('Failed to load seasons'); setLoading(false) }) } - const openSeason = (season: TvSeason) => { + const openSeason = (season: TvSeason, index?: number) => { + setSelectedSeasonIndex(index ?? seasons.indexOf(season)) setSelectedSeason(season) setView('episodes') if (showTagPanel) { @@ -148,6 +145,7 @@ export default function TvView({ libraryId }: Props) { setSelectedSeries(null) setSelectedSeason(null) setSelectedSeriesIndex(null) + setSelectedSeasonIndex(null) setMenuOpen(false) setConfirming(false) setShowTagPanel(false) @@ -158,6 +156,7 @@ export default function TvView({ libraryId }: Props) { const goToSeasons = () => { setView('seasons') setSelectedSeason(null) + setSelectedSeasonIndex(null) setConfirming(false) if (showTagPanel && selectedSeries?.item_key) { setTagPanelItemKey(selectedSeries.item_key) @@ -637,28 +636,8 @@ export default function TvView({ libraryId }: Props) { {selectedSeries.title} )}
-
- {selectedSeriesIndex !== null && selectedSeriesIndex > 0 && ( - - )} +

{selectedSeries.title}

- {selectedSeriesIndex !== null && selectedSeriesIndex < filteredSeries.length - 1 && ( - - )} {/* Kebab menu */}
+ + {/* Prev — series in seasons view, season in episodes view */} + {(view === 'seasons' + ? selectedSeriesIndex !== null && selectedSeriesIndex > 0 + : selectedSeasonIndex !== null && selectedSeasonIndex > 0) && ( + + )} + + {/* Next — series in seasons view, season in episodes view */} + {(view === 'seasons' + ? selectedSeriesIndex !== null && selectedSeriesIndex < filteredSeries.length - 1 + : selectedSeasonIndex !== null && selectedSeasonIndex < seasons.length - 1) && ( + + )}
{/* Right tag panel */}