From 1eee181e219dfd993d396ac3169e7aad3dd285eb Mon Sep 17 00:00:00 2001 From: Factiven Date: Sun, 16 Jul 2023 22:35:39 +0700 Subject: Update v3.6.4 - Added Manga page with a working tracker for AniList user - Added schedule component to home page - Added disqus comment section so you can fight on each other (not recommended) - Added /id and /en route for english and indonesian subs (id route still work in progress) --- components/navbar.js | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'components/navbar.js') diff --git a/components/navbar.js b/components/navbar.js index 2bb2f92..e148b09 100644 --- a/components/navbar.js +++ b/components/navbar.js @@ -2,12 +2,16 @@ import React, { useState, useEffect } from "react"; import Link from "next/link"; import { useSession, signIn, signOut } from "next-auth/react"; import Image from "next/image"; +import { parseCookies } from "nookies"; function Navbar(props) { const { data: session, status } = useSession(); const [isVisible, setIsVisible] = useState(false); const [fade, setFade] = useState(false); + const [lang, setLang] = useState("en"); + const [cookie, setCookies] = useState(null); + const handleShowClick = () => { setIsVisible(true); setFade(true); @@ -18,13 +22,27 @@ function Navbar(props) { setFade(false); }; + useEffect(() => { + let lang = null; + if (!cookie) { + const cookie = parseCookies(); + lang = cookie.lang || null; + setCookies(cookie); + } + if (lang === "en" || lang === null) { + setLang("en"); + } else if (lang === "id") { + setLang("id"); + } + }, []); + // console.log(session.user?.image); return (
- moopa + moopa
{/* Mobile Hamburger */} @@ -57,7 +75,7 @@ function Navbar(props) { > {isVisible && session && (
Profile -- cgit v1.2.3