mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 14:16:12 +00:00
The dashboard greeting, the Insights greeting, the top bar and the sidebar read the username, so a display name set on the profile card reached the reports but none of the surfaces that address the account. They now read one helper that returns the display name when set and falls back to the username otherwise. Refs #1309
14 lines
482 B
TypeScript
14 lines
482 B
TypeScript
/**
|
|
* The name the app shows and addresses an account by: the display name when
|
|
* one is set, the username otherwise. Greetings, the top bar and the sidebar
|
|
* all read it here, so the display name edited on the profile card reaches
|
|
* every surface that names the account.
|
|
*/
|
|
export function accountName(user: {
|
|
username: string;
|
|
displayName?: string | null;
|
|
}): string {
|
|
const displayName = user.displayName?.trim();
|
|
return displayName ? displayName : user.username;
|
|
}
|