diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx index c856d27453..3279d774bf 100644 --- a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx +++ b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx @@ -1,35 +1,26 @@ +"use client"; + import { IconAutoGPTLogo, IconType } from "@/components/ui/icons"; -import { ProfileDetails } from "@/lib/autogpt-server-api/types"; import Wallet from "../../agptui/Wallet"; import { AccountMenu } from "./components/AccountMenu/AccountMenu"; +import { AgentNotifications } from "./components/AgentNotifications/AgentNotifications"; +import { LoginButton } from "./components/LoginButton"; import { MobileNavBar } from "./components/MobileNavbar/MobileNavBar"; import { NavbarLink } from "./components/NavbarLink"; - -import BackendAPI from "@/lib/autogpt-server-api"; -import { getServerUser } from "@/lib/supabase/server/getServerUser"; -import { LoginButton } from "./components/LoginButton"; +import { NavbarLoading } from "./components/NavbarLoading"; import { accountMenuItems, loggedInLinks, loggedOutLinks } from "./helpers"; +import { useNavbar } from "./useNavbar"; -async function getProfileData() { - const api = new BackendAPI(); - const profile = await Promise.resolve(api.getStoreProfile()); +export function Navbar() { + const { isLoggedIn, profile, isLoading } = useNavbar(); - return profile; -} - -export async function Navbar() { - const { user } = await getServerUser(); - const isLoggedIn = user !== null; - - let profile: ProfileDetails | null = null; - - if (isLoggedIn) { - profile = await getProfileData(); + if (isLoading) { + return ; } return ( <> -