Bug fixes and refactoring user dropdown.

This commit is contained in:
charlesgauthereau
2025-12-30 14:02:49 +01:00
parent 07ce5215d4
commit 475e404fae
4 changed files with 33 additions and 14 deletions
@@ -1,6 +1,6 @@
"use client";
import {ChevronUp} from "lucide-react";
import {ChevronsUpDown, ChevronUp} from "lucide-react";
import {Avatar, AvatarFallback, AvatarImage} from "@/components/ui/avatar";
import {SidebarMenuButton} from "@/components/ui/sidebar";
import {LoggedInDropdown} from "./logged-in-dropdown";
@@ -35,14 +35,23 @@ export const LoggedInButtonClient = ({
accounts={accounts}
providers={providers}
>
<SidebarMenuButton type="button">
<Avatar className="size-6">
<AvatarFallback>{user.name[0].toUpperCase()}</AvatarFallback>
{user.image && <AvatarImage src={user.image}/>}
</Avatar>
<span className="first-letter:capitalize">{user.name}</span>
<ChevronUp className="ml-auto"/>
<SidebarMenuButton type="button" className="h-auto justify-between py-2" >
<div className="flex items-center gap-2">
<Avatar className="size-6">
<AvatarFallback>{user.name[0].toUpperCase()}</AvatarFallback>
{user.image && <AvatarImage src={user.image}/>}
</Avatar>
<div className="flex flex-col items-start">
<span className="text-sm font-medium first-letter:capitalize max-w-[170px] truncate">{user.name}</span>
<span
className="text-xs text-muted-foreground max-w-[170px] truncate"
title={user.email}
>
{user.email}
</span>
</div>
</div>
<ChevronsUpDown className="h-4 w-4 shrink-0 opacity-50"/>
</SidebarMenuButton>
</LoggedInDropdown>
);
@@ -34,7 +34,6 @@ export function AppSidebar() {
<SidebarMenu className="mb-2">
<SidebarMenuItem className="p-2">
<LoggedInButton/>
</SidebarMenuItem>
</SidebarMenu>
<SideBarFooterCredit/>