feat(userVignette): add external badge when needed

This commit is contained in:
Edouard Vanbelle
2026-06-02 12:39:18 +02:00
parent cdd62c29b5
commit 074ca33e1d
4 changed files with 130 additions and 68 deletions
+11 -8
View File
@@ -49,14 +49,6 @@ export function createPendingEmailVignette(email, size = 'sm') {
const [local, domain] = trimmed.split('@');
const synthName = local && domain ? `${local[0]} ${domain[0]}` : trimmed.slice(0, 2);
avatar.textContent = _initials(synthName);
// Forced external badge — this is the whole point of the component.
const badge = document.createElement('i');
badge.className = 'user-vignette__origin user-vignette__origin--external fa-solid fa-building-circle-xmark';
badge.title = 'External invitation';
badge.setAttribute('aria-hidden', 'true');
avatar.appendChild(badge);
wrapper.appendChild(avatar);
// The "name" for a pending invite is just the email itself — there
@@ -66,5 +58,16 @@ export function createPendingEmailVignette(email, size = 'sm') {
nameEl.textContent = trimmed;
wrapper.appendChild(nameEl);
// Forced external badge — this is the whole point of the component.
// Lives as a sibling at the end of the wrapper (mirrors the
// userVignette layout) so it stays visible regardless of avatar
// content (initials today, possibly a photo in a future "saved
// email contact" mode).
const badge = document.createElement('i');
badge.className = 'user-vignette__origin user-vignette__origin--external fa-solid fa-building-circle-xmark';
badge.title = 'External invitation';
badge.setAttribute('aria-hidden', 'true');
wrapper.appendChild(badge);
return wrapper;
}