Show DocuSign user initials in avatar
This commit is contained in:
parent
2681d7d5ba
commit
7912eaf252
|
|
@ -133,7 +133,7 @@
|
||||||
<span class="conn-dot"></span>Docusign
|
<span class="conn-dot"></span>Docusign
|
||||||
</button>
|
</button>
|
||||||
<!-- User avatar -->
|
<!-- User avatar -->
|
||||||
<div class="avatar" title="Logged in" aria-label="User">M</div>
|
<div class="avatar" id="topbar-avatar" title="User" aria-label="User">?</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { api } from './api.js';
|
import { api } from './api.js';
|
||||||
import { state, setState } from './state.js';
|
import { state, setState } from './state.js';
|
||||||
import { escHtml } from './utils.js';
|
import { escHtml, initials } from './utils.js';
|
||||||
|
|
||||||
// ── Refresh auth state and update chips ────────────────────────────────────
|
// ── Refresh auth state and update chips ────────────────────────────────────
|
||||||
|
|
||||||
|
|
@ -38,6 +38,20 @@ export function renderAuthChips() {
|
||||||
state.auth.docusignAccountName || 'Docusign',
|
state.auth.docusignAccountName || 'Docusign',
|
||||||
onClickDocusign
|
onClickDocusign
|
||||||
);
|
);
|
||||||
|
renderAvatar();
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderAvatar() {
|
||||||
|
const el = document.getElementById('topbar-avatar');
|
||||||
|
if (!el) return;
|
||||||
|
|
||||||
|
const name = state.auth.docusignLabel && state.auth.docusignLabel !== 'Docusign'
|
||||||
|
? state.auth.docusignLabel
|
||||||
|
: state.auth.docusignAccountName || '';
|
||||||
|
|
||||||
|
el.textContent = name ? initials(name) : '?';
|
||||||
|
el.title = name || 'User';
|
||||||
|
el.setAttribute('aria-label', name ? `User ${name}` : 'User');
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderChip(id, connected, label, onClick) {
|
function renderChip(id, connected, label, onClick) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue