diff options
| author | Factiven <[email protected]> | 2023-08-12 22:54:26 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-12 22:54:26 +0700 |
| commit | 3e78826658c7d2a4e9b3c1d73e63dacc1d39c361 (patch) | |
| tree | d580d03670692c6c5d361ec8559e7a2352354f3a /pages/en/index.js | |
| parent | Update v3.9.1 - Merged Beta to Main (#44) (diff) | |
| download | moopa-3.9.3.tar.xz moopa-3.9.3.zip | |
Update v3.9.3 - Merged Beta to Main (#51)v3.9.3
* commit
* update db
* Update v3.9.1-beta-v3.1
* Update v3.9.1
* Fix watched progress not showing
* Secure headers
* Fix recently watched image
* Update v3.9.2
> Added custom lists for AniList
> Fixed episode listMode progress
* Update db route
* Fixed AniList
* Fix next button on dub anime
> video is playing sub anime instead dub
* small adjusment for premid
* fix eslint
* small updates
> added ability to remove episode from recently watched
* Update v3.9.3
Diffstat (limited to 'pages/en/index.js')
| -rw-r--r-- | pages/en/index.js | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/pages/en/index.js b/pages/en/index.js index 159d257..73b4e94 100644 --- a/pages/en/index.js +++ b/pages/en/index.js @@ -9,7 +9,6 @@ import Content from "../../components/home/content"; import { motion } from "framer-motion"; import { signOut } from "next-auth/react"; -import { useAniList } from "../../lib/anilist/useAnilist"; import { getServerSession } from "next-auth/next"; import { authOptions } from "../api/auth/[...nextauth]"; import SearchBar from "../../components/searchBar"; @@ -25,6 +24,7 @@ import { createUser } from "../../prisma/user"; import { checkAdBlock } from "adblock-checker"; import { ToastContainer, toast } from "react-toastify"; +import { useAniList } from "../../lib/anilist/useAnilist"; export async function getServerSideProps(context) { const session = await getServerSession(context.req, context.res, authOptions); @@ -35,7 +35,6 @@ export async function getServerSideProps(context) { } } catch (error) { console.error(error); - // Handle the error here } const trendingDetail = await aniListData({ @@ -108,8 +107,14 @@ export default function Home({ detail, populars, sessions, upComing }) { useEffect(() => { const getSchedule = async () => { - const { data } = await axios.get(`/api/anify/schedule`); - setSchedules(data); + const res = await fetch(`/api/anify/schedule`); + const data = await res.json(); + + if (!res.ok) { + setSchedules(null); + } else { + setSchedules(data); + } }; getSchedule(); }, []); @@ -120,12 +125,16 @@ export default function Home({ detail, populars, sessions, upComing }) { function getRelease() { let releasingAnime = []; let progress = []; + let seenIds = new Set(); // Create a Set to store the IDs of seen anime release.map((list) => { list.entries.map((entry) => { - if (entry.media.status === "RELEASING") { + if ( + entry.media.status === "RELEASING" && + !seenIds.has(entry.media.id) + ) { releasingAnime.push(entry.media); + seenIds.add(entry.media.id); // Add the ID to the Set } - progress.push(entry); }); }); @@ -139,8 +148,7 @@ export default function Home({ detail, populars, sessions, upComing }) { const [planned, setPlanned] = useState(null); const [greeting, setGreeting] = useState(""); const [user, setUser] = useState(null); - - // console.log({ user }); + const [removed, setRemoved] = useState(); const [prog, setProg] = useState(null); @@ -194,7 +202,7 @@ export default function Home({ detail, populars, sessions, upComing }) { // const data = await res.json(); } userData(); - }, [sessions?.user?.name]); + }, [sessions?.user?.name, removed]); useEffect(() => { const time = new Date().getHours(); @@ -251,7 +259,11 @@ export default function Home({ detail, populars, sessions, upComing }) { /> <meta name="twitter:image" - content="https://cdn.discordapp.com/attachments/1084446049986420786/1093300833422168094/image.png" + content="https://beta.moopa.live/preview.png" + /> + <meta + name="description" + content="Discover your new favorite anime or manga title! Moopa offers a vast library of high-quality content, accessible on multiple devices and without any interruptions. Start using Moopa today!" /> <link rel="icon" href="/c.svg" /> </Head> @@ -262,7 +274,7 @@ export default function Home({ detail, populars, sessions, upComing }) { <Navigasi /> <SearchBar /> <ToastContainer - pauseOnFocusLoss={false} + pauseOnHover={false} style={{ width: "400px", }} @@ -350,6 +362,8 @@ export default function Home({ detail, populars, sessions, upComing }) { ids="recentlyWatched" section="Recently Watched" userData={user} + userName={sessions?.user?.name} + setRemoved={setRemoved} /> </motion.div> )} |