Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Clarify app navigation UI

Tomas Valentadfdb43444f41
diff --git a/components/Header/Navigation/HeaderLink.tsx b/components/Header/Navigation/HeaderLink.tsx
index 1ea99840c..32b485d53 100644
--- a/components/Header/Navigation/HeaderLink.tsx
+++ b/components/Header/Navigation/HeaderLink.tsx
@@ -2,12 +2,14 @@ import clsx from 'clsx'
import { UrlObject } from 'url'
import TitleLink from 'components/TitleLink'
+import { ReactNode } from 'react'
export interface Props {
active: boolean
title: string
href: UrlObject | string
shallow?: boolean
+ icon?: ReactNode
}
function HeaderLink({
@@ -15,10 +17,12 @@ function HeaderLink({
title,
href,
shallow,
+ icon,
}: Props) {
return (
<div className="relative flex flex-col">
<TitleLink
+ icon={icon}
active={active}
className="px-1 py-3"
href={href}
diff --git a/components/Header/Navigation/index.tsx b/components/Header/Navigation/index.tsx
index 5776ca855..fd303e073 100644
--- a/components/Header/Navigation/index.tsx
+++ b/components/Header/Navigation/index.tsx
@@ -1,4 +1,4 @@
-import { ChevronRight } from 'lucide-react'
+import { ChevronRight, LayoutGrid } from 'lucide-react'
import { useRouter } from 'next/router'
import HeaderLink from './HeaderLink'
@@ -17,6 +17,7 @@ function Navigation({ project }: Props) {
active={router.pathname === '/'}
href="/"
title="Projects"
+ icon={<LayoutGrid size="18px" />}
/>
{project && (
<>
@@ -40,4 +41,4 @@ function Navigation({ project }: Props) {
)
}
-export default Navigation
\ No newline at end of file
+export default Navigation
diff --git a/components/Header/index.tsx b/components/Header/index.tsx
index 2d3603a33..50718945b 100644
--- a/components/Header/index.tsx
+++ b/components/Header/index.tsx
@@ -1,17 +1,16 @@
-import Link from 'next/link'
-import { useUser } from '@supabase/auth-helpers-react'
import { projects } from '@prisma/client'
-import UserPortrait from 'components/UserPortrait'
-
import Navigation from './Navigation'
+import { Settings } from 'lucide-react'
+import { useRouter } from 'next/router'
+import HeaderLink from './Navigation/HeaderLink'
export interface Props {
project?: projects
}
function Header({ project }: Props) {
- const user = useUser()
+ const router = useRouter()
return (
<div className="
@@ -27,15 +26,18 @@ function Header({ project }: Props) {
<div className="
flex
items-center
- space-x-4
">
- <Link
- href={{
- pathname: '/settings',
- }}
- >
- <UserPortrait username={user?.email} />
- </Link>
+ <HeaderLink
+ active={router.pathname === '/settings'}
+ href="/settings"
+ title="Settings"
+ icon={<Settings size="18px" />}
+ />
+ {/* <Button
+ icon={<LayoutGrid size="18px" />}
+ text="Settings"
+ onClick={() => router.push('/settings')}
+ /> */}
</div>
</div>
)
diff --git a/components/TitleLink.tsx b/components/TitleLink.tsx
index ed6a49fcc..739a30646 100644
--- a/components/TitleLink.tsx
+++ b/components/TitleLink.tsx
@@ -39,6 +39,7 @@ function TitleLink({
className={clsx(
'whitespace-nowrap',
'transition-all',
+ 'space-x-2',
active ? 'text-green-800' : 'text-slate-400 hover:text-green-800',
className,
)}
diff --git a/components/UserPortrait.tsx b/components/UserPortrait.tsx
deleted file mode 100644
index 457be532b..000000000
--- a/components/UserPortrait.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import clsx from 'clsx'
-import randomColor from 'randomcolor'
-import { MouseEvent, useMemo } from 'react'
-
-export interface Props {
- username?: string
- onClick?: (e: MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => any
-}
-
-function UserPortrait({ onClick, username = '?' }: Props) {
- const backgroundColor = useMemo(
- () => randomColor({ luminosity: 'bright', seed: username }),
- [username],
- )
-
- return (
- <div
- style={{ borderColor: backgroundColor, backgroundColor }}
- className={clsx(
- 'flex items-center justify-center relative rounded-full border',
- 'h-6 w-6 text-sm',
- { 'cursor-pointer': !!onClick },
- )}
- onClick={onClick}
- >
-
- <div className="relative select-none text-white">
- {username[0].toUpperCase()}
- </div>
- </div>
- )
-}
-
-export default UserPortrait