From 51151bc7bd3693998b4055873a50ea33645f24ab Mon Sep 17 00:00:00 2001 From: Jibola Paul Date: Tue, 30 Jul 2024 14:10:43 +0100 Subject: [PATCH 1/6] fix: auth.config redirect url --- src/config/auth.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/auth.config.ts b/src/config/auth.config.ts index 71f7e4b7c..5121d4088 100644 --- a/src/config/auth.config.ts +++ b/src/config/auth.config.ts @@ -69,14 +69,14 @@ export default { return { ...token, ...response }; }, async redirect({ url, baseUrl }) { - if (url === "/auth/login") { + if (url === "/login") { return baseUrl; } return "/register/organisation"; }, }, pages: { - signIn: "/auth/login", + signIn: "/login", }, trustHost: true, } satisfies NextAuthConfig; From 64a8730b83f928b7c1c4cd6967f2453398d53e6c Mon Sep 17 00:00:00 2001 From: Jibola Paul Date: Tue, 30 Jul 2024 18:15:43 +0100 Subject: [PATCH 2/6] fix: navbar popfile iamge --- src/components/card/user-card.tsx | 7 +++-- src/components/layouts/navbar/index.tsx | 32 ++++----------------- src/components/layouts/rootLayout/index.tsx | 31 ++++++++++++++++++++ src/config/auth.config.ts | 10 ++++--- src/utils/googleAuth.ts | 19 ++++++++++-- 5 files changed, 63 insertions(+), 36 deletions(-) create mode 100644 src/components/layouts/rootLayout/index.tsx diff --git a/src/components/card/user-card.tsx b/src/components/card/user-card.tsx index 1d46b02c8..0f1d5165c 100644 --- a/src/components/card/user-card.tsx +++ b/src/components/card/user-card.tsx @@ -1,3 +1,4 @@ +import { Avatar, AvatarImage } from "@radix-ui/react-avatar"; import { AnimatePresence, motion } from "framer-motion"; import { signOut } from "next-auth/react"; import { useEffect, useState } from "react"; @@ -6,7 +7,7 @@ import { useUser } from "~/hooks/user/use-user"; import { cn } from "~/lib/utils"; import { Button } from "../ui/button"; -const UserCard = ({ email }: { email: string }) => { +const UserCard = ({ image }: { image: string | undefined }) => { const { updateUser } = useUser(); const [isLogout, setIsLogout] = useState(false); @@ -39,7 +40,9 @@ const UserCard = ({ email }: { email: string }) => { "grid size-9 place-items-center rounded-full bg-orange-500 text-xl font-medium text-white sm:text-2xl sm:font-bold", )} > - {email[0]} + + + {isLogout && ( diff --git a/src/components/layouts/navbar/index.tsx b/src/components/layouts/navbar/index.tsx index a78994c54..3d3c42a8a 100644 --- a/src/components/layouts/navbar/index.tsx +++ b/src/components/layouts/navbar/index.tsx @@ -7,11 +7,11 @@ import { useEffect, useState } from "react"; import UserCard from "~/components/card/user-card"; import Logo from "~/components/common/logo"; import { cn } from "~/lib/utils"; -import { NAV_LINKS } from "./links"; import MobileNav from "./mobile-navbar"; const Navbar = () => { const [scrolling, setIsScrolling] = useState(false); + const { data: session } = useSession(); const handleScrollEvent = () => { @@ -37,40 +37,18 @@ const Navbar = () => { `relative mx-auto flex w-full max-w-[1200px] items-center gap-x-4 transition-all duration-500 md:justify-between`, scrolling ? "py-2" : "py-4 md:py-9", session?.user?.email && "justify-between", + // user.email && "justify-between", + session?.user?.email && "justify-between", )} > -
- {NAV_LINKS.map((item, index) => { - return ( - - {item.route} - - ); - })} -
{session?.user?.email ? ( - + ) : (
- - Log in - - - Get Started - +
)} diff --git a/src/components/layouts/rootLayout/index.tsx b/src/components/layouts/rootLayout/index.tsx new file mode 100644 index 000000000..b2f440ae6 --- /dev/null +++ b/src/components/layouts/rootLayout/index.tsx @@ -0,0 +1,31 @@ +"use client"; + +import { SessionProvider } from "next-auth/react"; +import { Suspense } from "react"; + +import Footer from "~/components/layouts/footer"; +import Navbar from "~/components/layouts/navbar"; + +function Layout({ children }: { children: React.ReactNode }) { + return ( + <> + +
+ {children} +
+