// Copyright (C) 2022-present Daniel31x13 // This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. // You should have received a copy of the GNU General Public License along with this program. If not, see . import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { signOut } from "next-auth/react"; import { useSession } from "next-auth/react"; import { faPlus, faMagnifyingGlass, faCircleUser, faSliders, faArrowRightFromBracket, faChevronDown, faBars, } from "@fortawesome/free-solid-svg-icons"; import { useEffect, useState } from "react"; import Dropdown from "@/components/Dropdown"; import Modal from "./Modal"; import AddLink from "./Modal/AddLink"; import ClickAwayHandler from "./ClickAwayHandler"; import Sidebar from "./Sidebar"; import { useRouter } from "next/router"; export default function () { const { data: session } = useSession(); const [profileDropdown, setProfileDropdown] = useState(false); const user = session?.user; const [linkModal, setLinkModal] = useState(false); const [sidebar, setSidebar] = useState(false); const router = useRouter(); window.addEventListener("resize", () => setSidebar(false)); useEffect(() => { setSidebar(false); }, [router]); const toggleSidebar = () => { setSidebar(!sidebar); }; const toggleLinkModal = () => { setLinkModal(!linkModal); }; return (
{linkModal ? ( ) : null}
setProfileDropdown(!profileDropdown)} id="profile-dropdown" >

{user?.name}

{profileDropdown ? ( , }, { name: "Logout", icon: , onClick: () => { signOut(); setProfileDropdown(!profileDropdown); }, }, ]} onClickOutside={(e: Event) => { const target = e.target as HTMLInputElement; if (target.id !== "profile-dropdown") setProfileDropdown(false); }} className="absolute top-8 right-0 z-20 w-36" /> ) : null} {sidebar ? (
) : null}
); }