Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): align header between home and settings #2411

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ee/tabby-ui/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function MainPanel() {
: { height: '100vh' }
return (
<div className="transition-all" style={style}>
<header className="flex h-16 items-center justify-between px-10">
<header className="flex h-16 items-center justify-between px-4">
<div>
{isSearch && (
<Image
Expand All @@ -222,11 +222,11 @@ function MainPanel() {
/>
)}
</div>
<div className="flex items-center gap-x-3">
<div className="flex items-center gap-x-6">
<ClientOnly>
<ThemeToggle />
</ClientOnly>
<UserPanel>
<UserPanel showHome={false} showSetting>
<UserAvatar className="h-10 w-10 border" />
</UserPanel>
</div>
Expand Down
34 changes: 26 additions & 8 deletions ee/tabby-ui/components/user-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { useRouter } from 'next/navigation'

import { useMe } from '@/lib/hooks/use-me'
import { useIsChatEnabled } from '@/lib/hooks/use-server-info'
Expand All @@ -16,16 +17,22 @@ import {
IconBackpack,
IconChat,
IconCode,
IconGear,
IconHome,
IconLogout,
IconSpinner
} from './ui/icons'

export default function UserPanel({
children
children,
showHome = true,
showSetting = false
}: {
children?: React.ReactNode
showHome?: boolean
showSetting?: boolean
}) {
const router = useRouter()
const signOut = useSignOut()
const [{ data }] = useMe()
const user = data?.me
Expand Down Expand Up @@ -59,13 +66,24 @@ export default function UserPanel({
)}
{!user.name && <DropdownMenuLabel>{user.email}</DropdownMenuLabel>}
<DropdownMenuSeparator />
<DropdownMenuItem
onClick={() => window.open('/')}
className="cursor-pointer"
>
<IconHome />
<span className="ml-2">Home</span>
</DropdownMenuItem>
{showHome && (
<DropdownMenuItem
onClick={() => router.push('/')}
className="cursor-pointer"
>
<IconHome />
<span className="ml-2">Home</span>
</DropdownMenuItem>
)}
{showSetting && (
<DropdownMenuItem
onClick={() => router.push('/profile')}
className="cursor-pointer"
>
<IconGear />
<span className="ml-2">Settings</span>
</DropdownMenuItem>
)}
{isChatEnabled && (
<DropdownMenuItem
onClick={() => window.open('/playground')}
Expand Down