import useCollectionStore from "@/store/collections"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faFolder, faHashtag, faChartSimple, faChevronDown, faLink, } from "@fortawesome/free-solid-svg-icons"; import useTagStore from "@/store/tags"; import Link from "next/link"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { Disclosure, Transition } from "@headlessui/react"; import Image from "next/image"; export default function Sidebar({ className }: { className?: string }) { const [tagDisclosure, setTagDisclosure] = useState(() => { const storedValue = localStorage.getItem("tagDisclosure"); return storedValue ? storedValue === "true" : true; }); const [collectionDisclosure, setCollectionDisclosure] = useState( () => { const storedValue = localStorage.getItem("collectionDisclosure"); return storedValue ? storedValue === "true" : true; } ); const { collections } = useCollectionStore(); const { tags } = useTagStore(); const router = useRouter(); const [active, setActive] = useState(""); useEffect(() => { localStorage.setItem("tagDisclosure", tagDisclosure ? "true" : "false"); }, [tagDisclosure]); useEffect(() => { localStorage.setItem( "collectionDisclosure", collectionDisclosure ? "true" : "false" ); }, [collectionDisclosure]); useEffect(() => { setActive(router.asPath); }, [router, collections]); return (

Dashboard

All Links

All Collections

{ setCollectionDisclosure(!collectionDisclosure); }} className="flex items-center justify-between text-sm w-full text-left mb-2 pl-2 font-bold text-gray-500 mt-5" >

Collections

{collections .sort((a, b) => a.name.localeCompare(b.name)) .map((e, i) => { return (

{e.name}

); })}
{ setTagDisclosure(!tagDisclosure); }} className="flex items-center justify-between text-sm w-full text-left mb-2 pl-2 font-bold text-gray-500 mt-5" >

Tags

{tags .sort((a, b) => a.name.localeCompare(b.name)) .map((e, i) => { return (

{e.name}

); })}
); }