diff --git a/src/app/components/Navbar.tsx b/src/app/components/Navbar.tsx new file mode 100644 index 00000000..fa459e90 --- /dev/null +++ b/src/app/components/Navbar.tsx @@ -0,0 +1,128 @@ +"use client"; + +import React, { useState } from "react"; +import { Transition } from "@headlessui/react"; +import ProfileDropDown from "./ProfileDropDown"; + +function makeLink(href: string, label: string) { + return ( + + {label} + + ); +} + +function Nav({ pageName }: { pageName: string }) { + const [isOpen, setIsOpen] = useState(false); + return ( +
+ + +
+
+

{pageName}

+
+
+
+ ); +} + +export default Nav; diff --git a/src/app/components/ProfileDropDown.tsx b/src/app/components/ProfileDropDown.tsx new file mode 100644 index 00000000..6c5a20ed --- /dev/null +++ b/src/app/components/ProfileDropDown.tsx @@ -0,0 +1,62 @@ +"use client"; + +import { Menu } from "@headlessui/react"; +import { signOut, useSession } from "next-auth/react"; +import Link from "next/link"; +import { redirect } from "next/navigation"; + +function ProfileDropDown() { + const { data: session, status } = useSession({ + required: true, + onUnauthenticated() { + redirect("/?callbackUrl=/home"); + }, + }); + + if (status !== "authenticated" || !session || !session.user) { + return null; + } + + return ( + + + {session.user.image ? ( + {session.user.image} + ) : ( + + + + + + )} + + + + + Help + + + + + + + + + + ); +} + +export default ProfileDropDown; diff --git a/src/app/components/signin/GoogleSignInButton.jsx b/src/app/components/signin/GoogleSignInButton.jsx index e61abefc..6dad75b2 100644 --- a/src/app/components/signin/GoogleSignInButton.jsx +++ b/src/app/components/signin/GoogleSignInButton.jsx @@ -9,9 +9,6 @@ const GoogleSignInButton = () => { const searchParams = useSearchParams(); const callbackUrl = searchParams.get("callbackUrl"); - console.log("WYF"); - console.log(callbackUrl); - return (