diff --git a/src/routes/Player/SideDrawer/SideDrawer.tsx b/src/routes/Player/SideDrawer/SideDrawer.tsx index cb94e24e5..365ba87ae 100644 --- a/src/routes/Player/SideDrawer/SideDrawer.tsx +++ b/src/routes/Player/SideDrawer/SideDrawer.tsx @@ -1,11 +1,11 @@ // Copyright (C) 2017-2024 Smart code 203358507 -import React, { useMemo, useCallback, useState, forwardRef, memo } from 'react'; +import React, { useMemo, useCallback, useState, forwardRef, memo, useRef } from 'react'; import classNames from 'classnames'; import Icon from '@stremio/stremio-icons/react'; import { useServices } from 'stremio/services'; import { CONSTANTS } from 'stremio/common'; -import { MetaPreview, Video } from 'stremio/components'; +import { MetaPreview, Video, Button } from 'stremio/components'; import SeasonsBar from 'stremio/routes/MetaDetails/VideosList/SeasonsBar'; import styles from './SideDrawer.less'; @@ -13,6 +13,7 @@ type Props = { className?: string; seriesInfo: SeriesInfo; metaItem: MetaItem; + currentlyPlayingVideoID: string; closeSideDrawer: () => void; }; @@ -75,6 +76,14 @@ const SideDrawer = memo(forwardRef(({ seriesInfo, classNa event.stopPropagation(); }; + const currentlyPlayingVideoRef = useRef(null); + + const jumpToCurrentlyPlaying = () => { + const { current } = currentlyPlayingVideoRef; + + if (current) current.scrollIntoView({ behavior: 'smooth', block: 'center' }); + }; + return (
@@ -102,25 +111,28 @@ const SideDrawer = memo(forwardRef(({ seriesInfo, classNa onSelect={seasonOnSelect} />
+ {videos.map((video, index) => ( -