Add name, email and sign out button to sidebar footer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3000e227a3
commit
24c6fa1f7d
1 changed files with 17 additions and 1 deletions
|
|
@ -9,6 +9,11 @@ export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
const { user } = useAuth()
|
const { user } = useAuth()
|
||||||
const hasCap = (cap: string) => can(user, cap)
|
const hasCap = (cap: string) => can(user, cap)
|
||||||
|
|
||||||
|
async function logout() {
|
||||||
|
await fetch('/room-planner/api/auth/logout', { method: 'POST', credentials: 'include' })
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="app-shell">
|
<div className="app-shell">
|
||||||
{/* Desktop sidebar */}
|
{/* Desktop sidebar */}
|
||||||
|
|
@ -29,7 +34,18 @@ export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
</NavLink>
|
</NavLink>
|
||||||
)}
|
)}
|
||||||
</nav>
|
</nav>
|
||||||
<div className="sidebar-user">{user.name}</div>
|
<div className="sidebar-user" style={{ whiteSpace: 'normal' }}>
|
||||||
|
<div style={{ fontWeight: 600, color: 'var(--text)', fontSize: '12px', marginBottom: '2px' }}>{user.name}</div>
|
||||||
|
<div style={{ fontSize: '11px', marginBottom: '8px' }}>{user.email}</div>
|
||||||
|
<button onClick={logout} style={{
|
||||||
|
display: 'flex', alignItems: 'center', gap: '6px',
|
||||||
|
background: 'none', border: 'none', color: 'inherit',
|
||||||
|
fontSize: '12px', padding: 0, cursor: 'pointer',
|
||||||
|
}}>
|
||||||
|
<LogOut size={13} strokeWidth={1.75} />
|
||||||
|
Sign out
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<main className="page-content">
|
<main className="page-content">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue