Update favicon and site title
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
import { Search, Bell, ChevronDown } from 'lucide-react';
|
||||
import { Search, Bell, ChevronDown, LogOut } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
|
||||
interface TopBarProps {
|
||||
title: string;
|
||||
@@ -7,6 +16,22 @@ interface TopBarProps {
|
||||
}
|
||||
|
||||
export function TopBar({ title, description }: TopBarProps) {
|
||||
const { user, logout } = useAuth();
|
||||
|
||||
const getInitials = () => {
|
||||
if (user?.first_name && user?.last_name) {
|
||||
return `${user.first_name[0]}${user.last_name[0]}`.toUpperCase();
|
||||
}
|
||||
return user?.username?.substring(0, 2).toUpperCase() || 'AD';
|
||||
};
|
||||
|
||||
const getDisplayName = () => {
|
||||
if (user?.first_name && user?.last_name) {
|
||||
return `${user.first_name} ${user.last_name}`;
|
||||
}
|
||||
return user?.username || 'Admin User';
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-30 flex h-20 items-center justify-between bg-background/80 backdrop-blur-sm px-8 border-b border-border/30">
|
||||
{/* Page Title */}
|
||||
@@ -35,7 +60,7 @@ export function TopBar({ title, description }: TopBarProps) {
|
||||
</div>
|
||||
|
||||
{/* Notifications */}
|
||||
<button
|
||||
<button
|
||||
className={cn(
|
||||
"relative h-10 w-10 flex items-center justify-center rounded-xl",
|
||||
"neu-button"
|
||||
@@ -47,18 +72,31 @@ export function TopBar({ title, description }: TopBarProps) {
|
||||
</span>
|
||||
</button>
|
||||
|
||||
{/* Profile */}
|
||||
<button className="flex items-center gap-3 pl-4 pr-3 py-2 rounded-xl neu-button">
|
||||
<div className="h-8 w-8 rounded-lg bg-primary shadow-neu-inset-sm flex items-center justify-center">
|
||||
<span className="text-sm font-bold text-primary-foreground">AS</span>
|
||||
</div>
|
||||
<div className="text-left">
|
||||
<p className="text-sm font-medium text-foreground">Admin User</p>
|
||||
<p className="text-xs text-muted-foreground">Super Admin</p>
|
||||
</div>
|
||||
<ChevronDown className="h-4 w-4 text-muted-foreground" />
|
||||
</button>
|
||||
{/* Profile Dropdown */}
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className="flex items-center gap-3 pl-4 pr-3 py-2 rounded-xl neu-button">
|
||||
<div className="h-8 w-8 rounded-lg bg-primary shadow-neu-inset-sm flex items-center justify-center">
|
||||
<span className="text-sm font-bold text-primary-foreground">{getInitials()}</span>
|
||||
</div>
|
||||
<div className="text-left">
|
||||
<p className="text-sm font-medium text-foreground">{getDisplayName()}</p>
|
||||
<p className="text-xs text-muted-foreground">Admin</p>
|
||||
</div>
|
||||
<ChevronDown className="h-4 w-4 text-muted-foreground" />
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-56">
|
||||
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={() => logout()} className="text-error cursor-pointer">
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
<span>Log out</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user