polish(dashboard): show real ACE role in user chip instead of static 'Property Owner'

This commit is contained in:
tanweer919
2026-07-13 03:03:17 +05:30
parent 86af77c92b
commit f38fa80bde
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -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 }) { export function Sidebar({ active, onSelect }: { active: string; onSelect: (k: string) => void }) {
const router = useRouter(); const router = useRouter();
const { user: me, logout } = useAuth(); const { user: me, logout, context } = useAuth();
const [menuOpen, setMenuOpen] = useState(false); const [menuOpen, setMenuOpen] = useState(false);
// Real signed-in identity from the App Context Envelope; fall back to the static // Real signed-in identity from the App Context Envelope; fall back to the static
// demo user only when the Shell isn't wired. // 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 name = me?.displayName || user.name;
const initials = me ? initialsOf(me.displayName) : user.initials; const initials = me ? initialsOf(me.displayName) : user.initials;
const secondary = me?.email || user.role; const secondary = me?.email || roleLabel || user.role;
async function signOut() { async function signOut() {
setMenuOpen(false); setMenuOpen(false);
+3 -2
View File
@@ -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 // When signed in through the Shell, show the real identity from the App Context
// Envelope; otherwise fall back to the static demo user. // Envelope; otherwise fall back to the static demo user.
const router = useRouter(); const router = useRouter();
const { user: me, logout } = useAuth(); const { user: me, logout, context } = useAuth();
const [menuOpen, setMenuOpen] = useState(false); 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 name = me?.displayName || user.name;
const initials = me ? initialsOf(me.displayName) : user.initials; const initials = me ? initialsOf(me.displayName) : user.initials;
const secondary = me?.email || user.role; const secondary = me?.email || roleLabel || user.role;
async function signOut() { async function signOut() {
setMenuOpen(false); setMenuOpen(false);