From 42f51379a829f49f2d292ae9377f9d283de2f66e Mon Sep 17 00:00:00 2001 From: Lluis Agusti Date: Wed, 2 Jul 2025 21:09:25 +0400 Subject: [PATCH] chore: add colors and update UI --- .../src/components/layout/Navbar/Navbar.tsx | 36 +- .../AgentNotifications/AgentNotifications.tsx | 52 +++ .../components/NotificationDropdown.tsx | 81 +++++ .../components/NotificationItem.tsx | 88 +++++ .../components/NotificationSection.tsx | 26 ++ .../components/AgentNotifications/helpers.tsx | 326 ++++++++++++++++++ .../useAgentNotifications.ts | 156 +++++++++ .../layout/Navbar/components/NavbarLink.tsx | 4 +- .../Navbar/components/NavbarLoading.tsx | 21 ++ .../src/components/layout/Navbar/useNavbar.ts | 26 ++ .../frontend/src/components/styles/colors.ts | 24 ++ .../src/components/tokens/colors.stories.tsx | 4 + .../frontend/src/components/ui/popover.tsx | 8 +- 13 files changed, 823 insertions(+), 29 deletions(-) create mode 100644 autogpt_platform/frontend/src/components/layout/Navbar/components/AgentNotifications/AgentNotifications.tsx create mode 100644 autogpt_platform/frontend/src/components/layout/Navbar/components/AgentNotifications/components/NotificationDropdown.tsx create mode 100644 autogpt_platform/frontend/src/components/layout/Navbar/components/AgentNotifications/components/NotificationItem.tsx create mode 100644 autogpt_platform/frontend/src/components/layout/Navbar/components/AgentNotifications/components/NotificationSection.tsx create mode 100644 autogpt_platform/frontend/src/components/layout/Navbar/components/AgentNotifications/helpers.tsx create mode 100644 autogpt_platform/frontend/src/components/layout/Navbar/components/AgentNotifications/useAgentNotifications.ts create mode 100644 autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLoading.tsx create mode 100644 autogpt_platform/frontend/src/components/layout/Navbar/useNavbar.ts 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 ( <> -