Skip to content

Commit

Permalink
Update videos UI to automatically open first or current video (#57928)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackjackkent authored Nov 10, 2021
1 parent 4c43aea commit 90100cf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/components/videos-ui/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ const VideosUi = ( { shouldDisplayTopLinks = false, onBackClick = () => {} } ) =
// @TODO add logic to pick the first unseen video
const initialVideoId = 'find-theme';
setCurrentVideoKey( initialVideoId );
setSelectedVideoIndex( Object.keys( course.videos ).indexOf( initialVideoId ) );
}
}, [ currentVideoKey, course ] );

useEffect( () => {
if ( currentVideoKey && course ) {
setCurrentVideo( course.videos[ currentVideoKey ] );
setSelectedVideoIndex( Object.keys( course.videos ).indexOf( currentVideoKey ) );
}
}, [ currentVideoKey, course ] );

Expand Down

0 comments on commit 90100cf

Please sign in to comment.