import { useSession } from "next-auth/react"; import ClickAwayHandler from "@/components/ClickAwayHandler"; import { useState } from "react"; import useCollectionSlice from "@/store/collection"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faFolder, faUserCircle } from "@fortawesome/free-regular-svg-icons"; import { faDatabase, faPlus, faChevronDown, } from "@fortawesome/free-solid-svg-icons"; export default function Sidebar() { const { data: session } = useSession(); const [collectionInput, setCollectionInput] = useState(false); const { collections, addCollection } = useCollectionSlice(); const user = session?.user; const toggleCollectionInput = () => { setCollectionInput(!collectionInput); }; const submitCollection = async ( event: React.KeyboardEvent ) => { const collectionName: string = (event.target as HTMLInputElement).value; if (event.key === "Enter" && collectionName) { addCollection(collectionName); (event.target as HTMLInputElement).value = ""; } }; return (

{user?.name}

All Collections

Collections

{collectionInput ? ( ) : ( )}
{collections.map((e, i) => { return (

{e.name}

); })}
); }