89 lines
3.1 KiB
TypeScript
89 lines
3.1 KiB
TypeScript
'use client'
|
|
|
|
import Link from 'next/link'
|
|
import { signOut } from 'next-auth/react'
|
|
import { Button } from '@/components/ui/button'
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuLabel,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuTrigger,
|
|
} from '@/components/ui/dropdown-menu'
|
|
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
|
|
import { Bell, Settings, LogOut, Eye } from 'lucide-react'
|
|
|
|
interface AdminHeaderProps {
|
|
user: {
|
|
name?: string | null
|
|
email?: string | null
|
|
image?: string | null
|
|
}
|
|
}
|
|
|
|
export function AdminHeader({ user }: AdminHeaderProps) {
|
|
return (
|
|
<header className="bg-white border-b border-gray-200">
|
|
<div className="flex h-16 items-center justify-between px-6">
|
|
<div className="flex items-center space-x-4">
|
|
<Link href="/admin" className="flex items-center space-x-2">
|
|
<div className="w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center">
|
|
<span className="text-white font-bold text-lg">M</span>
|
|
</div>
|
|
<span className="text-xl font-bold text-gray-900">Padmaaja Rasooi Admin</span>
|
|
</Link>
|
|
</div>
|
|
|
|
<div className="flex items-center space-x-4">
|
|
<Button variant="ghost" size="sm" asChild>
|
|
<Link href="/" className="flex items-center">
|
|
<Eye className="h-4 w-4 mr-2" />
|
|
View Site
|
|
</Link>
|
|
</Button>
|
|
|
|
<Button variant="ghost" size="sm">
|
|
<Bell className="h-5 w-5" />
|
|
</Button>
|
|
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button variant="ghost" className="relative h-8 w-8 rounded-full">
|
|
<Avatar className="h-8 w-8">
|
|
<AvatarImage src={user.image || ''} alt={user.name || ''} />
|
|
<AvatarFallback>
|
|
{user.name?.[0] || user.email?.[0] || 'A'}
|
|
</AvatarFallback>
|
|
</Avatar>
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent className="w-56" align="end" forceMount>
|
|
<DropdownMenuLabel className="font-normal">
|
|
<div className="flex flex-col space-y-1">
|
|
<p className="text-sm font-medium leading-none">{user.name}</p>
|
|
<p className="text-xs leading-none text-muted-foreground">
|
|
{user.email}
|
|
</p>
|
|
</div>
|
|
</DropdownMenuLabel>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem asChild>
|
|
<Link href="/admin/settings" className="flex items-center">
|
|
<Settings className="mr-2 h-4 w-4" />
|
|
Settings
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem onClick={() => signOut()}>
|
|
<LogOut className="mr-2 h-4 w-4" />
|
|
Log out
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
)
|
|
}
|