polish(dashboard): show real ACE role in user chip instead of static 'Property Owner'
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user