diff --git a/src/components/dashboard/sidebar.tsx b/src/components/dashboard/sidebar.tsx index 2da6680..5f90f0d 100644 --- a/src/components/dashboard/sidebar.tsx +++ b/src/components/dashboard/sidebar.tsx @@ -69,13 +69,14 @@ export const NAV_ITEMS: NavItem[] = NAV_GROUPS.flatMap((g) => g.items); export function Sidebar({ active, onSelect }: { active: string; onSelect: (k: string) => void }) { const router = useRouter(); - const { user: me, logout } = useAuth(); + const { user: me, logout, context } = useAuth(); const [menuOpen, setMenuOpen] = useState(false); // Real signed-in identity from the App Context Envelope; fall back to the static // demo user only when the Shell isn't wired. + const roleLabel = context?.scope?.role ? context.scope.role.charAt(0).toUpperCase() + context.scope.role.slice(1) : ""; const name = me?.displayName || user.name; const initials = me ? initialsOf(me.displayName) : user.initials; - const secondary = me?.email || user.role; + const secondary = me?.email || roleLabel || user.role; async function signOut() { setMenuOpen(false); diff --git a/src/components/dashboard/topbar.tsx b/src/components/dashboard/topbar.tsx index bec737f..b348cc0 100644 --- a/src/components/dashboard/topbar.tsx +++ b/src/components/dashboard/topbar.tsx @@ -15,11 +15,12 @@ export function Topbar({ theme, onToggle, title, subtitle }: { theme: "dark" | " // When signed in through the Shell, show the real identity from the App Context // Envelope; otherwise fall back to the static demo user. const router = useRouter(); - const { user: me, logout } = useAuth(); + const { user: me, logout, context } = useAuth(); const [menuOpen, setMenuOpen] = useState(false); + const roleLabel = context?.scope?.role ? context.scope.role.charAt(0).toUpperCase() + context.scope.role.slice(1) : ""; const name = me?.displayName || user.name; const initials = me ? initialsOf(me.displayName) : user.initials; - const secondary = me?.email || user.role; + const secondary = me?.email || roleLabel || user.role; async function signOut() { setMenuOpen(false);