Konto: echter Name jetzt getrennt vom optionalen Benutzernamen (Spitzname)
Bisher gab es nur ein "Benutzername"-Feld, das überall (Begrüßung, Header, Rezensionen) angezeigt wurde. Jetzt gibt es zwei getrennte Felder: einen festen "Name" (Pflichtangabe, z.B. für Bestellungen) und einen optionalen "Benutzername (Spitzname)" als Bonus, falls man lieber mit einem Spitznamen statt dem echten Namen angezeigt werden möchte. Überall, wo bisher nur der Benutzername angezeigt wurde (Header-Konto-Menü, Begrüßung im Dashboard, Rezensions-Autorenname, "angemeldet als"-Hinweis), gilt jetzt: Spitzname bevorzugt, sonst echter Name als Rückfalloption (neue anzeigeName()-Hilfsfunktion in scripts/account.ts). Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
7549ec239b
commit
5b14630986
@@ -176,7 +176,7 @@ const p = (href: string) => `${localePrefix(lang)}${href}`;
|
||||
|
||||
<script>
|
||||
import { cartCount } from "../scripts/cart";
|
||||
import { getAccount, logout } from "../scripts/account";
|
||||
import { getAccount, logout, anzeigeName } from "../scripts/account";
|
||||
|
||||
function updateCount() {
|
||||
const el = document.getElementById("cart-count");
|
||||
@@ -202,14 +202,14 @@ const p = (href: string) => `${localePrefix(lang)}${href}`;
|
||||
if (loginBtn) loginBtn.style.display = a.loggedIn ? "none" : "";
|
||||
if (menu) menu.style.display = a.loggedIn ? "flex" : "none";
|
||||
if (!a.loggedIn) return;
|
||||
if (usernameLabel) usernameLabel.textContent = a.username || "Konto";
|
||||
if (usernameLabel) usernameLabel.textContent = anzeigeName(a) || "Konto";
|
||||
if (avatar) {
|
||||
if (a.photo) {
|
||||
avatar.style.backgroundImage = `url(${a.photo})`;
|
||||
avatar.textContent = "";
|
||||
} else {
|
||||
avatar.style.backgroundImage = "";
|
||||
avatar.textContent = (a.username || "?").trim().charAt(0).toUpperCase();
|
||||
avatar.textContent = (anzeigeName(a) || "?").trim().charAt(0).toUpperCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user