From 2454886e2d5fcd96a5d54baef6274a5e0bfac889 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Wed, 22 Jul 2026 11:10:06 +0000 Subject: [PATCH] Add name, email and sign out button to sidebar footer Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/components/Layout.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index d751187..251846a 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -1,5 +1,5 @@ import { NavLink } from 'react-router-dom' -import { TrendingUp, Calendar, Globe, BarChart2, Settings, Building2 } from 'lucide-react' +import { TrendingUp, Calendar, Globe, BarChart2, Settings, Building2, LogOut } from 'lucide-react' import { useQuery } from '@tanstack/react-query' import { useAuth } from './AuthGate' import { can } from '../types' @@ -20,6 +20,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('/rates/api/auth/logout', { method: 'POST', credentials: 'include' }) + window.location.reload() + } + const { data: alertCount } = useQuery({ queryKey: ['parity-alert-count'], queryFn: () => api.get('/competitors/parity/alerts?status=active').then(r => r.data.length), @@ -49,7 +54,18 @@ export default function Layout({ children }: { children: ReactNode }) { ))} -
{user.name ?? user.email}
+
+
{user.name}
+
{user.email}
+ +