small changes

This commit is contained in:
James Hawkins 2021-08-06 18:13:56 +01:00
parent 7a85f05c47
commit a870b91ff3

View File

@ -64,8 +64,6 @@ export function SearchView() {
realUrl = url;
}
console.log(year)
setProgress(maxSteps);
setStreamUrl(realUrl);
setStreamData({
@ -135,11 +133,13 @@ export function SearchView() {
React.useEffect(() => {
const progressData = JSON.parse(localStorage.getItem('video-progress') || "{}")
let newContinueWatching = []
Object.keys(progressData).forEach(source => {
Object.keys(progressData).forEach((source) => {
const all = [
...Object.entries(progressData[source]?.show ?? {}),
...Object.entries(progressData[source]?.movie ?? {})
]
];
for (const [slug, data] of all) {
for (let subselection of Object.values(data)) {
let entry = {
@ -149,17 +149,20 @@ export function SearchView() {
percentageDone: Math.floor((subselection.currentlyAt / subselection.totalDuration) * 100),
source
}
if (entry.percentageDone < 90) {
newContinueWatching.push(entry)
}
}
}
newContinueWatching = newContinueWatching.sort((a, b) => {
return b.data.updatedAt - a.data.updatedAt
})
});
setContinueWatching(newContinueWatching)
})
}, []);
});
if (!type || (type !== 'movie' && type !== 'show')) {
return <Redirect to="/movie" />
@ -168,7 +171,7 @@ export function SearchView() {
return (
<div className="cardView">
<Helmet>
<title>{type === 'movie' ? 'Movies' : 'TV Shows'} | movie-web</title>
<title>{type === 'movie' ? 'movies' : 'shows'} | movie-web</title>
</Helmet>
{/* Nav */}