22
33import { useGetV2GetUserProfile } from "@/app/api/__generated__/endpoints/store/store" ;
44import { IconAutoGPTLogo , IconType } from "@/components/__legacy__/ui/icons" ;
5+ import { PreviewBanner } from "@/components/layout/Navbar/components/PreviewBanner/PreviewBanner" ;
56import { useBreakpoint } from "@/lib/hooks/useBreakpoint" ;
67import { useSupabase } from "@/lib/supabase/hooks/useSupabase" ;
78import { Flag , useGetFlag } from "@/services/feature-flags/use-get-flag" ;
@@ -15,9 +16,10 @@ import { NavbarLink } from "./NavbarLink";
1516import { Wallet } from "./Wallet/Wallet" ;
1617interface NavbarViewProps {
1718 isLoggedIn : boolean ;
19+ previewBranchName ?: string | null ;
1820}
1921
20- export const NavbarView = ( { isLoggedIn } : NavbarViewProps ) => {
22+ export function NavbarView ( { isLoggedIn, previewBranchName } : NavbarViewProps ) {
2123 const { user } = useSupabase ( ) ;
2224 const breakpoint = useBreakpoint ( ) ;
2325 const isSmallScreen = breakpoint === "sm" || breakpoint === "base" ;
@@ -36,56 +38,63 @@ export const NavbarView = ({ isLoggedIn }: NavbarViewProps) => {
3638 return isChatEnabled ? [ ...loggedInLinks , chatLink ] : loggedInLinks ;
3739 } , [ isChatEnabled ] ) ;
3840
41+ const shouldShowPreviewBanner = Boolean ( isLoggedIn && previewBranchName ) ;
42+
3943 return (
4044 < >
41- < nav className = "sticky top-0 z-40 inline-flex h-[60px] w-full items-center border border-white/50 bg-[#f3f4f6]/20 p-3 backdrop-blur-[26px]" >
42- { /* Left section */ }
43- { ! isSmallScreen ? (
44- < div className = "flex flex-1 items-center gap-5" >
45- { isLoggedIn
46- ? linksWithChat . map ( ( link ) => (
47- < NavbarLink
48- key = { link . name }
49- name = { link . name }
50- href = { link . href }
51- />
52- ) )
53- : loggedOutLinks . map ( ( link ) => (
54- < NavbarLink
55- key = { link . name }
56- name = { link . name }
57- href = { link . href }
58- />
59- ) ) }
60- </ div >
45+ < div className = "sticky top-0 z-40 w-full" >
46+ { shouldShowPreviewBanner && previewBranchName ? (
47+ < PreviewBanner branchName = { previewBranchName } />
6148 ) : null }
49+ < nav className = "inline-flex h-[60px] w-full items-center border border-white/50 bg-[#f3f4f6]/20 p-3 backdrop-blur-[26px]" >
50+ { /* Left section */ }
51+ { ! isSmallScreen ? (
52+ < div className = "flex flex-1 items-center gap-5" >
53+ { isLoggedIn
54+ ? linksWithChat . map ( ( link ) => (
55+ < NavbarLink
56+ key = { link . name }
57+ name = { link . name }
58+ href = { link . href }
59+ />
60+ ) )
61+ : loggedOutLinks . map ( ( link ) => (
62+ < NavbarLink
63+ key = { link . name }
64+ name = { link . name }
65+ href = { link . href }
66+ />
67+ ) ) }
68+ </ div >
69+ ) : null }
6270
63- { /* Centered logo */ }
64- < div className = "static h-auto w-[4.5rem] md:absolute md:left-1/2 md:top-1/2 md:w-[5.5rem] md:-translate-x-1/2 md:-translate-y-1/2" >
65- < IconAutoGPTLogo className = "h-full w-full" />
66- </ div >
71+ { /* Centered logo */ }
72+ < div className = "static h-auto w-[4.5rem] md:absolute md:left-1/2 md:top-1/2 md:w-[5.5rem] md:-translate-x-1/2 md:-translate-y-1/2" >
73+ < IconAutoGPTLogo className = "h-full w-full" />
74+ </ div >
6775
68- { /* Right section */ }
69- { isLoggedIn && ! isSmallScreen ? (
70- < div className = "flex flex-1 items-center justify-end gap-4" >
71- < div className = "flex items-center gap-4" >
72- < AgentActivityDropdown />
73- { profile && < Wallet key = { profile . username } /> }
74- < AccountMenu
75- userName = { profile ?. username }
76- userEmail = { profile ?. name }
77- avatarSrc = { profile ?. avatar_url ?? "" }
78- menuItemGroups = { dynamicMenuItems }
79- />
76+ { /* Right section */ }
77+ { isLoggedIn && ! isSmallScreen ? (
78+ < div className = "flex flex-1 items-center justify-end gap-4" >
79+ < div className = "flex items-center gap-4" >
80+ < AgentActivityDropdown />
81+ { profile && < Wallet key = { profile . username } /> }
82+ < AccountMenu
83+ userName = { profile ?. username }
84+ userEmail = { profile ?. name }
85+ avatarSrc = { profile ?. avatar_url ?? "" }
86+ menuItemGroups = { dynamicMenuItems }
87+ />
88+ </ div >
8089 </ div >
81- </ div >
82- ) : ! isLoggedIn ? (
83- < div className = "flex w-full items-center justify-end" >
84- < LoginButton / >
85- </ div >
86- ) : null }
87- { /* <ThemeToggle /> */ }
88- </ nav >
90+ ) : ! isLoggedIn ? (
91+ < div className = "flex w-full items-center justify-end" >
92+ < LoginButton / >
93+ </ div >
94+ ) : null }
95+ { /* <ThemeToggle /> */ }
96+ </ nav >
97+ </ div >
8998 { /* Mobile Navbar - Adjust positioning */ }
9099 < >
91100 { isLoggedIn && isSmallScreen ? (
@@ -123,4 +132,4 @@ export const NavbarView = ({ isLoggedIn }: NavbarViewProps) => {
123132 </ >
124133 </ >
125134 ) ;
126- } ;
135+ }
0 commit comments