ba048a15-58c0-44e5-8a0c-3cb9d71bd91d
This commit is contained in:
1 parent
72ec15c2ab
commit
d492182b4e
7 files changed
+275
-34
No files matched your search
@@ -33,6 +33,7 @@ import {
|
||||
GitBranch,
|
||||
} from 'lucide-react'
|
||||
import { useAos, type ViewId } from '@/store/aos'
|
||||
import { useFetch } from '@/hooks/use-fetch'
|
||||
import { translate } from '@/lib/i18n'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -104,6 +105,14 @@ const NAV: {
|
||||
export function SidebarNav() {
|
||||
const { view, setView, setSidebarOpen, setCommandOpen, setPortalMode, locale } = useAos()
|
||||
const t = (k: string) => translate(k, locale)
|
||||
const { data: meData } = useFetch<{ user: { name: string; email: string; role: string } } | null>('/api/auth/me')
|
||||
const user = meData?.user
|
||||
const initials = (user?.name ?? '?')
|
||||
.split(' ')
|
||||
.map((p) => p[0])
|
||||
.slice(0, 2)
|
||||
.join('')
|
||||
.toUpperCase()
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col bg-sidebar text-sidebar-foreground">
|
||||
@@ -202,11 +211,11 @@ export function SidebarNav() {
|
||||
<div className="border-t border-sidebar-border px-3 py-3">
|
||||
<Button variant="ghost" className="h-auto w-full justify-start gap-3 px-2 py-2">
|
||||
<div className="flex size-8 items-center justify-center rounded-full bg-primary text-primary-foreground text-xs font-semibold">
|
||||
MB
|
||||
{initials}
|
||||
</div>
|
||||
<div className="flex flex-col items-start leading-tight">
|
||||
<span className="text-sm font-medium">Max Brandt</span>
|
||||
<span className="text-[11px] text-muted-foreground">Owner</span>
|
||||
<span className="text-sm font-medium">{user?.name ?? '—'}</span>
|
||||
<span className="text-[11px] text-muted-foreground capitalize">{user?.role ?? ''}</span>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user