diff --git a/src/components/NumberInput/NumberInput.tsx b/src/components/NumberInput/NumberInput.tsx index 874019162..37daf6401 100644 --- a/src/components/NumberInput/NumberInput.tsx +++ b/src/components/NumberInput/NumberInput.tsx @@ -1,6 +1,6 @@ // Copyright (C) 2017-2025 Smart code 203358507 -import React, { forwardRef, useCallback, useState } from 'react'; +import React, { ChangeEvent, forwardRef, useCallback, useState } from 'react'; import { type KeyboardEvent, type InputHTMLAttributes } from 'react'; import classnames from 'classnames'; import styles from './styles.less'; @@ -55,7 +55,7 @@ const NumberInput = forwardRef(({ defaultValue, ...prop {props.showButtons ? : null}
@@ -67,12 +67,12 @@ const NumberInput = forwardRef(({ defaultValue, ...prop value={value} {...props} className={classnames(props.className, styles['value'], { 'disabled': props.disabled })} - onChange={(event) => setValue(event.value)} + onChange={(event: ChangeEvent) => setValue(parseInt(event.target.value))} onKeyDown={onKeyDown} />
{props.showButtons ? : null} diff --git a/src/routes/MetaDetails/StreamsList/EpisodePicker/EpisodePicker.tsx b/src/routes/MetaDetails/StreamsList/EpisodePicker/EpisodePicker.tsx index 67ceba055..51e13ee7a 100644 --- a/src/routes/MetaDetails/StreamsList/EpisodePicker/EpisodePicker.tsx +++ b/src/routes/MetaDetails/StreamsList/EpisodePicker/EpisodePicker.tsx @@ -10,21 +10,23 @@ type Props = { seriesId: string; onSubmit: (season: number, episode: number) => void; }; -export const EpisodePicker = ({ className, seriesId, onSubmit }: Props) => { +export const EpisodePicker = ({ className, onSubmit }: Props) => { const { t } = useTranslation(); + const splitPath = window.location.hash.split('/'); + const videoId = decodeURIComponent(splitPath[splitPath.length - 1]); const [initialSeason, initialEpisode] = React.useMemo(() => { - const [, season, episode] = seriesId ? seriesId.split(':') : []; - const initialSeason = isNaN(parseInt(season)) ? 1 : parseInt(season); - const initialEpisode = isNaN(parseInt(episode)) ? 1 : parseInt(episode); + const [, pathSeason, pathEpisode] = videoId ? videoId.split(':') : []; + const initialSeason = isNaN(parseInt(pathSeason)) ? 1 : parseInt(pathSeason); + const initialEpisode = isNaN(parseInt(pathEpisode)) ? 1 : parseInt(pathEpisode); return [initialSeason, initialEpisode]; - }, [seriesId]); - const seasonRef = useRef(null); - const episodeRef = useRef(null); + }, [videoId]); + const seasonRef = useRef(null); + const episodeRef = useRef(null); const handleSubmit = React.useCallback(() => { - const season = seasonRef.current?.value; - const episode = episodeRef.current?.value; - if (typeof onSubmit === 'function') onSubmit(season, episode); + const season = seasonRef.current?.value || 1; + const episode = episodeRef.current?.value || 1; + if (typeof onSubmit === 'function' && !isNaN(season) && !isNaN(parseInt(episode))) onSubmit(season, episode); }, [onSubmit, seasonRef, episodeRef]); return
diff --git a/src/routes/MetaDetails/StreamsList/StreamsList.js b/src/routes/MetaDetails/StreamsList/StreamsList.js index 0ccb05e28..3964a6e53 100644 --- a/src/routes/MetaDetails/StreamsList/StreamsList.js +++ b/src/routes/MetaDetails/StreamsList/StreamsList.js @@ -128,14 +128,14 @@ const StreamsList = ({ className, video, onEpisodeSearch, ...props }) => { { props.streams.length === 0 ?
- + {'
No addons were requested for streams!
: props.streams.every((streams) => streams.content.type === 'Err') ?
- + {video?.upcoming &&
{t('UPCOMING')}...
} {'
{t('NO_STREAM')}