feat: admin settings (accounts, system, notification, audit)
This commit is contained in:
@@ -34,6 +34,7 @@ const Sidebar = ({ isCollapsed }: { isCollapsed?: boolean }) => {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const [isItamOpen, setIsItamOpen] = useState(pathname.startsWith('/itam'));
|
||||
const [isAdminOpen, setIsAdminOpen] = useState(pathname.startsWith('/settings'));
|
||||
const user = useAuthStore((s) => s.user);
|
||||
const role = user?.roleCode;
|
||||
const isMgmt = role === 'MANAGER' || role === 'ADMIN';
|
||||
@@ -209,19 +210,49 @@ const Sidebar = ({ isCollapsed }: { isCollapsed?: boolean }) => {
|
||||
)}
|
||||
|
||||
{role === 'ADMIN' && (
|
||||
<Link
|
||||
href="/settings/codes"
|
||||
className={`flex items-center rounded-xl font-bold text-xs transition-all ${
|
||||
isCollapsed ? 'justify-center py-3' : 'px-3 py-2.5'
|
||||
} ${
|
||||
pathname === '/settings/codes'
|
||||
? 'bg-primary text-white shadow-lg shadow-primary/20'
|
||||
: 'text-text-muted hover:bg-gray-50 hover:text-text-main'
|
||||
}`}
|
||||
>
|
||||
<Settings className={`w-4.5 h-4.5 flex-shrink-0 ${isCollapsed ? '' : 'mr-3'}`} />
|
||||
{!isCollapsed && <span className="whitespace-nowrap">Settings</span>}
|
||||
</Link>
|
||||
<>
|
||||
<button
|
||||
onClick={() => !isCollapsed && setIsAdminOpen(!isAdminOpen)}
|
||||
className={`w-full flex items-center justify-between rounded-xl font-bold text-xs transition-all ${
|
||||
isCollapsed ? 'justify-center py-3' : 'px-3 py-2.5'
|
||||
} ${
|
||||
pathname.startsWith('/settings') && !isCollapsed
|
||||
? 'text-primary'
|
||||
: 'text-text-muted hover:bg-gray-50 hover:text-text-main'
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<Settings className={`w-4.5 h-4.5 flex-shrink-0 ${isCollapsed ? '' : 'mr-3'}`} />
|
||||
{!isCollapsed && <span className="whitespace-nowrap">Admin</span>}
|
||||
</div>
|
||||
{!isCollapsed && (
|
||||
<ChevronDown className={`w-3.5 h-3.5 transition-transform duration-300 ${isAdminOpen ? 'rotate-180' : ''}`} />
|
||||
)}
|
||||
</button>
|
||||
{isAdminOpen && !isCollapsed && (
|
||||
<div className="pl-6 space-y-1 mt-1">
|
||||
{[
|
||||
{ name: 'Codes', href: '/settings/codes', icon: Settings },
|
||||
{ name: 'Accounts', href: '/settings/accounts', icon: Users },
|
||||
{ name: 'System', href: '/settings/system', icon: Monitor },
|
||||
{ name: 'Notification', href: '/settings/notification', icon: FileText },
|
||||
{ name: 'Audit Log', href: '/settings/audit', icon: History },
|
||||
].map((sub) => {
|
||||
const SubIcon = sub.icon;
|
||||
const isActive = pathname === sub.href;
|
||||
return (
|
||||
<Link key={sub.name} href={sub.href}
|
||||
className={`flex items-center gap-2.5 px-3 py-2 rounded-xl text-xs font-bold transition-all ${
|
||||
isActive ? 'bg-primary/10 text-primary' : 'text-text-muted hover:text-text-main'
|
||||
}`}>
|
||||
<SubIcon className="w-3.5 h-3.5" />
|
||||
{sub.name}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
<Link
|
||||
|
||||
Reference in New Issue
Block a user