From f38fa80bde31509c0cfbe3b3be7e4894adc73656 Mon Sep 17 00:00:00 2001 From: tanweer919 Date: Mon, 13 Jul 2026 03:03:17 +0530 Subject: [PATCH] polish(dashboard): show real ACE role in user chip instead of static 'Property Owner' --- src/components/dashboard/sidebar.tsx | 5 +++-- src/components/dashboard/topbar.tsx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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);