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:
jtricerolph 2026-07-22 11:10:09 +00:00
parent 454f34d390
commit d47e6dff40

View file

@ -1,7 +1,7 @@
import { NavLink } from 'react-router-dom'
import {
TrendingUp, BarChart2, Target, History,
Settings, Bot,
Settings, Bot, LogOut,
} from 'lucide-react'
import { useAuth } from './AuthGate'
import { can } from '../types'
@ -21,6 +21,11 @@ export default function Layout({ children }: { children: ReactNode }) {
const { user } = useAuth()
const items = NAV.filter(n => can(user, n.cap))
async function logout() {
await fetch('/forecasting/api/auth/logout', { method: 'POST', credentials: 'include' })
window.location.reload()
}
return (
<div className="app-shell">
<aside className="sidebar">
@ -36,7 +41,18 @@ export default function Layout({ children }: { children: ReactNode }) {
</NavLink>
))}
</nav>
<div className="sidebar-user">{user.name || user.email}</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>
<header className="top-bar">