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
@@ -1,10 +1,9 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Save, Download, Upload, Trash2, Plus, Check, Pencil, X, LogOut, Shield, Key, BarChart3 } from 'lucide-react'
|
||||
import { Save, Download, Upload, Trash2, Plus, Check, Pencil, X, LogOut, Key, BarChart3 } from 'lucide-react'
|
||||
import { useProfile } from '../context/ProfileContext'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import { Avatar } from './ProfileSelect'
|
||||
import { api } from '../utils/api'
|
||||
import AdminPanel from './AdminPanel'
|
||||
import FeatureUsageOverview from '../components/FeatureUsageOverview'
|
||||
import UsageBadge from '../components/UsageBadge'
|
||||
|
||||
@@ -96,8 +95,7 @@ function ProfileForm({ profile, onSave, onCancel, title }) {
|
||||
|
||||
export default function SettingsPage() {
|
||||
const { profiles, activeProfile, setActiveProfile, refreshProfiles } = useProfile()
|
||||
const { logout, isAdmin, canExport } = useAuth()
|
||||
const [adminOpen, setAdminOpen] = useState(false)
|
||||
const { logout, canExport } = useAuth()
|
||||
const [pinOpen, setPinOpen] = useState(false)
|
||||
const [newPin, setNewPin] = useState('')
|
||||
const [pinMsg, setPinMsg] = useState(null)
|
||||
@@ -375,22 +373,6 @@ export default function SettingsPage() {
|
||||
<FeatureUsageOverview />
|
||||
</div>
|
||||
|
||||
{/* Admin Panel */}
|
||||
{isAdmin && (
|
||||
<div className="card section-gap">
|
||||
<div style={{display:'flex',alignItems:'center',justifyContent:'space-between'}}>
|
||||
<div className="card-title" style={{margin:0,display:'flex',alignItems:'center',gap:6}}>
|
||||
<Shield size={15} color="var(--accent)"/> Admin
|
||||
</div>
|
||||
<button className="btn btn-secondary" style={{fontSize:12}}
|
||||
onClick={()=>setAdminOpen(o=>!o)}>
|
||||
{adminOpen?'Schließen':'Öffnen'}
|
||||
</button>
|
||||
</div>
|
||||
{adminOpen && <div style={{marginTop:12}}><AdminPanel/></div>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Export */}
|
||||
<div className="card section-gap">
|
||||
<div className="card-title">Daten exportieren</div>
|
||||
|
||||
Reference in new issue
Block a user