mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
videos ordered by season than by episode
This commit is contained in:
parent
3b7e68dc7f
commit
e9850ad498
1 changed files with 9 additions and 4 deletions
|
|
@ -10,7 +10,8 @@ const reducer = (state, action) => {
|
|||
!isNaN(season) &&
|
||||
typeof season === 'number' &&
|
||||
seasons.indexOf(season) === index;
|
||||
});
|
||||
})
|
||||
.sort((a, b) => a - b);
|
||||
const selectedSeason = seasons.includes(state.selectedSeason) ?
|
||||
state.selectedSeason
|
||||
:
|
||||
|
|
@ -68,9 +69,13 @@ const useSelectableSeasons = (videos) => {
|
|||
});
|
||||
}, []);
|
||||
const videosForSeason = React.useMemo(() => {
|
||||
return state.videos.filter((video) => {
|
||||
return state.selectedSeason === null || video.season === state.selectedSeason;
|
||||
});
|
||||
return state.videos
|
||||
.filter((video) => {
|
||||
return state.selectedSeason === null || video.season === state.selectedSeason;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return a.episode - b.episode;
|
||||
});
|
||||
}, [state.videos, state.selectedSeason]);
|
||||
React.useEffect(() => {
|
||||
dispatch({
|
||||
|
|
|
|||
Loading…
Reference in a new issue