'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { cn } from '@/lib/utils';
import LogoutButton from './LogoutButton';
interface SidebarProps {
showUsers: boolean; // true if user has membership.view permission
}
function ServerIcon({ active }: { active: boolean }) {
return (
);
}
function UsersIcon({ active }: { active: boolean }) {
return (
);
}
function ActivityLogIcon({ active }: { active: boolean }) {
return (
);
}
export function Sidebar({ showUsers }: SidebarProps) {
const pathname = usePathname();
const isServers = pathname === '/dashboard' || pathname.startsWith('/dashboard/server');
const isUsers = pathname.startsWith('/dashboard/membership');
const isActivityLog = pathname.startsWith('/dashboard/activity-log');
const navItems = [
{
href: '/dashboard',
label: 'Servers',
active: isServers,
icon:
},
{
href: '/dashboard/activity-log',
label: 'Activity Log',
active: isActivityLog,
icon:
},
...(showUsers
? [
{
href: '/dashboard/membership',
label: 'Users',
active: isUsers,
icon:
}
]
: [])
];
return (
<>
>
);
}