first commit
This commit is contained in:
53
frontend/components/admin/AdminHeader.tsx
Normal file
53
frontend/components/admin/AdminHeader.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
"use client"
|
||||
|
||||
import { useSession, signOut } from "next-auth/react"
|
||||
import { ModeToggle } from "@/components/ui/mode-toggle"
|
||||
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 { LogOut, User } from "lucide-react"
|
||||
|
||||
export function AdminHeader() {
|
||||
const { data: session } = useSession()
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-30 flex h-16 items-center gap-4 border-b bg-background px-6 shadow-sm">
|
||||
<div className="flex flex-1 items-center gap-4">
|
||||
<h1 className="text-lg font-semibold md:text-xl">Yönetici Paneli</h1>
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<ModeToggle />
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="rounded-full">
|
||||
<Avatar>
|
||||
<AvatarImage src={session?.user?.image || ""} alt={session?.user?.name || "Admin"} />
|
||||
<AvatarFallback>{session?.user?.name?.[0]?.toUpperCase() || "A"}</AvatarFallback>
|
||||
</Avatar>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuLabel>Hesabım</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem disabled>
|
||||
<User className="mr-2 h-4 w-4" />
|
||||
<span>Profil</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={() => signOut({ callbackUrl: "/auth/login" })}>
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
<span>Çıkış Yap</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</header>
|
||||
)
|
||||
}
|
||||
105
frontend/components/admin/AdminSidebar.tsx
Normal file
105
frontend/components/admin/AdminSidebar.tsx
Normal file
@@ -0,0 +1,105 @@
|
||||
"use client"
|
||||
|
||||
import Link from "next/link"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { cn } from "@/lib/utils"
|
||||
import {
|
||||
LayoutDashboard,
|
||||
Users,
|
||||
ShoppingBag,
|
||||
Settings,
|
||||
Package,
|
||||
FileText,
|
||||
Tag,
|
||||
List,
|
||||
Image // Import Image icon
|
||||
} from "lucide-react"
|
||||
|
||||
const sidebarItems = [
|
||||
{
|
||||
title: "Dashboard",
|
||||
href: "/admin",
|
||||
icon: LayoutDashboard,
|
||||
},
|
||||
{
|
||||
title: "Kullanıcılar",
|
||||
href: "/admin/users",
|
||||
icon: Users,
|
||||
},
|
||||
{
|
||||
title: "Ürünler",
|
||||
href: "/admin/products",
|
||||
icon: Package,
|
||||
},
|
||||
{
|
||||
title: "Siparişler",
|
||||
href: "/admin/orders",
|
||||
icon: ShoppingBag,
|
||||
},
|
||||
{
|
||||
title: "Blog Yazıları",
|
||||
href: "/admin/posts",
|
||||
icon: FileText,
|
||||
},
|
||||
{
|
||||
title: "Kategoriler",
|
||||
href: "/admin/categories",
|
||||
icon: List, // Using List icon for categories, need to import it
|
||||
},
|
||||
{
|
||||
title: "Tags",
|
||||
href: "/admin/tags",
|
||||
icon: Tag,
|
||||
},
|
||||
{
|
||||
title: "Hero Banner",
|
||||
href: "/admin/heroes",
|
||||
icon: Image,
|
||||
},
|
||||
{
|
||||
title: "Ayarlar",
|
||||
href: "/admin/settings",
|
||||
icon: Settings,
|
||||
},
|
||||
]
|
||||
|
||||
export function AdminSidebar() {
|
||||
const pathname = usePathname()
|
||||
|
||||
return (
|
||||
<div className="hidden border-r bg-muted/40 md:block w-64 min-h-screen">
|
||||
<div className="flex h-full max-h-screen flex-col gap-2">
|
||||
<div className="flex h-16 items-center border-b px-6">
|
||||
<Link href="/" className="flex items-center gap-2 font-semibold">
|
||||
<Package className="h-6 w-6" />
|
||||
<span className="">E-Ticaret Admin</span>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="flex-1 overflow-auto py-2">
|
||||
<nav className="grid items-start px-4 text-sm font-medium">
|
||||
{sidebarItems.map((item) => {
|
||||
const Icon = item.icon
|
||||
const isActive = pathname === item.href
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className={cn(
|
||||
"flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",
|
||||
isActive
|
||||
? "bg-muted text-primary"
|
||||
: "text-muted-foreground"
|
||||
)}
|
||||
>
|
||||
<Icon className="h-4 w-4" />
|
||||
{item.title}
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user