Some checks failed
tests / ci (pull_request) Has been cancelled
- Removed unnecessary "use client" directive from checkbox and select components. - Added new Drawer component with associated subcomponents (DrawerTrigger, DrawerClose, etc.) for better UI management. - Introduced Table component with TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, and TableCaption for structured data display. - Added Tabs component with TabsList, TabsTrigger, and TabsContent for tabbed navigation. - Updated user-info component to use full_name instead of name for better clarity. - Modified user-menu-content to include translations for settings and logout options. - Added data.json file for mock data in the dashboard. - Updated dashboard page to utilize new components and improved layout. - Refactored User type to replace name with full_name for consistency across the application.
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
|
import { useInitials } from '@/hooks/use-initials';
|
|
import type { User } from '@/types';
|
|
|
|
export function UserInfo({
|
|
user,
|
|
showEmail = false,
|
|
}: {
|
|
user: User;
|
|
showEmail?: boolean;
|
|
}) {
|
|
const getInitials = useInitials();
|
|
|
|
return (
|
|
<>
|
|
<Avatar className="h-8 w-8 overflow-hidden rounded-full">
|
|
<AvatarImage src={user.avatar} alt={user.full_name} />
|
|
<AvatarFallback className="rounded-lg bg-neutral-200 text-black dark:bg-neutral-700 dark:text-white">
|
|
{getInitials(user.full_name ?? '')}
|
|
</AvatarFallback>
|
|
</Avatar>
|
|
<div className="grid flex-1 text-left text-sm leading-tight">
|
|
<span className="truncate font-medium">{user.full_name}</span>
|
|
{showEmail && (
|
|
<span className="truncate text-xs text-muted-foreground">
|
|
{user.email}
|
|
</span>
|
|
)}
|
|
</div>
|
|
</>
|
|
);
|
|
}
|