feat: Refactor admin settings and user management
- Removed Admin Panel from SettingsPage and adjusted related logic. - Added EmailSettings component for SMTP configuration and testing. - Created admin navigation structure in adminNav.js for better organization. - Implemented AdminShell layout for consistent admin UI. - Added RequireAdmin component to protect admin routes. - Developed AdminHomePage for admin dashboard with navigation links. - Created AdminSystemPage for SMTP settings and placeholder metadata export. - Implemented AdminUsersPage for user management, including profile creation and editing.
This commit is contained in:
1 parent
190c0dd7fa
commit
bbc59457ac
11 files changed
+454
-298
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { Outlet, NavLink } from 'react-router-dom'
|
||||
import { ADMIN_NAV_GROUPS } from '../config/adminNav'
|
||||
|
||||
export default function AdminShell() {
|
||||
return (
|
||||
<div className="admin-shell">
|
||||
<div className="admin-shell__layout">
|
||||
<nav className="admin-shell__nav-wrap" aria-label="Adminbereich">
|
||||
<div className="admin-shell__nav-groups">
|
||||
{ADMIN_NAV_GROUPS.map((group) => (
|
||||
<div key={group.id} className="admin-shell__nav-group">
|
||||
<div className="admin-shell__group-title">{group.label}</div>
|
||||
<div className="admin-shell__group-chips">
|
||||
{group.items.map((item) => (
|
||||
<NavLink
|
||||
key={`${group.id}-${item.to}`}
|
||||
to={item.to}
|
||||
end={!!item.end}
|
||||
className={({ isActive }) =>
|
||||
'admin-shell__nav-item' +
|
||||
(isActive ? ' admin-shell__nav-item--active' : '')
|
||||
}
|
||||
>
|
||||
{item.label}
|
||||
</NavLink>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</nav>
|
||||
<div className="admin-shell__main">
|
||||
<div className="admin-page">
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Navigate, Outlet, useLocation } from 'react-router-dom'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
|
||||
export default function RequireAdmin() {
|
||||
const { isAdmin } = useAuth()
|
||||
const loc = useLocation()
|
||||
if (!isAdmin) {
|
||||
return <Navigate to="/" replace state={{ from: loc.pathname, adminDenied: true }} />
|
||||
}
|
||||
return <Outlet />
|
||||
}
|
||||
Reference in new issue
Block a user