diff --git a/app/src/ui/lib/avatar.tsx b/app/src/ui/lib/avatar.tsx index 27fafca37b..5b76ac8848 100644 --- a/app/src/ui/lib/avatar.tsx +++ b/app/src/ui/lib/avatar.tsx @@ -256,35 +256,28 @@ export class Avatar extends React.Component { this.state = { user, candidates, imageError: false } } - private getTitle(): string | JSX.Element | undefined { - if (this.props.title === null) { - return undefined + private getTitle() { + const { title, user, accounts } = this.props + + if (title !== undefined) { + return title } - if (this.props.title !== undefined) { - return this.props.title - } - - const user = this.props.user - if (user) { - if (user.name) { - return ( - <> - + if (user?.name) { + return ( + <> + +
-
- {user.name} -
-
{user.email}
+ {user.name}
- - ) - } else { - return user.email - } +
{user.email}
+
+ + ) } - return 'Unknown user' + return user?.email ?? 'Unknown user' } private onImageError = (e: React.SyntheticEvent) => { @@ -317,7 +310,7 @@ export class Avatar extends React.Component {