GE monogram avatar fallback + per-page document titles
Users without a profile photo (and broken photo URLs) show the GE monogram instead of nothing/initials - sidebar identity, employee detail hero, and the directory list thumbs; the shopfloor cards already did this. Document titles become '<Facility> ShopDB - <Page>' via a router afterEach (facility from public settings, page label from meta.title or a prettified route name with spellings for PCs/USB/GE-Enforce/3D Printed Parts/...), so copied links and browser tabs identify the page.
This commit is contained in:
@@ -42,7 +42,8 @@
|
||||
<div class="user-menu">
|
||||
<template v-if="authStore.isAuthenticated">
|
||||
<div class="user-identity">
|
||||
<img v-if="authStore.avatarUrl" :src="authStore.avatarUrl" class="user-avatar"
|
||||
<img :src="authStore.avatarUrl || fallbackAvatar" class="user-avatar"
|
||||
:class="{ 'ge-avatar-fallback': !authStore.avatarUrl }"
|
||||
:alt="authStore.displayName" @error="onAvatarError" />
|
||||
<div class="user-ident">
|
||||
<div class="username">{{ authStore.displayName }}</div>
|
||||
@@ -245,9 +246,12 @@ async function handleLogout() {
|
||||
router.push('/login')
|
||||
}
|
||||
|
||||
// Hide a broken avatar (photo filename set but file missing).
|
||||
const fallbackAvatar = withBase('/ge-monogram.svg')
|
||||
|
||||
// A broken avatar (photo set but file missing) degrades to the GE monogram.
|
||||
function onAvatarError(event) {
|
||||
event.target.style.display = 'none'
|
||||
event.target.src = fallbackAvatar
|
||||
event.target.classList.add('ge-avatar-fallback')
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -257,6 +261,7 @@ function onAvatarError(event) {
|
||||
.user-menu { display: flex; flex-direction: column; gap: 0.6rem; }
|
||||
.user-identity { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
|
||||
.user-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
|
||||
.ge-avatar-fallback { object-fit: contain; padding: 4px; background: #fff; }
|
||||
.user-ident { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
|
||||
.user-ident .username { margin-bottom: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.user-sso { font-size: 0.72rem; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
|
||||
Reference in New Issue
Block a user