Skip to content

Commit 29d8012

Browse files
committed
feat: improvement of user name display
1 parent e4521d8 commit 29d8012

File tree

7 files changed

+153
-100
lines changed

7 files changed

+153
-100
lines changed

webapp/src/components/layout/AppHeader.vue

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,64 @@ const isAuthenticated = computed(() => authStore.isAuthenticated)
2222
const isAdmin = computed(() => authStore.isAdmin)
2323
const user = computed(() => authStore.user)
2424
25+
// Extract name parts from email (before @, split by . - _)
26+
function extractNamePartsFromEmail(email: string): string[] {
27+
const localPart = email.split('@')[0] || ''
28+
return localPart.split(/[.\-_]+/).filter(p => p.length > 0)
29+
}
30+
31+
// Capitalize first letter of a string
32+
function capitalize(str: string): string {
33+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()
34+
}
35+
36+
// Display name (for menu and header)
37+
const displayName = computed(() => {
38+
// If user has a real name that's not just the email, use it
39+
if (user.value?.name && user.value.name !== user.value.email) {
40+
return user.value.name
41+
}
42+
// Otherwise extract from email
43+
if (user.value?.email) {
44+
const parts = extractNamePartsFromEmail(user.value.email)
45+
if (parts.length > 0) {
46+
return parts.map(capitalize).join(' ')
47+
}
48+
}
49+
return user.value?.email || ''
50+
})
51+
2552
// User initials for avatar
2653
const userInitials = computed(() => {
2754
if (!user.value?.name && !user.value?.email) return '?'
28-
const name = user.value.name || user.value.email || ''
29-
const parts = name.split(/[\s@]+/).filter(p => p.length > 0)
30-
if (parts.length >= 2) {
31-
const first = parts[0] ?? ''
32-
const second = parts[1] ?? ''
33-
if (first.length > 0 && second.length > 0) {
55+
56+
// If user has a real name, use it for initials
57+
if (user.value?.name && user.value.name !== user.value.email) {
58+
const nameParts = user.value.name.split(/\s+/).filter(p => p.length > 0)
59+
if (nameParts.length >= 2) {
60+
const first = nameParts[0] ?? ''
61+
const second = nameParts[1] ?? ''
62+
return (first.charAt(0) + second.charAt(0)).toUpperCase()
63+
}
64+
return user.value.name.slice(0, 2).toUpperCase()
65+
}
66+
67+
// Extract from email
68+
if (user.value?.email) {
69+
const parts = extractNamePartsFromEmail(user.value.email)
70+
if (parts.length >= 2) {
71+
// nom.prenom@ or prenom.nom@ → 2 initials
72+
const first = parts[0] ?? ''
73+
const second = parts[1] ?? ''
3474
return (first.charAt(0) + second.charAt(0)).toUpperCase()
3575
}
76+
if (parts.length === 1 && parts[0]) {
77+
// Single word → 1 initial only
78+
return parts[0].charAt(0).toUpperCase()
79+
}
3680
}
37-
return name.slice(0, 2).toUpperCase()
81+
82+
return '?'
3883
})
3984
4085
const isActive = (path: string) => {
@@ -122,7 +167,7 @@ const closeUserMenu = () => {
122167
<div class="w-8 h-8 rounded-lg bg-slate-100 dark:bg-slate-700 flex items-center justify-center text-xs font-semibold text-slate-600 dark:text-slate-300">
123168
{{ userInitials }}
124169
</div>
125-
<span class="text-slate-700 dark:text-slate-200 hidden lg:inline">{{ user?.name || user?.email?.split('@')[0] }}</span>
170+
<span class="text-slate-700 dark:text-slate-200 hidden lg:inline">{{ displayName }}</span>
126171
<ChevronDown :size="16" class="text-slate-400" />
127172
</button>
128173

@@ -146,7 +191,7 @@ const closeUserMenu = () => {
146191
<div class="p-2">
147192
<!-- User info -->
148193
<div class="px-3 py-2 border-b border-slate-100 dark:border-slate-700 mb-2">
149-
<p class="font-medium text-slate-900 dark:text-slate-100">{{ user?.name }}</p>
194+
<p class="font-medium text-slate-900 dark:text-slate-100">{{ displayName }}</p>
150195
<p class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ user?.email }}</p>
151196
</div>
152197

@@ -256,7 +301,7 @@ const closeUserMenu = () => {
256301
<!-- User section -->
257302
<div class="border-t border-slate-200 dark:border-slate-700 pt-3 mt-3">
258303
<div class="px-3 py-2 mb-2">
259-
<p class="font-medium text-slate-900 dark:text-slate-100">{{ user?.name }}</p>
304+
<p class="font-medium text-slate-900 dark:text-slate-100">{{ displayName }}</p>
260305
<p class="text-xs text-slate-500 dark:text-slate-400">{{ user?.email }}</p>
261306
</div>
262307
<button

webapp/src/locales/de.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@
5555
},
5656
"sign": {
5757
"title": "Lesebestätigung",
58-
"subtitle": "Bestätigen Sie Ihre Lektüre mit einer kryptografischen Ed25519-Bestätigung",
58+
"subtitle": "Bestätigen Sie Ihre Lektüre mit einer sicheren und unwiderruflichen Bestätigung",
5959
"loading": {
6060
"title": "Dokument wird geladen...",
61-
"description": "Bitte warten Sie, während wir das Dokument zur Signatur vorbereiten."
61+
"description": "Bitte warten Sie, während wir das Dokument vorbereiten."
6262
},
6363
"noDocument": {
6464
"title": "Kein Dokument angegeben",
65-
"description": "Um ein Dokument zu signieren, fügen Sie den Parameter {code} zur URL hinzu",
66-
"examples": "Beispiele:"
65+
"description": "Um die Lektüre eines Dokuments zu bestätigen, fügen Sie den Parameter {code} zur URL hinzu",
66+
"examples": "Beispiele:",
67+
"orEnterReference": "Oder geben Sie Ihre Dokumentenreferenz unten ein"
6768
},
6869
"success": {
6970
"title": "Lektüre erfolgreich bestätigt!",
@@ -87,7 +88,7 @@
8788
"recorded": "Ihre Bestätigung wird mit den folgenden Informationen aufgezeichnet:",
8889
"email": "Ihre E-Mail-Adresse",
8990
"timestamp": "Präziser Zeitstempel der Bestätigung",
90-
"signature": "Kryptografische Ed25519-Bestätigung",
91+
"signature": "Sicherer kryptografischer Fingerabdruck",
9192
"hash": "SHA-256-Hash des Inhalts"
9293
},
9394
"confirmations": {
@@ -101,7 +102,7 @@
101102
},
102103
"howItWorks": {
103104
"title": "Wie funktioniert es?",
104-
"subtitle": "Ackify ermöglicht es Ihnen, kryptografisch zu beweisen, dass Sie ein Dokument gelesen haben",
105+
"subtitle": "Ackify ermöglicht es Ihnen, offiziell zu bezeugen, dass Sie ein Dokument gelesen haben",
105106
"step1": {
106107
"title": "1. Auf das Dokument zugreifen",
107108
"description": "Fügen Sie {code} zur Adresse dieser Seite hinzu"
@@ -112,12 +113,12 @@
112113
},
113114
"step3": {
114115
"title": "3. Lektüre bestätigen",
115-
"description": "Ihre Bestätigung wird mit einer Ed25519-Signatur aufgezeichnet"
116+
"description": "Ihre Bestätigung wird sicher und überprüfbar aufgezeichnet"
116117
},
117118
"features": {
118119
"crypto": {
119120
"title": "Kryptografische Sicherheit",
120-
"description": "Unwiderrufliche Ed25519-Signaturen garantieren die Authentizität"
121+
"description": "Unwiderrufliche Bestätigungen garantieren die Authentizität"
121122
},
122123
"instant": {
123124
"title": "Sofort",
@@ -206,7 +207,7 @@
206207
"allConfirmations": "Alle meine Bestätigungen",
207208
"about": {
208209
"title": "Über Bestätigungen",
209-
"description": "Jede Bestätigung wird kryptografisch mit Ed25519 aufgezeichnet und verkettet, um die Integrität zu gewährleisten. Bestätigungen sind unwiderruflich und präzise mit Zeitstempel versehen."
210+
"description": "Jede Bestätigung wird kryptografisch aufgezeichnet und verkettet, um die Integrität zu gewährleisten. Bestätigungen sind unwiderruflich und präzise mit Zeitstempel versehen."
210211
},
211212
"search": "Suchen...",
212213
"error": {
@@ -447,17 +448,17 @@
447448
}
448449
},
449450
"embed": {
450-
"loading": "Signaturinformationen werden geladen...",
451-
"title": "Signatur für",
451+
"loading": "Bestätigungsinformationen werden geladen...",
452+
"title": "Bestätigung für",
452453
"document": "Dokument:",
453-
"signedBy": "Signiert von",
454+
"signedBy": "Bestätigt von",
454455
"on": "am",
455456
"verified": "Verifiziert",
456457
"viewAll": "Alle Bestätigungen ansehen",
457-
"error": "Signaturinformationen können nicht geladen werden",
458-
"sign": "Signieren",
459-
"signDocument": "Dieses Dokument signieren",
460-
"noSignatures": "Keine Signatur für dieses Dokument",
458+
"error": "Bestätigungsinformationen können nicht geladen werden",
459+
"sign": "Bestätigen",
460+
"signDocument": "Dieses Dokument bestätigen",
461+
"noSignatures": "Keine Bestätigung für dieses Dokument",
461462
"confirmationsCount": "{count} Bestätigung(en)",
462463
"poweredBy": "Powered by Ackify",
463464
"missingDocId": "Dokument-ID fehlt"
@@ -468,7 +469,7 @@
468469
"home": "Zurück zur Startseite"
469470
},
470471
"footer": {
471-
"description": "Open-Source-Lösung für kryptografische Dokumentlesebestätigung mit unwiderruflichen Ed25519-Signaturen.",
472+
"description": "Open-Source-Lösung für kryptografische Dokumentlesebestätigung mit unwiderruflichen Attestierungen.",
472473
"navigation": {
473474
"title": "Navigation"
474475
},

webapp/src/locales/en.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@
5555
},
5656
"sign": {
5757
"title": "Reading Confirmation",
58-
"subtitle": "Certify your reading with an Ed25519 cryptographic confirmation",
58+
"subtitle": "Certify your reading with a secure and non-repudiable confirmation",
5959
"loading": {
6060
"title": "Loading document...",
61-
"description": "Please wait while we prepare the document for signing."
61+
"description": "Please wait while we prepare the document."
6262
},
6363
"noDocument": {
6464
"title": "No document specified",
65-
"description": "To sign a document, add the {code} parameter to the URL",
66-
"examples": "Examples:"
65+
"description": "To confirm reading a document, add the {code} parameter to the URL",
66+
"examples": "Examples:",
67+
"orEnterReference": "Or enter your document reference below"
6768
},
6869
"success": {
6970
"title": "Reading confirmed successfully!",
@@ -87,7 +88,7 @@
8788
"recorded": "Your confirmation will be recorded with the following information:",
8889
"email": "Your email address",
8990
"timestamp": "Precise confirmation timestamp",
90-
"signature": "Ed25519 cryptographic confirmation",
91+
"signature": "Secure cryptographic fingerprint",
9192
"hash": "SHA-256 hash of the content"
9293
},
9394
"confirmations": {
@@ -101,7 +102,7 @@
101102
},
102103
"howItWorks": {
103104
"title": "How does it work?",
104-
"subtitle": "Ackify allows you to cryptographically prove that you've read a document",
105+
"subtitle": "Ackify allows you to officially attest that you've read a document",
105106
"step1": {
106107
"title": "1. Access the document",
107108
"description": "Add {code} to this page's address"
@@ -112,12 +113,12 @@
112113
},
113114
"step3": {
114115
"title": "3. Confirm reading",
115-
"description": "Your confirmation is recorded with an Ed25519 signature"
116+
"description": "Your confirmation is recorded securely and verifiably"
116117
},
117118
"features": {
118119
"crypto": {
119120
"title": "Cryptographic security",
120-
"description": "Non-repudiable Ed25519 signatures guaranteeing authenticity"
121+
"description": "Non-repudiable confirmations guaranteeing authenticity"
121122
},
122123
"instant": {
123124
"title": "Instant",
@@ -206,7 +207,7 @@
206207
"allConfirmations": "All my confirmations",
207208
"about": {
208209
"title": "About confirmations",
209-
"description": "Each confirmation is cryptographically recorded with Ed25519 and chained to ensure integrity. Confirmations are non-repudiable and precisely timestamped."
210+
"description": "Each confirmation is cryptographically recorded and chained to ensure integrity. Confirmations are non-repudiable and precisely timestamped."
210211
},
211212
"search": "Search...",
212213
"error": {
@@ -447,17 +448,17 @@
447448
}
448449
},
449450
"embed": {
450-
"loading": "Loading signature information...",
451-
"title": "Signature for",
451+
"loading": "Loading confirmation information...",
452+
"title": "Confirmation for",
452453
"document": "Document:",
453-
"signedBy": "Signed by",
454+
"signedBy": "Confirmed by",
454455
"on": "on",
455456
"verified": "Verified",
456457
"viewAll": "View all confirmations",
457-
"error": "Unable to load signature information",
458-
"sign": "Sign",
459-
"signDocument": "Sign this document",
460-
"noSignatures": "No signatures for this document",
458+
"error": "Unable to load confirmation information",
459+
"sign": "Confirm",
460+
"signDocument": "Confirm this document",
461+
"noSignatures": "No confirmations for this document",
461462
"confirmationsCount": "{count} confirmation(s)",
462463
"poweredBy": "Powered by Ackify",
463464
"missingDocId": "Document ID missing"
@@ -468,7 +469,7 @@
468469
"home": "Back to home"
469470
},
470471
"footer": {
471-
"description": "Open-source solution for cryptographic confirmation of document reading with non-repudiable Ed25519 signatures.",
472+
"description": "Open-source solution for cryptographic confirmation of document reading with non-repudiable attestations.",
472473
"navigation": {
473474
"title": "Navigation"
474475
},

webapp/src/locales/es.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@
5555
},
5656
"sign": {
5757
"title": "Confirmación de Lectura",
58-
"subtitle": "Certifique su lectura con una confirmación criptográfica Ed25519",
58+
"subtitle": "Certifique su lectura con una confirmación segura e irrefutable",
5959
"loading": {
6060
"title": "Cargando el documento...",
61-
"description": "Por favor, espere mientras preparamos el documento para la firma."
61+
"description": "Por favor, espere mientras preparamos el documento."
6262
},
6363
"noDocument": {
6464
"title": "Ningún documento especificado",
65-
"description": "Para firmar un documento, añada el parámetro {code} a la URL",
66-
"examples": "Ejemplos:"
65+
"description": "Para confirmar la lectura de un documento, añada el parámetro {code} a la URL",
66+
"examples": "Ejemplos:",
67+
"orEnterReference": "O introduzca su referencia documental a continuación"
6768
},
6869
"success": {
6970
"title": "¡Lectura confirmada con éxito!",
@@ -87,7 +88,7 @@
8788
"recorded": "Su confirmación será registrada con la siguiente información:",
8889
"email": "Su dirección de email",
8990
"timestamp": "Marca de tiempo precisa de la confirmación",
90-
"signature": "Confirmación criptográfica Ed25519",
91+
"signature": "Huella criptográfica segura",
9192
"hash": "Hash SHA-256 del contenido"
9293
},
9394
"confirmations": {
@@ -101,7 +102,7 @@
101102
},
102103
"howItWorks": {
103104
"title": "¿Cómo funciona?",
104-
"subtitle": "Ackify le permite probar criptográficamente que ha leído un documento",
105+
"subtitle": "Ackify le permite atestiguar oficialmente que ha leído un documento",
105106
"step1": {
106107
"title": "1. Acceda al documento",
107108
"description": "Añada {code} a la dirección de esta página"
@@ -112,12 +113,12 @@
112113
},
113114
"step3": {
114115
"title": "3. Confirme la lectura",
115-
"description": "Su confirmación se registra con una firma Ed25519"
116+
"description": "Su confirmación se registra de manera segura y verificable"
116117
},
117118
"features": {
118119
"crypto": {
119120
"title": "Seguridad criptográfica",
120-
"description": "Firmas Ed25519 irrefutables que garantizan la autenticidad"
121+
"description": "Confirmaciones irrefutables que garantizan la autenticidad"
121122
},
122123
"instant": {
123124
"title": "Instantáneo",
@@ -206,7 +207,7 @@
206207
"allConfirmations": "Todas mis confirmaciones",
207208
"about": {
208209
"title": "Acerca de las confirmaciones",
209-
"description": "Cada confirmación se registra criptográficamente con Ed25519 y se encadena para garantizar la integridad. Las confirmaciones son irrefutables y tienen una marca de tiempo precisa."
210+
"description": "Cada confirmación se registra criptográficamente y se encadena para garantizar la integridad. Las confirmaciones son irrefutables y tienen una marca de tiempo precisa."
210211
},
211212
"search": "Buscar...",
212213
"error": {
@@ -447,17 +448,17 @@
447448
}
448449
},
449450
"embed": {
450-
"loading": "Cargando información de la firma...",
451-
"title": "Firma para",
451+
"loading": "Cargando información de la confirmación...",
452+
"title": "Confirmación para",
452453
"document": "Documento:",
453-
"signedBy": "Firmado por",
454+
"signedBy": "Confirmado por",
454455
"on": "el",
455456
"verified": "Verificado",
456457
"viewAll": "Ver todas las confirmaciones",
457-
"error": "Imposible cargar la información de la firma",
458-
"sign": "Firmar",
459-
"signDocument": "Firmar este documento",
460-
"noSignatures": "Ninguna firma para este documento",
458+
"error": "Imposible cargar la información de la confirmación",
459+
"sign": "Confirmar",
460+
"signDocument": "Confirmar este documento",
461+
"noSignatures": "Ninguna confirmación para este documento",
461462
"confirmationsCount": "{count} confirmación(es)",
462463
"poweredBy": "Desarrollado por Ackify",
463464
"missingDocId": "ID de documento faltante"
@@ -468,7 +469,7 @@
468469
"home": "Volver al inicio"
469470
},
470471
"footer": {
471-
"description": "Solución de código abierto de confirmación criptográfica de lectura de documentos con firmas Ed25519 irrefutables.",
472+
"description": "Solución de código abierto de confirmación criptográfica de lectura de documentos con atestaciones irrefutables.",
472473
"navigation": {
473474
"title": "Navegación"
474475
},

0 commit comments

Comments
 (0)