侧边栏增加 admin 用户管理入口
admin 用户可在侧边栏底部进入用户管理页, 支持新增/删除用户。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,8 @@ import {
|
||||
Moon,
|
||||
Sun,
|
||||
User,
|
||||
Users,
|
||||
Shield,
|
||||
LogOut,
|
||||
} from 'lucide-react'
|
||||
import { Logo } from './Logo'
|
||||
@@ -92,6 +94,7 @@ export function Layout() {
|
||||
})
|
||||
|
||||
const username = authData?.username
|
||||
const role = authData?.role
|
||||
const navigate = useNavigate()
|
||||
const qc = useQueryClient()
|
||||
const [darkMode, setDarkMode] = useState(() => {
|
||||
@@ -209,6 +212,21 @@ export function Layout() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 用户管理 (admin only) */}
|
||||
{role === 'admin' && (
|
||||
<NavLink
|
||||
to="/settings/users"
|
||||
className={({ isActive }) =>
|
||||
'flex items-center gap-2 px-3 py-1.5 text-xs text-foreground/70 hover:bg-elevated hover:text-foreground transition-colors' +
|
||||
(isActive ? ' bg-accent/10 text-accent' : '')
|
||||
}
|
||||
>
|
||||
<Users className="h-3.5 w-3.5" />
|
||||
<Shield className="h-3 w-3 text-amber-400" />
|
||||
<span className="flex-1">用户管理</span>
|
||||
</NavLink>
|
||||
)}
|
||||
|
||||
{/* 暗夜模式 */}
|
||||
<div className="px-1">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user