mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-24 08:32:10 +00:00
fix: scroll to top of videos list on season change
This commit is contained in:
parent
392a496617
commit
d41f887766
1 changed files with 9 additions and 1 deletions
|
|
@ -71,11 +71,19 @@ const VideosList = ({ className, metaItem, libraryItem, season, seasonOnSelect,
|
|||
return videosForSeason.every((video) => video.watched);
|
||||
}, [videosForSeason]);
|
||||
|
||||
const videosContainerRef = React.useRef(null);
|
||||
|
||||
const [search, setSearch] = React.useState('');
|
||||
const searchInputOnChange = React.useCallback((event) => {
|
||||
setSearch(event.currentTarget.value);
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (videosContainerRef.current) {
|
||||
videosContainerRef.current.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
}
|
||||
}, [selectedSeason]);
|
||||
|
||||
const onMarkVideoAsWatched = (video, watched) => {
|
||||
core.transport.dispatch({
|
||||
action: 'MetaDetails',
|
||||
|
|
@ -154,7 +162,7 @@ const VideosList = ({ className, metaItem, libraryItem, season, seasonOnSelect,
|
|||
value={search}
|
||||
onChange={searchInputOnChange}
|
||||
/>
|
||||
<div className={styles['videos-container']}>
|
||||
<div ref={videosContainerRef} className={styles['videos-container']}>
|
||||
{
|
||||
videosForSeason
|
||||
.filter((video) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue