diff --git a/src/App.js b/src/App.js index fe7edea6..c3284bde 100644 --- a/src/App.js +++ b/src/App.js @@ -1,7 +1,7 @@ -import './index.css'; import { SearchView } from './views/Search'; import { MovieView } from './views/Movie'; -import { useMovie, MovieProvider} from './hooks/useMovie'; +import { useMovie, MovieProvider } from './hooks/useMovie'; +import './index.css'; function Router() { const { streamData } = useMovie(); diff --git a/src/components/DiscordBanner.css b/src/components/DiscordBanner.css deleted file mode 100644 index 6fa3fe5d..00000000 --- a/src/components/DiscordBanner.css +++ /dev/null @@ -1,16 +0,0 @@ -.discordBanner { - margin-top: 0.5rem; - border-inline-start: none; - font-size: 16px; - font-weight: normal; - letter-spacing: -.01em; - padding: .5rem 1rem .5rem .75rem; - border-radius: .25rem; - background-color: var(--button); - color: var(--button-text); -} - -.discordBanner a { - color: var(--button-text); - /* text-decoration: none; */ -} \ No newline at end of file diff --git a/src/components/DiscordBanner.js b/src/components/DiscordBanner.js deleted file mode 100644 index 2b952104..00000000 --- a/src/components/DiscordBanner.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import './DiscordBanner.css'; - -export function DiscordBanner() { - return ( -
- - Join our Discord server - -
- ) -} \ No newline at end of file diff --git a/src/components/EpisodeSelector.js b/src/components/EpisodeSelector.js index 1b65cc4e..a478873d 100644 --- a/src/components/EpisodeSelector.js +++ b/src/components/EpisodeSelector.js @@ -3,15 +3,16 @@ import { TypeSelector } from './TypeSelector'; import { NumberSelector } from './NumberSelector'; import './EpisodeSelector.css' -export function EpisodeSelector({ setSelectedSeason, setEpisode, seasons, selectedSeason, season, episodes, currentSeason, currentEpisode, source }) { +export function EpisodeSelector({ setSelectedSeason, selectedSeason, setEpisode, seasons, episodes, currentSeason, currentEpisode, streamData }) { const choices = episodes ? episodes.map(v => { let progressData = JSON.parse(localStorage.getItem('video-progress') || "{}") let currentlyAt = 0; let totalDuration = 0; - const progress = progressData?.[source]?.show?.slug?.[`${season}-${v}`] - if(progress) { + const progress = progressData?.[streamData.source]?.[streamData.type]?.[streamData.slug]?.[`${selectedSeason}-${v}`] + + if (progress) { currentlyAt = progress.currentlyAt totalDuration = progress.totalDuration } @@ -27,7 +28,7 @@ export function EpisodeSelector({ setSelectedSeason, setEpisode, seasons, select return (
- ({ value: v.toString(), label: `Season ${v}`}))} selected={selectedSeason}/>

+ ({ value: v.toString(), label: `Season ${v}`}))} />

setEpisode({episode: e, season: selectedSeason})} choices={choices} selected={(selectedSeason.toString() === currentSeason) ? currentEpisode : null} />
) diff --git a/src/components/MovieRow.css b/src/components/MovieRow.css index a32463b5..4ef12f41 100644 --- a/src/components/MovieRow.css +++ b/src/components/MovieRow.css @@ -24,6 +24,7 @@ margin-right: 0.5rem; } +.movieRow .left .seasonEpisodeSubtitle, .movieRow .left .year { color: var(--text-secondary); } diff --git a/src/components/MovieRow.js b/src/components/MovieRow.js index d8ae3162..a7a7adac 100644 --- a/src/components/MovieRow.js +++ b/src/components/MovieRow.js @@ -1,18 +1,20 @@ import React from 'react' import { Arrow } from './Arrow' -import './MovieRow.css' +// import { Cross } from './Crosss' import { PercentageOverlay } from './PercentageOverlay' +import './MovieRow.css' // title: string // onClick: () => void export function MovieRow(props) { - const progressData = JSON.parse(localStorage.getItem("video-progress") || "{}") let progress; let percentage = null; - if(props.type === "movie") { + + if (props.type === "movie") { progress = progressData?.[props.source]?.movie?.[props.slug]?.full - if(progress) { + + if (progress) { percentage = Math.floor((progress.currentlyAt / progress.totalDuration) * 100) } } @@ -20,14 +22,17 @@ export function MovieRow(props) { return (
props.onClick && props.onClick()}>
- {props.title}  + {/* */} + {props.title}{props.place ? ` - S${props.place.season}:E${props.place.episode}` : ''}  ({props.year})
+

Watch {props.type}

- + +
) } diff --git a/src/components/Progress.js b/src/components/Progress.js index 05af5c4c..38e7d6c1 100644 --- a/src/components/Progress.js +++ b/src/components/Progress.js @@ -8,7 +8,7 @@ import './Progress.css' // failed: boolean export function Progress(props) { return ( -
+
{ props.text && props.text.length > 0 ? (

{props.text}

) : null}
diff --git a/src/components/Title.js b/src/components/Title.js index 6d673ac2..b03f1aa8 100644 --- a/src/components/Title.js +++ b/src/components/Title.js @@ -14,6 +14,7 @@ export function Title(props) { const accentLink = props.accentLink || ""; const accent = props.accent || ""; + return (
{accent.length > 0 ? ( @@ -26,7 +27,7 @@ export function Title(props) { {accentLink.length > 0 ? () : null}{accent}

) : null} -

{props.children}

+

{props.children}

) } diff --git a/src/components/VideoElement.js b/src/components/VideoElement.js index 2f3863fc..13426eb0 100644 --- a/src/components/VideoElement.js +++ b/src/components/VideoElement.js @@ -6,10 +6,17 @@ import './VideoElement.css' // streamUrl: string // loading: boolean -export function VideoElement({ streamUrl, loading, setProgress }) { - const videoRef = React.useRef(null); +// setProgress: (event: NativeEvent) => void +// videoRef: useRef +// startTime: number +export function VideoElement({ streamUrl, loading, setProgress, videoRef, startTime }) { const [error, setError] = React.useState(false); + function onLoad() { + if (startTime) + videoRef.current.currentTime = startTime; + } + React.useEffect(() => { if (!streamUrl.endsWith('.mp4')) { setError(false) @@ -28,7 +35,7 @@ export function VideoElement({ streamUrl, loading, setProgress }) { hls.attachMedia(videoRef.current); hls.loadSource(streamUrl); } - }, [videoRef, streamUrl, loading]) + }, [videoRef, streamUrl, loading]); if (error) return (Your browser is not supported) @@ -41,11 +48,11 @@ export function VideoElement({ streamUrl, loading, setProgress }) { if (!streamUrl.endsWith('.mp4')) { return ( -