Andrey Epifancev 1590302b79 AURORA-1690: названия ролей в блоке пользователя (role_details в /me)
GET /me дополнен role_details [{code, name}] (аддитивно), фронт показывает
названия ролей, при их отсутствии — коды. Требования внесены в спеки
authn-authz и consolidations-ui, change 184-user-role удалён.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:11:28 +04:00

27 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Popover } from 'antd';
import { useCurrentUser } from '../../auth/MeContext';
import { Logo } from '../../components/Logo';
import { userInfoRows } from './userInfo';
/** Логотип «АРМ КА»; по клику раскрывается блок с текущим пользователем и его ролями (`GET /me`). */
export function UserMenu({ compact = false }: { compact?: boolean }) {
const me = useCurrentUser();
const content = (
<dl style={{ margin: 0, minWidth: 220 }} data-testid='user-info'>
{userInfoRows(me).map((r) => (
<div key={r.label} style={{ display: 'flex', gap: 8, padding: '2px 0' }}>
<dt style={{ color: 'rgba(55, 65, 81, 0.6)', width: 110, flexShrink: 0 }}>{r.label}</dt>
<dd style={{ margin: 0, fontWeight: 500, wordBreak: 'break-word' }}>{r.value}</dd>
</div>
))}
</dl>
);
return (
<Popover trigger='click' placement='bottomLeft' content={content}>
<button type='button' title='Текущий пользователь' style={{ background: 'none', border: 0, padding: 0, cursor: 'pointer' }}>
<Logo compact={compact} />
</button>
</Popover>
);
}