import { useSession } from "next-auth/react"; import ClickAwayHandler from "@/components/ClickAwayHandler"; import { useState } from "react"; export default function Sidebar() { const { data: session, status } = useSession(); const [addCollection, setAddCollection] = useState(false); const user = session?.user; const toggleAddCollection = () => { setAddCollection(!addCollection); }; const submitCollection = async ( event: React.KeyboardEvent ) => { const collectionName: string = (event.target as HTMLInputElement).value; if (event.key === "Enter" && collectionName) { await fetch("/api/routes/collections/postCollection", { body: JSON.stringify({ collectionName }), headers: { "Content-Type": "application/json", }, method: "POST", }) .then((res) => res.json()) .then((data) => console.log(data)); } }; return (

{user?.name}

{addCollection ? ( ) : (
Create Collection +
)}
); }