changes
This commit is contained in:
1 parent
a99af426db
commit
8886aa8640
91 files changed
+2823
-773
No files matched your search
@@ -33,6 +33,7 @@ import {
|
||||
} from "@/components/ui/sidebar";
|
||||
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
|
||||
import { LogoutButton } from "@/components/organisms/admin/LogoutButton";
|
||||
import { isAdminEntityEnabled } from "@/lib/admin/disabled-entities";
|
||||
|
||||
const NAV_GROUPS = [
|
||||
{
|
||||
@@ -42,27 +43,39 @@ const NAV_GROUPS = [
|
||||
{
|
||||
label: "محتوا",
|
||||
items: [
|
||||
{ href: "/admin/courses", label: "دورهها", icon: BookOpen },
|
||||
{ href: "/admin/programs", label: "برنامهها", icon: GraduationCap },
|
||||
{ href: "/admin/events", label: "رویدادها", icon: Calendar },
|
||||
{ href: "/admin/articles", label: "مقالات", icon: Newspaper },
|
||||
{ href: "/admin/topics", label: "موضوعات", icon: Tags },
|
||||
{ href: "/admin/courses", label: "دورهها", icon: BookOpen, entity: "courses" },
|
||||
{
|
||||
href: "/admin/course-categories",
|
||||
label: "دستهبندی دورهها",
|
||||
icon: Tags,
|
||||
entity: "course-categories",
|
||||
},
|
||||
{
|
||||
href: "/admin/course-tags",
|
||||
label: "تگهای دوره",
|
||||
icon: Tags,
|
||||
entity: "course-tags",
|
||||
},
|
||||
{ href: "/admin/programs", label: "برنامهها", icon: GraduationCap, entity: "programs" },
|
||||
{ href: "/admin/events", label: "رویدادها", icon: Calendar, entity: "events" },
|
||||
{ href: "/admin/articles", label: "مقالات", icon: Newspaper, entity: "articles" },
|
||||
{ href: "/admin/topics", label: "موضوعات", icon: Tags, entity: "topics" },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "جامعه",
|
||||
items: [
|
||||
{ href: "/admin/faculty", label: "اساتید", icon: Users },
|
||||
{ href: "/admin/alumni", label: "دانشآموختگان", icon: MessageSquareQuote },
|
||||
{ href: "/admin/faculty", label: "اساتید", icon: Users, entity: "faculty" },
|
||||
{ href: "/admin/alumni", label: "دانشآموختگان", icon: MessageSquareQuote, entity: "alumni" },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "سایت",
|
||||
items: [
|
||||
{ href: "/admin/banners", label: "بنرهای کمپین", icon: Megaphone },
|
||||
{ href: "/admin/stats", label: "آمار", icon: BarChart3 },
|
||||
{ href: "/admin/testimonials", label: "نظرات", icon: FileText },
|
||||
{ href: "/admin/legal", label: "صفحات قانونی", icon: Scale },
|
||||
{ href: "/admin/banners", label: "بنرهای کمپین", icon: Megaphone, entity: "banners" },
|
||||
{ href: "/admin/stats", label: "آمار", icon: BarChart3, entity: "stats" },
|
||||
{ href: "/admin/testimonials", label: "نظرات", icon: FileText, entity: "testimonials" },
|
||||
{ href: "/admin/legal", label: "صفحات قانونی", icon: Scale, entity: "legal" },
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -117,35 +130,43 @@ export function AdminSidebar({ userName }: { userName: string }) {
|
||||
</SidebarHeader>
|
||||
|
||||
<SidebarContent>
|
||||
{NAV_GROUPS.map((group) => (
|
||||
<SidebarGroup key={group.label}>
|
||||
<SidebarGroupLabel>{group.label}</SidebarGroupLabel>
|
||||
<SidebarGroupContent>
|
||||
<SidebarMenu>
|
||||
{group.items.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const active = isActive(
|
||||
pathname,
|
||||
item.href,
|
||||
"exact" in item ? item.exact : false,
|
||||
);
|
||||
return (
|
||||
<SidebarMenuItem key={item.href}>
|
||||
<SidebarMenuButton
|
||||
isActive={active}
|
||||
tooltip={item.label}
|
||||
render={<Link href={item.href} />}
|
||||
>
|
||||
<Icon />
|
||||
<span>{item.label}</span>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
);
|
||||
})}
|
||||
</SidebarMenu>
|
||||
</SidebarGroupContent>
|
||||
</SidebarGroup>
|
||||
))}
|
||||
{NAV_GROUPS.map((group) => {
|
||||
const items = group.items.filter(
|
||||
(item) =>
|
||||
!("entity" in item) ||
|
||||
isAdminEntityEnabled(item.entity),
|
||||
);
|
||||
if (items.length === 0) return null;
|
||||
return (
|
||||
<SidebarGroup key={group.label}>
|
||||
<SidebarGroupLabel>{group.label}</SidebarGroupLabel>
|
||||
<SidebarGroupContent>
|
||||
<SidebarMenu>
|
||||
{items.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const active = isActive(
|
||||
pathname,
|
||||
item.href,
|
||||
"exact" in item ? item.exact : false,
|
||||
);
|
||||
return (
|
||||
<SidebarMenuItem key={item.href}>
|
||||
<SidebarMenuButton
|
||||
isActive={active}
|
||||
tooltip={item.label}
|
||||
render={<Link href={item.href} />}
|
||||
>
|
||||
<Icon />
|
||||
<span>{item.label}</span>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
);
|
||||
})}
|
||||
</SidebarMenu>
|
||||
</SidebarGroupContent>
|
||||
</SidebarGroup>
|
||||
);
|
||||
})}
|
||||
</SidebarContent>
|
||||
|
||||
<SidebarFooter className="p-3">
|
||||
|
||||
Reference in new issue
Block a user