aboutsummaryrefslogtreecommitdiff
path: root/components/watch/secondary
diff options
context:
space:
mode:
Diffstat (limited to 'components/watch/secondary')
-rw-r--r--components/watch/secondary/episodeLists.tsx (renamed from components/watch/secondary/episodeLists.js)36
1 files changed, 26 insertions, 10 deletions
diff --git a/components/watch/secondary/episodeLists.js b/components/watch/secondary/episodeLists.tsx
index a676be0..2c23f25 100644
--- a/components/watch/secondary/episodeLists.js
+++ b/components/watch/secondary/episodeLists.tsx
@@ -3,6 +3,19 @@ import Image from "next/image";
import Link from "next/link";
import { ChevronDownIcon } from "@heroicons/react/24/outline";
import { useRouter } from "next/router";
+import { AniListInfoTypes } from "types/info/AnilistInfoTypes";
+import { Episode } from "types/api/Episode";
+
+type EpisodeListsProps = {
+ info: AniListInfoTypes;
+ map: any;
+ providerId: string;
+ watchId: string;
+ episode: Episode[];
+ artStorage: any;
+ track: any;
+ dub: string;
+};
export default function EpisodeLists({
info,
@@ -13,7 +26,7 @@ export default function EpisodeLists({
artStorage,
track,
dub,
-}) {
+}: EpisodeListsProps) {
const progress = info.mediaListEntry?.progress;
const router = useRouter();
@@ -45,8 +58,8 @@ export default function EpisodeLists({
router.push(
`/en/anime/watch/${info.id}/${providerId}?id=${
- selectedEpisode.id
- }&num=${selectedEpisode.number}${dub ? `&dub=${dub}` : ""}`
+ selectedEpisode?.id
+ }&num=${selectedEpisode?.number}${dub ? `&dub=${dub}` : ""}`
);
}}
className="flex items-center text-sm gap-5 rounded-[3px] bg-secondary py-1 px-3 pr-8 font-karla appearance-none cursor-pointer outline-none focus:ring-1 focus:ring-action group-hover:ring-1 group-hover:ring-action"
@@ -64,7 +77,7 @@ export default function EpisodeLists({
<div className="flex flex-col gap-5 lg:pl-5 py-2 scrollbar-thin px-2 scrollbar-thumb-[#313131] scrollbar-thumb-rounded-full">
{episode && episode.length > 0 ? (
map?.some(
- (item) =>
+ (item: any) =>
(item?.img || item?.image) &&
!item?.img?.includes("https://s4.anilist.co/")
) > 0 ? (
@@ -74,7 +87,14 @@ export default function EpisodeLists({
let prog = (time / duration) * 100;
if (prog > 90) prog = 100;
- const mapData = map?.find((i) => i.number === item.number);
+ const mapData = map?.find((i: any) => i.number === item.number);
+
+ const parsedImage = mapData
+ ? mapData?.img?.includes("null") ||
+ mapData?.image?.includes("null")
+ ? info.coverImage?.extraLarge
+ : mapData?.img || mapData?.image
+ : info.coverImage?.extraLarge || null;
return (
<Link
href={`/en/anime/watch/${
@@ -93,11 +113,7 @@ export default function EpisodeLists({
<div className="relative">
{/* <div className="absolute inset-0 w-full h-full z-40" /> */}
<Image
- src={
- mapData?.img ||
- mapData?.image ||
- info?.coverImage?.extraLarge
- }
+ src={parsedImage || info?.coverImage?.extraLarge}
draggable={false}
alt="Anime Cover"
width={1000}