import { signIn, useSession } from "next-auth/react"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { getCurrentSeason } from "../../utils/getTimes"; import Link from "next/link"; import { parseCookies } from "nookies"; export default function Navigasi() { const { data: sessions, status } = useSession(); const [year, setYear] = useState(new Date().getFullYear()); const [season, setSeason] = useState(getCurrentSeason()); const [lang, setLang] = useState("en"); const [cookie, setCookies] = useState(null); const router = useRouter(); 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"); } }, []); const handleFormSubmission = (inputValue) => { router.push(`/${lang}/search/${encodeURIComponent(inputValue)}`); }; const handleKeyDown = async (event) => { if (event.key === "Enter") { event.preventDefault(); const inputValue = event.target.value; handleFormSubmission(inputValue); } }; return ( <> {/* NAVBAR PC */}