Display actual user name in sidebar from MSAL
- Add userName and userEmail props to Sidebar component - Pass user info from MSAL to Sidebar in App.tsx - Replace hardcoded "Steve O'Donoghue" with actual logged-in user 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
04527d65db
commit
6ff69cc308
2 changed files with 15 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ import { useIsAuthenticated, useMsal } from '@azure/msal-react';
|
|||
import { InteractionStatus } from '@azure/msal-browser';
|
||||
import { Hero } from './components/Hero';
|
||||
import { analyzeProof } from './services/geminiService';
|
||||
import { getUserInfo } from './services/authService';
|
||||
import type { AgentReview, AgentName, FlaggedItem, ResolvedItem, ErrorItem } from './types';
|
||||
import { AGENT_NAMES } from './constants';
|
||||
import { Sidebar } from './components/Sidebar';
|
||||
|
|
@ -820,9 +821,17 @@ const App: React.FC = () => {
|
|||
// Determine background color based on view to avoid grey bar on Home view
|
||||
const mainBgColor = currentView === 'Home' ? 'bg-white' : 'bg-brand-gray';
|
||||
|
||||
// Get user info from MSAL for sidebar display
|
||||
const userInfo = getUserInfo(msalInstance);
|
||||
|
||||
return (
|
||||
<div className={`flex h-screen ${mainBgColor} font-sans text-gray-800 overflow-hidden`}>
|
||||
<Sidebar activeItem={currentView} onNavigate={(view) => handleNavigate(view as View)} />
|
||||
<Sidebar
|
||||
activeItem={currentView}
|
||||
onNavigate={(view) => handleNavigate(view as View)}
|
||||
userName={userInfo?.name}
|
||||
userEmail={userInfo?.email}
|
||||
/>
|
||||
<div className="flex-1 flex flex-col overflow-y-auto">
|
||||
<main className="flex-1 flex flex-col min-h-full">
|
||||
{renderContent()}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,11 @@ const navigation = [
|
|||
interface SidebarProps {
|
||||
activeItem: string;
|
||||
onNavigate: (viewName: string) => void;
|
||||
userName?: string;
|
||||
userEmail?: string;
|
||||
}
|
||||
|
||||
export const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate }) => {
|
||||
export const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, userName, userEmail }) => {
|
||||
return (
|
||||
<aside className="w-72 flex-shrink-0 bg-[#0f172a] text-slate-200 flex flex-col border-r border-slate-800 font-sans">
|
||||
{/* Brand Header */}
|
||||
|
|
@ -84,8 +86,8 @@ export const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate }) => {
|
|||
<UserIcon className="h-5 w-5 text-white" />
|
||||
</div>
|
||||
<div className="overflow-hidden">
|
||||
<p className="font-semibold text-sm text-white truncate">Steve O'Donoghue</p>
|
||||
<p className="text-xs text-slate-400 truncate">OLIVER Agency</p>
|
||||
<p className="font-semibold text-sm text-white truncate">{userName || 'Unknown User'}</p>
|
||||
<p className="text-xs text-slate-400 truncate">{userEmail || ''}</p>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue