mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-01-11 22:40:31 +00:00
Merge pull request #854 from Stremio/feat/meta-details-select-appropriate-season
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
Details: auto select last watched season
This commit is contained in:
commit
23819cc133
1 changed files with 9 additions and 3 deletions
|
|
@ -36,17 +36,23 @@ const VideosList = ({ className, metaItem, libraryItem, season, seasonOnSelect,
|
|||
return season;
|
||||
}
|
||||
|
||||
const video = videos?.find((video) => video.id === libraryItem?.state.video_id);
|
||||
|
||||
if (video && video.season && seasons.includes(video.season)) {
|
||||
return video.season;
|
||||
}
|
||||
|
||||
const nonSpecialSeasons = seasons.filter((season) => season !== 0);
|
||||
if (nonSpecialSeasons.length > 0) {
|
||||
return nonSpecialSeasons[nonSpecialSeasons.length - 1];
|
||||
return nonSpecialSeasons[0];
|
||||
}
|
||||
|
||||
if (seasons.length > 0) {
|
||||
return seasons[seasons.length - 1];
|
||||
return seasons[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}, [seasons, season]);
|
||||
}, [seasons, season, videos, libraryItem]);
|
||||
const videosForSeason = React.useMemo(() => {
|
||||
return videos
|
||||
.filter((video) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue