diff options
| author | Factiven <[email protected]> | 2023-10-24 11:05:06 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-10-24 11:05:06 +0700 |
| commit | 0a30e0570a5d22dd8c459fd9769fe4386c07aae8 (patch) | |
| tree | 67346a73b4be2ed5e5a7008828e4bc70bac3bd92 /components/home | |
| parent | fixed redis error for manga (#95) (diff) | |
| download | moopa-4.2.1.tar.xz moopa-4.2.1.zip | |
Update v4.2.1v4.2.1
Diffstat (limited to 'components/home')
| -rw-r--r-- | components/home/content.js | 29 | ||||
| -rw-r--r-- | components/home/genres.js | 21 |
2 files changed, 7 insertions, 43 deletions
diff --git a/components/home/content.js b/components/home/content.js index 678549c..a380e1f 100644 --- a/components/home/content.js +++ b/components/home/content.js @@ -8,8 +8,6 @@ import { ArrowRightCircleIcon, } from "@heroicons/react/24/outline"; -import { parseCookies } from "nookies"; - import { ChevronLeftIcon } from "@heroicons/react/20/solid"; import { ExclamationCircleIcon, PlayIcon } from "@heroicons/react/24/solid"; import { useRouter } from "next/router"; @@ -30,30 +28,15 @@ export default function Content({ const ref = useRef(); const { events } = useDraggable(ref); - const [cookie, setCookie] = useState(null); const [clicked, setClicked] = useState(false); - const [lang, setLang] = useState("en"); - useEffect(() => { const click = localStorage.getItem("clicked"); if (click) { setClicked(JSON.parse(click)); } - - let lang = null; - if (!cookie) { - const cookie = parseCookies(); - lang = cookie.lang || null; - setCookie(cookie); - } - if (lang === "en" || lang === null) { - setLang("en"); - } else if (lang === "id") { - setLang("id"); - } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -109,22 +92,22 @@ export default function Content({ const goToPage = () => { if (section === "Recently Watched") { - router.push(`/${lang}/anime/recently-watched`); + router.push(`/en/anime/recently-watched`); } if (section === "New Episodes") { - router.push(`/${lang}/anime/recent`); + router.push(`/en/anime/recent`); } if (section === "Trending Now") { - router.push(`/${lang}/anime/trending`); + router.push(`/en/anime/trending`); } if (section === "Popular Anime") { - router.push(`/${lang}/anime/popular`); + router.push(`/en/anime/popular`); } if (section === "Your Plan") { - router.push(`/${lang}/profile/${userName}/#planning`); + router.push(`/en/profile/${userName}/#planning`); } if (section === "On-Going Anime" || section === "Your Watch List") { - router.push(`/${lang}/profile/${userName}/#current`); + router.push(`/en/profile/${userName}/#current`); } }; diff --git a/components/home/genres.js b/components/home/genres.js index cd247ce..9c80ca6 100644 --- a/components/home/genres.js +++ b/components/home/genres.js @@ -1,8 +1,6 @@ import Image from "next/image"; import { ChevronRightIcon } from "@heroicons/react/24/outline"; import Link from "next/link"; -import { useEffect, useState } from "react"; -import { parseCookies } from "nookies"; const g = [ { @@ -32,23 +30,6 @@ const g = [ ]; export default function Genres() { - const [lang, setLang] = useState("en"); - const [cookie, setCookie] = useState(null); - - useEffect(() => { - let lang = null; - if (!cookie) { - const cookie = parseCookies(); - lang = cookie.lang || null; - setCookie(cookie); - } - if (lang === "en" || lang === null) { - setLang("en"); - } else if (lang === "id") { - setLang("id"); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); return ( <div className="antialiased"> <div className="flex items-center justify-between lg:justify-normal lg:gap-3 px-5"> @@ -61,7 +42,7 @@ export default function Genres() { <div className="flex lg:gap-10 gap-4"> {g.map((a, index) => ( <Link - href={`${lang}/search/anime/?genres=${a.name}`} + href={`/en/search/anime/?genres=${a.name}`} key={index} className="relative hover:shadow-lg hover:scale-105 duration-200 cursor-pointer ease-out h-[190px] w-[135px] lg:h-[265px] lg:w-[230px] rounded-md shrink-0" > |