import { ChevronDownIcon, ExclamationCircleIcon, } from "@heroicons/react/24/outline"; import { useEffect, useState } from "react"; import { useAniList } from "../../lib/anilist/useAnilist"; import { toast } from "react-toastify"; import AniList from "../media/aniList"; import { signIn } from "next-auth/react"; export default function RightBar({ id, hasRun, session, data, error, currentChapter, paddingX, setPaddingX, layout, setLayout, setIsKeyOpen, scaleImg, setScaleImg, }) { const { markProgress } = useAniList(session); const [status, setStatus] = useState("CURRENT"); const [progress, setProgress] = useState(0); const [volumeProgress, setVolumeProgress] = useState(0); useEffect(() => { if (currentChapter?.number) { setProgress(currentChapter.number); } }, [currentChapter]); const saveProgress = async () => { if (session) { const parsedProgress = parseFloat(progress); const parsedVolumeProgress = parseFloat(volumeProgress); if ( parsedProgress === parseInt(parsedProgress) && parsedVolumeProgress === parseInt(parsedVolumeProgress) ) { markProgress(id, progress, status, volumeProgress); hasRun.current = true; } else { toast.error("Progress must be a whole number!", { position: "bottom-right", autoClose: 5000, hideProgressBar: true, closeOnClick: false, pauseOnHover: true, draggable: true, theme: "colored", }); } } }; const changeMode = (e) => { setLayout(Number(e.target.value)); // console.log(e.target.value); }; return (
setIsKeyOpen(true)} >
{Array.isArray(data) ? (

Reading mode

) : ( "" )} {/* Zoom */}

Scale Image

Tracking

{session ? (
setProgress(e.target.value)} className="w-full px-2 py-1 rounded-md bg-[#161617] text-sm" />
setVolumeProgress(e.target.value)} className="w-full px-2 py-1 rounded-md bg-[#161617] text-sm" />
) : ( )}
); }