feat(#112): add admin header bar with back button and logout
AdminLayout gains a self-contained header (Back / Admin / user+logout) with CSS module styles, replacing the inline padding wrapper. Admin pages now render fully without the main app chrome. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { Outlet, useNavigate, useLocation } from 'react-router';
|
||||
import { Tabs } from '@cameleer/design-system';
|
||||
import { ArrowLeft, LogOut } from 'lucide-react';
|
||||
import { useAuthStore } from '../../auth/auth-store';
|
||||
import styles from './AdminLayout.module.css';
|
||||
|
||||
const ADMIN_TABS = [
|
||||
{ label: 'User Management', value: '/admin/rbac' },
|
||||
@@ -13,15 +16,35 @@ const ADMIN_TABS = [
|
||||
export default function AdminLayout() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { username, logout } = useAuthStore();
|
||||
|
||||
const handleBack = () => navigate('/exchanges');
|
||||
const handleLogout = () => {
|
||||
logout();
|
||||
navigate('/login');
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<header className={styles.header}>
|
||||
<button className={styles.backBtn} onClick={handleBack}>
|
||||
<ArrowLeft size={16} />
|
||||
Back
|
||||
</button>
|
||||
<span className={styles.title}>Admin</span>
|
||||
<div className={styles.userSection}>
|
||||
<span className={styles.username}>{username}</span>
|
||||
<button className={styles.logoutBtn} onClick={handleLogout}>
|
||||
<LogOut size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
<Tabs
|
||||
tabs={ADMIN_TABS}
|
||||
active={location.pathname}
|
||||
onChange={(path) => navigate(path)}
|
||||
/>
|
||||
<div style={{ padding: '20px 24px 40px' }}>
|
||||
<div className={styles.content}>
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user