import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { IconName } from '@fortawesome/fontawesome-svg-core' import { Dialog, Transition } from '@headlessui/react' import toast, { Toaster } from 'react-hot-toast' import Link from 'next/link' import { useRouter } from 'next/router' import { Fragment, useEffect, useState } from 'react' import siteConfig from '../config/site.json' const Navbar = () => { const router = useRouter() const [tokenPresent, setTokenPresent] = useState(false) const [isOpen, setIsOpen] = useState(false) useEffect(() => { const storedToken = () => { for (const r of siteConfig.protectedRoutes) { if (localStorage.hasOwnProperty(r)) { return true } } return false } setTokenPresent(storedToken()) }, []) const clearTokens = () => { setIsOpen(false) siteConfig.protectedRoutes.forEach(r => { localStorage.removeItem(r) }) toast.success('Cleared all tokens') setTimeout(() => { router.reload() }, 1000) } return (