Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Commit

Permalink
Fixed watch now btn streaming last episode
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivaBhattacharjee committed Jul 15, 2023
1 parent 24d36b6 commit 5832103
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ a {

.react-loading-skeleton {
display: block;
animation: pulse 1.5s ease-in-out 0.5s infinite;
animation: pulse 1.8s ease-in-out 0.5s infinite;
transform: translateZ(0);
background: linear-gradient(-90deg, #000000 0%, #444 50%, #444 100%);
background: linear-gradient(-90deg, #000000 0%, #646161 50%, #646161 50%);
background-size: 400% 400%;
}

Expand All @@ -94,7 +94,7 @@ a {
background-position: 0% 0%;
}
100% {
background-position: -100% 0%;
background-position: -100% 90%;
}
}

10 changes: 9 additions & 1 deletion src/Pages/Details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ export default function Details(props) {
const response = await api.json()
const responseArray = [response];
setDetail(responseArray);
const [firstEpisode] = response.episodes;
const firstEpisode = response.episodes.reduce(
(smallestEpisode, currentEpisode) => {
if (currentEpisode.number < smallestEpisode.number) {
return currentEpisode;
} else {
return smallestEpisode;
}
}
);
if (firstEpisode) {
setWatch(firstEpisode.id);
} else {
Expand Down

0 comments on commit 5832103

Please sign in to comment.