feat: admin settings (accounts, system, notification, audit)

This commit is contained in:
pray4skylark
2026-06-02 16:51:51 +09:00
parent f5899aec46
commit 016b7475f7
10 changed files with 1594 additions and 13 deletions
+44 -13
View File
@@ -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