Merge pull request 'feat(admin): collapsible sidebar nav groups' (#12) from feat/admin-nav-collapse into main
Local Build and Deploy / deploy (push) Successful in 1m7s
Local Build and Deploy / deploy (push) Successful in 1m7s
Reviewed-on: #12
This commit is contained in:
commit
ef0d673cfe
2 files changed
+165
-36
No files matched your search
@@ -5,12 +5,11 @@ import { getTranslations } from "next-intl/server";
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { AdminHubChrome } from "@/components/admin/admin-hub-chrome";
|
import { AdminHubChrome } from "@/components/admin/admin-hub-chrome";
|
||||||
import { AdminMobileWrapper } from "@/components/admin/admin-mobile-wrapper";
|
import { AdminMobileWrapper } from "@/components/admin/admin-mobile-wrapper";
|
||||||
import { AdminNavLink } from "@/components/admin/admin-nav-link";
|
import { AdminSidebarNav } from "@/components/admin/admin-sidebar-nav";
|
||||||
import { AdminTopbar } from "@/components/admin/admin-topbar";
|
import { AdminTopbar } from "@/components/admin/admin-topbar";
|
||||||
import { LanguageSwitcher } from "@/components/language-switcher";
|
import { LanguageSwitcher } from "@/components/language-switcher";
|
||||||
import { ThemeSwitcher } from "@/components/theme-switcher";
|
import { ThemeSwitcher } from "@/components/theme-switcher";
|
||||||
import { requireStaff } from "@/lib/admin/guard";
|
import { requireStaff } from "@/lib/admin/guard";
|
||||||
import { ADMIN_NAV_GROUPS } from "@/lib/admin-nav";
|
|
||||||
import { setCsrfCookie } from "@/lib/foundation/security";
|
import { setCsrfCookie } from "@/lib/foundation/security";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
@@ -94,40 +93,7 @@ async function Sidebar({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav className="flex-1 overflow-y-auto px-3 py-4">
|
<AdminSidebarNav />
|
||||||
{ADMIN_NAV_GROUPS.map((group, gi) => {
|
|
||||||
const GroupIcon = group.icon;
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
key={group.labelKey}
|
|
||||||
className={
|
|
||||||
gi > 0 ? "mt-4 pt-4 border-t border-[var(--admin-border)]" : ""
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-1.5 px-2 pb-2 text-[0.65rem] font-extrabold uppercase tracking-[0.14em] text-[var(--admin-sidebar-text-readable)] opacity-70">
|
|
||||||
<GroupIcon size={14} />
|
|
||||||
<span>{t(group.labelKey)}</span>
|
|
||||||
</div>
|
|
||||||
<div className="space-y-0.5">
|
|
||||||
{group.items.map((item) => {
|
|
||||||
const ItemIcon = item.icon;
|
|
||||||
return (
|
|
||||||
<AdminNavLink
|
|
||||||
key={`${group.labelKey}-${item.href}`}
|
|
||||||
href={item.href}
|
|
||||||
matchPrefixes={item.matchPrefixes}
|
|
||||||
matchExcludePrefixes={item.matchExcludePrefixes}
|
|
||||||
icon={<ItemIcon size={16} />}
|
|
||||||
>
|
|
||||||
{t(item.labelKey)}
|
|
||||||
</AdminNavLink>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div className="px-3 py-3 border-t border-[var(--admin-border)]">
|
<div className="px-3 py-3 border-t border-[var(--admin-border)]">
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user