Skip to content

Commit

Permalink
quick fixed reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivamJoker committed Sep 9, 2019
1 parent 9af2531 commit 7d19d8c
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/components/RelatedVideos.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ const RelatedVideos = ({
setIsRepeatOn,
isRepeatOn
}) => {

const { setCurrentVideoSnippet } = useContext(GlobalContext);

const [{}, dispatch] = useContext(GlobalContext);
const setCurrentVideoSnippet = data => {
dispatch({ type: "setCurrentVideoSnippet", snippet: data });
};
const handleShuffleClick = () => {
setRelatedVideos(shuffle(relatedVideos));
};
Expand All @@ -67,12 +68,8 @@ const RelatedVideos = ({
id: video.id.videoId,
title: video.snippet.title,
channelTitle: video.snippet.channelTitle,
maxThumbnail: `https://img.youtube.com/vi/${
video.id.videoId
}/maxresdefault.jpg`,
sdThumbnail: `https://img.youtube.com/vi/${
video.id.videoId
}/sddefault.jpg`
maxThumbnail: `https://img.youtube.com/vi/${video.id.videoId}/maxresdefault.jpg`,
sdThumbnail: `https://img.youtube.com/vi/${video.id.videoId}/sddefault.jpg`
// this is the url of the max resolution of thumbnail
});
setPlaylist();
Expand Down Expand Up @@ -102,7 +99,7 @@ const RelatedVideos = ({
);
});
} else {
return <LinearProgress/>;
return <LinearProgress />;
}

const returnPlaylistExpandBtn = () => {
Expand All @@ -126,7 +123,11 @@ const RelatedVideos = ({
<Typography variant="h6">Coming Next</Typography>
<Shuffle onClick={handleShuffleClick} />
{/* this will show the repeat button and repeat the song */}
{isRepeatOn ? <RepeatOne onClick={setIsRepeatOn}/> : <Repeat onClick={setIsRepeatOn}/>}
{isRepeatOn ? (
<RepeatOne onClick={setIsRepeatOn} />
) : (
<Repeat onClick={setIsRepeatOn} />
)}
{returnPlaylistExpandBtn()}
</Grid>
<List dense={true}>{renderResult}</List>
Expand Down

0 comments on commit 7d19d8c

Please sign in to comment.