templates2.Admin.Next/components/AdminNav.tsx
w4c-templates c64f7ffa9e
Some checks failed
CI / quality (push) Has been cancelled
chore(template): publish Admin.Next
2026-10-11 23:25:34 +03:00

31 lines
993 B
TypeScript

import Link from 'next/link';
import { t } from '@/lib/i18n';
type Item = { href: string; label: string; adminOnly?: boolean };
const ITEMS: Item[] = [
{ href: '/admin', label: t('admin.overview') },
{ href: '/admin/customers', label: t('admin.customers') },
{ href: '/admin/deals', label: t('admin.deals') },
{ href: '/admin/import', label: t('admin.import') },
{ href: '/admin/audit', label: t('admin.audit') },
{ href: '/admin/users', label: t('admin.users'), adminOnly: true },
];
export function AdminNav({ role }: { role: string }) {
const items = ITEMS.filter((item) => !item.adminOnly || role === 'admin');
return (
<nav className="flex flex-wrap gap-1 md:flex-col" aria-label="Admin">
{items.map((item) => (
<Link
key={item.href}
href={item.href}
className="rounded-lg px-3 py-2 text-sm font-medium hover:bg-black/5 dark:hover:bg-white/10"
>
{item.label}
</Link>
))}
</nav>
);
}