import { ArrowUpCircleIcon, MagnifyingGlassIcon, } from "@heroicons/react/24/solid"; import { ArrowLeftIcon, PlayIcon, PlusIcon, ShareIcon, UserIcon, } from "@heroicons/react/24/solid"; import Image from "next/image"; import { useRouter } from "next/router"; import { useSearch } from "../../../lib/hooks/isOpenState"; import { useEffect, useState } from "react"; import { convertSecondsToTime } from "../../../utils/getTimes"; import Link from "next/link"; import { signIn } from "next-auth/react"; import InfoChip from "./reused/infoChip"; import Description from "./reused/description"; const getScrollPosition = (el = window) => ({ x: el.pageXOffset !== undefined ? el.pageXOffset : el.scrollLeft, y: el.pageYOffset !== undefined ? el.pageYOffset : el.scrollTop, }); export function NewNavbar({ info, session, scrollP = 200, toTop = false }) { const router = useRouter(); const [scrollPosition, setScrollPosition] = useState(); const { isOpen, setIsOpen } = useSearch(); useEffect(() => { const handleScroll = () => { setScrollPosition(getScrollPosition()); }; // Add a scroll event listener when the component mounts window.addEventListener("scroll", handleScroll); // Clean up the event listener when the component unmounts return () => { window.removeEventListener("scroll", handleScroll); }; }, []); return ( <> {toTop && ( )} ); } export default function DetailTop({ info, session, statuses, handleOpen, watchUrl, progress, color, }) { const router = useRouter(); const [readMore, setReadMore] = useState(false); const [showAll, setShowAll] = useState(false); useEffect(() => { setReadMore(false); }, [info.id]); const handleShareClick = async () => { try { if (navigator.share) { await navigator.share({ title: `Watch Now - ${info?.title?.english}`, // text: `Watch [${info?.title?.romaji}] and more on Moopa. Join us for endless anime entertainment"`, url: window.location.href, }); } else { // Web Share API is not supported, provide a fallback or show a message alert("Web Share API is not supported in this browser."); } } catch (error) { console.error("Error sharing:", error); } }; return (
{/* MAIN */}
poster anime

{info?.season?.toLowerCase()} {info.seasonYear}

{info?.title?.romaji || info?.title?.english}

{info.title?.english}

{info?.description && ( )}
See on AniList anilist_icon
{info.nextAiringEpisode?.timeUntilAiring && (

Episode {info.nextAiringEpisode.episode} in{" "} {convertSecondsToTime(info.nextAiringEpisode.timeUntilAiring)}{" "}

)} {info?.description && ( )} {info?.relations?.edges?.length > 0 && (
{info?.relations?.edges?.length > 0 && (
Relations
)} {info?.relations?.edges?.length > 3 && (
setShowAll(!showAll)} > {showAll ? "show less" : "show more"}
)}
{info?.relations?.edges .slice(0, showAll ? info?.relations?.edges.length : 3) .map((r, index) => { const rel = r.node; return (
{rel.id}
{r.relationType.replace(/_/g, " ")}
{rel.title.userPreferred}
{rel.format}
); })}
)}
); }